1/*
2 * Copyright 2017 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
17cc_library_headers {
18    name: "libneuralnetworks_headers",
19    host_supported: false,
20    vendor_available: true,
21    export_include_dirs: ["include"],
22    apex_available: [
23        "com.android.neuralnetworks",
24        "test_com.android.neuralnetworks", // Due to the dependency from libneuralnetworks_common
25        // that is available to the platform
26
27        "//apex_available:platform",
28    ],
29}
30
31cc_library_headers {
32    name: "libneuralnetworks_headers_ndk",
33    export_include_dirs: ["include"],
34    sdk_version: "current",
35}
36
37cc_library_headers {
38    name: "libneuralnetworks_private_headers",
39    host_supported: false,
40    export_include_dirs: ["."],
41}
42
43cc_defaults {
44    name: "libneuralnetworks_defaults",
45    host_supported: false,
46    use_version_lib: true,
47    // b/109953668, disable OpenMP
48    // openmp: true,
49    srcs: [
50        "BurstBuilder.cpp",
51        "Callbacks.cpp",
52        "CompilationBuilder.cpp",
53        "ExecutionBuilder.cpp",
54        "ExecutionPlan.cpp",
55        "Manager.cpp",
56        "Memory.cpp",
57        "ModelArgumentInfo.cpp",
58        "ModelBuilder.cpp",
59        "NeuralNetworks.cpp",
60        "TypeManager.cpp",
61        "VersionedInterfaces.cpp",
62    ],
63
64    target: {
65        android: {
66            version_script: "libneuralnetworks.map.txt",
67            shared_libs: [
68                "liblog",
69                "libnativewindow",
70                "libneuralnetworks_packageinfo",
71            ],
72        },
73        host: {
74            shared_libs: [
75            ],
76        },
77    },
78
79    // TODO(pszczepaniak, b/144488395): Use system libnativewindow,
80    // this would remove half of dependencies here.
81    static_libs: [
82        "android.hardware.neuralnetworks@1.0",
83        "android.hardware.neuralnetworks@1.1",
84        "android.hardware.neuralnetworks@1.2",
85        "android.hardware.neuralnetworks@1.3",
86        "android.hidl.allocator@1.0",
87        "android.hidl.memory@1.0",
88        "libbase",
89        "libcrypto_static",
90        "libcutils",
91        "libfmq",
92        "libhidlbase",
93        "libhidlmemory",
94        "libjsoncpp",
95        "libmath",
96        "libneuralnetworks_common",
97        "libprocessgroup",
98        "libtextclassifier_hash_static",
99        "libutils",
100    ],
101
102    stl: "libc++_static",
103
104    whole_static_libs: [
105        "libprocpartition",
106    ],
107
108    shared_libs: [
109        "libcgrouprc",
110        "libvndksupport",
111    ],
112
113    header_libs: [
114        "libneuralnetworks_headers",
115    ],
116
117    export_header_lib_headers: [
118        "libneuralnetworks_headers",
119    ],
120}
121
122cc_library_shared {
123    name: "libneuralnetworks",
124    defaults: [
125        "libneuralnetworks_defaults",
126        "neuralnetworks_defaults",
127    ],
128    apex_available: [
129        "com.android.neuralnetworks",
130        "test_com.android.neuralnetworks",
131    ],
132
133    stubs: {
134        versions: [
135            "30",
136        ],
137        symbol_file: "libneuralnetworks.map.txt",
138    },
139}
140
141// Required for tests (b/147158681)
142cc_library_static {
143    name: "libneuralnetworks_static",
144    defaults: [
145        "libneuralnetworks_defaults",
146        "neuralnetworks_defaults",
147    ],
148    apex_available: ["//apex_available:platform"],
149}
150
151ndk_headers {
152    name: "libneuralnetworks_ndk_headers",
153    from: "include",
154    to: "android",
155    srcs: ["include/NeuralNetworks.h"],
156    license: "NOTICE",
157}
158
159ndk_library {
160    name: "libneuralnetworks",
161    symbol_file: "libneuralnetworks.map.txt",
162    // Android O-MR1
163    first_version: "27",
164}
165
166llndk_library {
167    name: "libneuralnetworks",
168    symbol_file: "libneuralnetworks.map.txt",
169    export_include_dirs: ["include"],
170}
171