blob: f0b458a0f4f065eec1db3d6c37b1e71e4bf371a3 [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 Butler478a78e2021-10-28 01:54:26 +000026cc_defaults {
27 name: "neuralnetworks_utils_hal_aidl_defaults",
Sally Qi784c2532022-08-22 13:50:32 -070028 defaults: [
29 "android.hardware.graphics.common-ndk_static",
30 "neuralnetworks_utils_defaults",
31 ],
Xusong Wang7f5c7d22021-10-05 14:10:41 -070032 srcs: [
33 // AIDL utils that a driver may depend on.
34 "src/BufferTracker.cpp",
35 "src/Conversions.cpp",
36 "src/HalUtils.cpp",
37 "src/Utils.cpp",
38 "src/ValidateHal.cpp",
39 ],
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000040 local_include_dirs: ["include/nnapi/hal/aidl/"],
41 export_include_dirs: ["include"],
Lev Proleev900c28a2021-01-26 19:40:20 +000042 cflags: ["-Wthread-safety"],
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000043 static_libs: [
Michael Butlerf03ebd92021-03-25 15:27:38 -070044 "libaidlcommonsupport",
Michael Butlerab2f4822021-02-08 00:05:07 -080045 "libarect",
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000046 "neuralnetworks_types",
47 "neuralnetworks_utils_hal_common",
48 ],
49 shared_libs: [
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000050 "libbinder_ndk",
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000051 ],
Ray Hernandez338d6f82021-08-11 21:29:20 +000052 target: {
53 android: {
54 shared_libs: ["libnativewindow"],
55 },
56 },
Lev Proleev6b6dfcd2020-11-11 18:28:50 +000057}
Lev Proleev900c28a2021-01-26 19:40:20 +000058
Xusong Wang7f5c7d22021-10-05 14:10:41 -070059// Deprecated. Remove once all modules depending on this are migrated away.
Michael Butler478a78e2021-10-28 01:54:26 +000060cc_library_static {
61 name: "neuralnetworks_utils_hal_aidl_v1",
62 defaults: ["neuralnetworks_utils_hal_aidl_defaults"],
63 shared_libs: [
64 "android.hardware.neuralnetworks-V1-ndk",
Xusong Wang9763a952021-10-05 10:07:12 -070065 ],
Michael Butler478a78e2021-10-28 01:54:26 +000066}
67
68cc_library_static {
David Gross04ed8592021-11-17 15:39:18 -080069 name: "neuralnetworks_utils_hal_aidl",
70 defaults: ["neuralnetworks_utils_hal_aidl_defaults"],
Xusong Wang7f5c7d22021-10-05 14:10:41 -070071 srcs: [
72 // Additional AIDL utils for the runtime.
73 "src/Assertions.cpp",
74 "src/Buffer.cpp",
75 "src/Burst.cpp",
76 "src/Callbacks.cpp",
77 "src/Device.cpp",
78 "src/Execution.cpp",
79 "src/InvalidDevice.cpp",
80 "src/PreparedModel.cpp",
81 "src/ProtectCallback.cpp",
82 "src/Service.cpp",
David Gross04ed8592021-11-17 15:39:18 -080083 ],
Xusong Wang7f5c7d22021-10-05 14:10:41 -070084 shared_libs: [
85 "android.hardware.neuralnetworks-V4-ndk",
86 ],
87 cflags: ["-DNN_AIDL_V4_OR_ABOVE"],
David Gross04ed8592021-11-17 15:39:18 -080088}
89
Michael Butler478a78e2021-10-28 01:54:26 +000090// A cc_defaults that includes the latest non-experimental AIDL utilities and other AIDL libraries
91// that are commonly used together. Modules that always depend on the latest non-experimental
92// AIDL features can include this cc_defaults to avoid managing dependency versions explicitly.
93cc_defaults {
94 name: "neuralnetworks_use_latest_utils_hal_aidl",
Sally Qi784c2532022-08-22 13:50:32 -070095 defaults: ["android.hardware.graphics.common-ndk_static"],
Xusong Wang9763a952021-10-05 10:07:12 -070096 static_libs: [
Michael Butler932e82b2021-10-26 03:29:13 +000097 "android.hardware.common-V2-ndk",
Xusong Wang7f5c7d22021-10-05 14:10:41 -070098 "android.hardware.neuralnetworks-V4-ndk",
Michael Butler478a78e2021-10-28 01:54:26 +000099 "neuralnetworks_utils_hal_aidl",
100 ],
Xusong Wang7f5c7d22021-10-05 14:10:41 -0700101 cflags: ["-DNN_AIDL_V4_OR_ABOVE"],
Michael Butler478a78e2021-10-28 01:54:26 +0000102}
103
104cc_test {
105 name: "neuralnetworks_utils_hal_aidl_test",
106 defaults: [
107 "neuralnetworks_use_latest_utils_hal_aidl",
108 "neuralnetworks_utils_defaults",
109 ],
Chih-Hung Hsiehad1bf312022-02-17 21:56:13 -0800110 tidy_timeout_srcs: [
111 "test/DeviceTest.cpp",
112 "test/PreparedModelTest.cpp",
113 ],
Michael Butler478a78e2021-10-28 01:54:26 +0000114 srcs: [
115 "test/*.cpp",
116 ],
117 static_libs: [
Michael Butlerf03ebd92021-03-25 15:27:38 -0700118 "libaidlcommonsupport",
Lev Proleev900c28a2021-01-26 19:40:20 +0000119 "libgmock",
Lev Proleev900c28a2021-01-26 19:40:20 +0000120 "neuralnetworks_types",
Lev Proleev900c28a2021-01-26 19:40:20 +0000121 "neuralnetworks_utils_hal_common",
122 ],
123 shared_libs: [
Lev Proleev900c28a2021-01-26 19:40:20 +0000124 "libbase",
125 "libbinder_ndk",
126 "libcutils",
Lev Proleev900c28a2021-01-26 19:40:20 +0000127 ],
Ray Hernandez338d6f82021-08-11 21:29:20 +0000128 target: {
129 android: {
130 shared_libs: ["libnativewindow"],
131 },
Ray Hernandez338d6f82021-08-11 21:29:20 +0000132 },
Lev Proleev900c28a2021-01-26 19:40:20 +0000133 cflags: [
134 /* GMOCK defines functions for printing all MOCK_DEVICE arguments and
135 * MockDevice contains a string pointer which triggers a warning in the
136 * base logging library. */
137 "-Wno-user-defined-warnings",
138 ],
139 test_suites: ["general-tests"],
140}