1/*
2 * Copyright 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package {
18    // Inherits all licenses from parent to get Apache 2.0 and package name
19    default_applicable_licenses: [
20        "packages_modules_NeuralNetworks_license",
21    ],
22}
23
24cc_defaults {
25    name: "NeuralNetworksSampleDriverAidl_defaults",
26    defaults: [
27        "neuralnetworks_defaults",
28        "neuralnetworks_use_latest_utils_hal_aidl",
29    ],
30    host_supported: false,
31    // b/109953668, disable OpenMP
32    // openmp: true,
33    srcs: [
34        "SampleDriverAidl.cpp",
35        "SampleDriverAidlFull.cpp",
36        "SampleDriverAidlPartial.cpp",
37        "SampleDriverAidlUtils.cpp",
38    ],
39    header_libs: [
40        "libneuralnetworks_headers",
41    ],
42    shared_libs: [
43        "android.hardware.neuralnetworks@1.0",
44        "android.hardware.neuralnetworks@1.1",
45        "android.hardware.neuralnetworks@1.2",
46        "android.hardware.neuralnetworks@1.3",
47        "libbase",
48        "libbinder_ndk",
49        "libcutils",
50        "libdl",
51        "libfmq",
52        "libhardware",
53        "libhidlbase",
54        "libhidlmemory",
55        "liblog",
56        "libnativewindow",
57        "libtextclassifier_hash",
58        "libutils",
59    ],
60    static_libs: [
61        "libaidlcommonsupport",
62        "libneuralnetworks_common",
63        "neuralnetworks_utils_hal_common",
64    ],
65}
66
67cc_defaults {
68    name: "NeuralNetworksSampleDriverAidl_server_defaults",
69    defaults: ["NeuralNetworksSampleDriverAidl_defaults"],
70    relative_install_path: "hw",
71    proprietary: true,
72}
73
74cc_binary {
75    name: "android.hardware.neuralnetworks-service-sample-all",
76    srcs: ["SampleDriverAidlAll.cpp"],
77    defaults: ["NeuralNetworksSampleDriverAidl_server_defaults"],
78    init_rc: ["config/android.hardware.neuralnetworks-service-sample-all.rc"],
79    vintf_fragments: ["config/android.hardware.neuralnetworks-service-sample-all.xml"],
80}
81
82// android.hardware.neuralnetworks-service-sample-limited is a sAIDL vendor
83// service that adapts multiple canonical interface objects (as returned by
84// `getDevices`) as sAIDL objects and registers them with service manager.
85// Because it is vendor_available, it cannot use the Support Library's _cl
86// build variants. Instead, it uses the non-_cl variants which are
87// vendor_available, including:
88// * neuralnetworks_types
89// * libneuralnetworks_common
90// * neuralnetworks_utils_hal_adapter_aidl
91//
92// To see how the Support Library object can be built, refer to
93// neuralnetworks_sample_sl_driver defined in
94// packages/modules/NeuralNetworks/driver/sample/Android.bp.
95//
96// To see how a Support Library prebuilt can be used as a sAIDL vendor service,
97// refer to android.hardware.neuralnetworks-shim-service-sample defined in
98// packages/modules/NeuralNetworks/driver/sample_shim/Android.bp.
99cc_binary {
100    name: "android.hardware.neuralnetworks-service-sample-limited",
101    srcs: ["SampleDriverAidlLimited.cpp"],
102    defaults: [
103        "neuralnetworks_defaults",
104        "neuralnetworks_use_latest_utils_hal_aidl",
105    ],
106    header_libs: [
107        "libneuralnetworks_headers",
108    ],
109    shared_libs: [
110        "libbase",
111        "libbinder_ndk",
112        "libcutils",
113        "liblog",
114        "libnativewindow",
115        "libtextclassifier_hash",
116        "libutils",
117    ],
118    static_libs: [
119        "libaidlcommonsupport",
120        "libneuralnetworks_common",
121        "neuralnetworks_canonical_sample_driver",
122        "neuralnetworks_utils_hal_adapter_aidl",
123    ],
124    relative_install_path: "hw",
125    proprietary: true,
126    init_rc: ["config/android.hardware.neuralnetworks-service-sample-limited.rc"],
127    vintf_fragments: ["config/android.hardware.neuralnetworks-service-sample-limited.xml"],
128}
129
130cc_library_static {
131    name: "libSampleDriverAidl",
132    defaults: ["NeuralNetworksSampleDriverAidl_defaults"],
133    export_include_dirs: ["."],
134}
135