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
17// package has name collision with other module, must use licenses in targets
18// Inherits all licenses from parent to get Apache 2.0 and package name.
19// package {
20//     default_applicable_licenses: ["packages_modules_NeuralNetworks_license"],
21// }
22
23cc_library_headers {
24    name: "neuralnetworks_supportlibrary_types_ndk",
25    host_supported: false,
26    export_include_dirs: ["public"],
27    licenses: ["packages_modules_NeuralNetworks_license"],
28    sdk_version: "current",
29    vendor_available: true,
30    min_sdk_version: "29",
31}
32
33/** Version of the shim (Adapter between SL/Updatable Driver and sAIDL service)
34 * intended to be used by a non-updatable (without an OTA) NNAPI vendor drivers
35 * backed by a SL/Updatable Driver.
36 */
37package {
38    default_applicable_licenses: ["packages_modules_NeuralNetworks_license"],
39}
40
41cc_library_static {
42    name: "libneuralnetworks_shim_static",
43    defaults: [
44        "neuralnetworks_use_latest_utils_hal_aidl",
45    ],
46    apex_available: [
47        "//apex_available:platform",
48        "com.android.neuralnetworks",
49        "test_com.android.neuralnetworks",
50    ],
51    srcs: [
52        "NeuralNetworksShim.cpp",
53        "ShimBufferTracker.cpp",
54        "ShimConverter.cpp",
55        "ShimDevice.cpp",
56        "ShimDeviceManager.cpp",
57        "ShimPreparedModel.cpp",
58        "ShimUtils.cpp",
59    ],
60    licenses: ["packages_modules_NeuralNetworks_license"],
61    vendor_available: true,
62    min_sdk_version: "30",
63    cflags: [
64        // Needed by neuralnetworks_supportlibrary_loader
65        // Should be removed after doing b/117845862
66        "-DNNTEST_SLTS",
67        "-DNN_COMPATIBILITY_LIBRARY_BUILD",
68        "-Wall",
69        "-Werror",
70    ],
71    header_libs: [
72        "libneuralnetworks_headers",
73    ],
74    local_include_dirs: [
75        "include",
76    ],
77    static_libs: [
78        "libaidlcommonsupport",
79        "libarect",
80        "libcutils",
81        "libneuralnetworks_common",
82        "neuralnetworks_supportlibrary_loader",
83        "neuralnetworks_utils_hal_common",
84    ],
85    shared_libs: [
86        "libbase",
87        "libbinder_ndk",
88        "libhidlbase",
89        "libhidlmemory",
90        "liblog",
91        "libnativewindow",
92    ],
93    export_include_dirs: [
94        "public",
95    ],
96}
97
98cc_library_static {
99    name: "neuralnetworks_supportlibrary_loader",
100    host_supported: false,
101    srcs: [
102        "SupportLibrary.cpp",
103        "SupportLibraryWrapper.cpp",
104    ],
105    shared_libs: [
106        "libnativewindow",
107    ],
108    cflags: [
109        "-DNNTEST_COMPUTE_MODE",
110        "-DNNTEST_ONLY_PUBLIC_API",
111        "-DNNTEST_SLTS",
112        "-DNN_COMPATIBILITY_LIBRARY_BUILD",
113        "-Wall",
114        "-Werror",
115    ],
116    apex_available: [
117        "//apex_available:platform",
118        "com.android.neuralnetworks",
119        "test_com.android.neuralnetworks",
120    ],
121    export_include_dirs: [
122        "include",
123        "public",
124    ],
125    static_libs: [
126        "libarect",
127        "libbase",
128    ],
129    licenses: ["packages_modules_NeuralNetworks_license"],
130    vendor_available: true,
131    min_sdk_version: "29",
132    header_libs: [
133        "libneuralnetworks_headers",
134    ],
135}
136