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