blob: 6cd95bd33e69944d80f266184262b6b464351b5d [file] [log] [blame]
Lev Proleev6b6dfcd2020-11-11 18:28:50 +00001//
2// Copyright (C) 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
Bob Badourb224b362021-02-12 20:13:01 -080017package {
18 // See: http://go/android-license-faq
19 // A large-scale-change added 'default_applicable_licenses' to import
20 // all of the 'license_kinds' from "hardware_interfaces_license"
21 // to get the below license kinds:
22 // SPDX-license-identifier-Apache-2.0
23 default_applicable_licenses: ["hardware_interfaces_license"],
24}
25
Michael Butlerabc86912021-10-28 01:54:26 +000026cc_defaults {
27 name: "neuralnetworks_utils_hal_aidl_defaults",
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000028 defaults: ["neuralnetworks_utils_defaults"],
Xusong Wang11f30c82021-10-05 14:10:41 -070029 srcs: [
30 // AIDL utils that a driver may depend on.
31 "src/BufferTracker.cpp",
32 "src/Conversions.cpp",
33 "src/HalUtils.cpp",
34 "src/Utils.cpp",
35 "src/ValidateHal.cpp",
36 ],
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000037 local_include_dirs: ["include/nnapi/hal/aidl/"],
38 export_include_dirs: ["include"],
Lev Proleev900c28a2021-01-26 19:40:20 +000039 cflags: ["-Wthread-safety"],
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000040 static_libs: [
Jiyong Park27f77fe2021-07-27 12:16:52 +090041 "android.hardware.graphics.common-V2-ndk",
Michael Butlerf03ebd92021-03-25 15:27:38 -070042 "libaidlcommonsupport",
Michael Butlerab2f4822021-02-08 00:05:07 -080043 "libarect",
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000044 "neuralnetworks_types",
45 "neuralnetworks_utils_hal_common",
46 ],
47 shared_libs: [
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000048 "libbinder_ndk",
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000049 ],
Ray Hernandez338d6f82021-08-11 21:29:20 +000050 target: {
51 android: {
52 shared_libs: ["libnativewindow"],
53 },
54 },
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000055}
Lev Proleev900c28a2021-01-26 19:40:20 +000056
Xusong Wang11f30c82021-10-05 14:10:41 -070057// Deprecated. Remove once all modules depending on this are migrated away.
Michael Butlerabc86912021-10-28 01:54:26 +000058cc_library_static {
59 name: "neuralnetworks_utils_hal_aidl_v1",
60 defaults: ["neuralnetworks_utils_hal_aidl_defaults"],
61 shared_libs: [
62 "android.hardware.neuralnetworks-V1-ndk",
Lev Proleev900c28a2021-01-26 19:40:20 +000063 ],
Michael Butlerabc86912021-10-28 01:54:26 +000064}
65
66cc_library_static {
David Gross2edfc462021-11-17 15:39:18 -080067 name: "neuralnetworks_utils_hal_aidl",
68 defaults: ["neuralnetworks_utils_hal_aidl_defaults"],
Xusong Wang11f30c82021-10-05 14:10:41 -070069 srcs: [
70 // Additional AIDL utils for the runtime.
71 "src/Assertions.cpp",
72 "src/Buffer.cpp",
73 "src/Burst.cpp",
74 "src/Callbacks.cpp",
75 "src/Device.cpp",
76 "src/Execution.cpp",
77 "src/InvalidDevice.cpp",
78 "src/PreparedModel.cpp",
79 "src/ProtectCallback.cpp",
80 "src/Service.cpp",
David Gross2edfc462021-11-17 15:39:18 -080081 ],
Xusong Wang11f30c82021-10-05 14:10:41 -070082 shared_libs: [
83 "android.hardware.neuralnetworks-V4-ndk",
84 ],
85 cflags: ["-DNN_AIDL_V4_OR_ABOVE"],
David Gross2edfc462021-11-17 15:39:18 -080086}
87
Michael Butlerabc86912021-10-28 01:54:26 +000088// A cc_defaults that includes the latest non-experimental AIDL utilities and other AIDL libraries
89// that are commonly used together. Modules that always depend on the latest non-experimental
90// AIDL features can include this cc_defaults to avoid managing dependency versions explicitly.
91cc_defaults {
92 name: "neuralnetworks_use_latest_utils_hal_aidl",
Lev Proleev900c28a2021-01-26 19:40:20 +000093 static_libs: [
Jiyong Park27f77fe2021-07-27 12:16:52 +090094 "android.hardware.common-V2-ndk",
95 "android.hardware.graphics.common-V2-ndk",
Xusong Wang11f30c82021-10-05 14:10:41 -070096 "android.hardware.neuralnetworks-V4-ndk",
Michael Butlerabc86912021-10-28 01:54:26 +000097 "neuralnetworks_utils_hal_aidl",
98 ],
Xusong Wang11f30c82021-10-05 14:10:41 -070099 cflags: ["-DNN_AIDL_V4_OR_ABOVE"],
Michael Butlerabc86912021-10-28 01:54:26 +0000100}
101
102cc_test {
103 name: "neuralnetworks_utils_hal_aidl_test",
104 defaults: [
105 "neuralnetworks_use_latest_utils_hal_aidl",
106 "neuralnetworks_utils_defaults",
107 ],
Chih-Hung Hsiehad1bf312022-02-17 21:56:13 -0800108 tidy_timeout_srcs: [
109 "test/DeviceTest.cpp",
110 "test/PreparedModelTest.cpp",
111 ],
Michael Butlerabc86912021-10-28 01:54:26 +0000112 srcs: [
113 "test/*.cpp",
114 ],
115 static_libs: [
Michael Butlerf03ebd92021-03-25 15:27:38 -0700116 "libaidlcommonsupport",
Lev Proleev900c28a2021-01-26 19:40:20 +0000117 "libgmock",
Lev Proleev900c28a2021-01-26 19:40:20 +0000118 "neuralnetworks_types",
Lev Proleev900c28a2021-01-26 19:40:20 +0000119 "neuralnetworks_utils_hal_common",
120 ],
121 shared_libs: [
Lev Proleev900c28a2021-01-26 19:40:20 +0000122 "libbase",
123 "libbinder_ndk",
124 "libcutils",
Lev Proleev900c28a2021-01-26 19:40:20 +0000125 ],
Ray Hernandez338d6f82021-08-11 21:29:20 +0000126 target: {
127 android: {
128 shared_libs: ["libnativewindow"],
129 },
130 host: {
131 cflags: [
132 "-D__INTRODUCED_IN(x)=",
133 "-D__assert(a,b,c)=",
134 // We want all the APIs to be available on the host.
135 "-D__ANDROID_API__=10000",
136 ],
137 },
138 },
Lev Proleev900c28a2021-01-26 19:40:20 +0000139 cflags: [
140 /* GMOCK defines functions for printing all MOCK_DEVICE arguments and
141 * MockDevice contains a string pointer which triggers a warning in the
142 * base logging library. */
143 "-Wno-user-defined-warnings",
144 ],
145 test_suites: ["general-tests"],
146}