Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 1 | // |
| 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 Badour | b224b36 | 2021-02-12 20:13:01 -0800 | [diff] [blame] | 17 | package { |
| 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 Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 26 | cc_defaults { |
| 27 | name: "neuralnetworks_utils_hal_aidl_defaults", |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 28 | defaults: ["neuralnetworks_utils_defaults"], |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame^] | 29 | 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 Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 37 | local_include_dirs: ["include/nnapi/hal/aidl/"], |
| 38 | export_include_dirs: ["include"], |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 39 | cflags: ["-Wthread-safety"], |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 40 | static_libs: [ |
Ady Abraham | fd549c9 | 2021-09-04 21:58:20 -0700 | [diff] [blame] | 41 | "android.hardware.graphics.common-V3-ndk", |
Michael Butler | f03ebd9 | 2021-03-25 15:27:38 -0700 | [diff] [blame] | 42 | "libaidlcommonsupport", |
Michael Butler | ab2f482 | 2021-02-08 00:05:07 -0800 | [diff] [blame] | 43 | "libarect", |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 44 | "neuralnetworks_types", |
| 45 | "neuralnetworks_utils_hal_common", |
| 46 | ], |
| 47 | shared_libs: [ |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 48 | "libbinder_ndk", |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 49 | ], |
Ray Hernandez | 338d6f8 | 2021-08-11 21:29:20 +0000 | [diff] [blame] | 50 | target: { |
| 51 | android: { |
| 52 | shared_libs: ["libnativewindow"], |
| 53 | }, |
| 54 | }, |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 55 | } |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 56 | |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame^] | 57 | // Deprecated. Remove once all modules depending on this are migrated away. |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 58 | cc_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", |
Xusong Wang | 9763a95 | 2021-10-05 10:07:12 -0700 | [diff] [blame] | 63 | ], |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 64 | } |
| 65 | |
| 66 | cc_library_static { |
David Gross | 04ed859 | 2021-11-17 15:39:18 -0800 | [diff] [blame] | 67 | name: "neuralnetworks_utils_hal_aidl", |
| 68 | defaults: ["neuralnetworks_utils_hal_aidl_defaults"], |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame^] | 69 | 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 Gross | 04ed859 | 2021-11-17 15:39:18 -0800 | [diff] [blame] | 81 | ], |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame^] | 82 | shared_libs: [ |
| 83 | "android.hardware.neuralnetworks-V4-ndk", |
| 84 | ], |
| 85 | cflags: ["-DNN_AIDL_V4_OR_ABOVE"], |
David Gross | 04ed859 | 2021-11-17 15:39:18 -0800 | [diff] [blame] | 86 | } |
| 87 | |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 88 | // 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. |
| 91 | cc_defaults { |
| 92 | name: "neuralnetworks_use_latest_utils_hal_aidl", |
Xusong Wang | 9763a95 | 2021-10-05 10:07:12 -0700 | [diff] [blame] | 93 | static_libs: [ |
Michael Butler | 932e82b | 2021-10-26 03:29:13 +0000 | [diff] [blame] | 94 | "android.hardware.common-V2-ndk", |
| 95 | "android.hardware.graphics.common-V3-ndk", |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame^] | 96 | "android.hardware.neuralnetworks-V4-ndk", |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 97 | "neuralnetworks_utils_hal_aidl", |
| 98 | ], |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame^] | 99 | cflags: ["-DNN_AIDL_V4_OR_ABOVE"], |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | cc_test { |
| 103 | name: "neuralnetworks_utils_hal_aidl_test", |
| 104 | defaults: [ |
| 105 | "neuralnetworks_use_latest_utils_hal_aidl", |
| 106 | "neuralnetworks_utils_defaults", |
| 107 | ], |
| 108 | srcs: [ |
| 109 | "test/*.cpp", |
| 110 | ], |
| 111 | static_libs: [ |
Michael Butler | f03ebd9 | 2021-03-25 15:27:38 -0700 | [diff] [blame] | 112 | "libaidlcommonsupport", |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 113 | "libgmock", |
| 114 | "libneuralnetworks_common", |
| 115 | "neuralnetworks_types", |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 116 | "neuralnetworks_utils_hal_common", |
| 117 | ], |
| 118 | shared_libs: [ |
| 119 | "android.hidl.allocator@1.0", |
| 120 | "libbase", |
| 121 | "libbinder_ndk", |
| 122 | "libcutils", |
| 123 | "libhidlbase", |
| 124 | "libhidlmemory", |
| 125 | "liblog", |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 126 | "libutils", |
| 127 | ], |
Ray Hernandez | 338d6f8 | 2021-08-11 21:29:20 +0000 | [diff] [blame] | 128 | target: { |
| 129 | android: { |
| 130 | shared_libs: ["libnativewindow"], |
| 131 | }, |
| 132 | host: { |
| 133 | cflags: [ |
| 134 | "-D__INTRODUCED_IN(x)=", |
| 135 | "-D__assert(a,b,c)=", |
| 136 | // We want all the APIs to be available on the host. |
| 137 | "-D__ANDROID_API__=10000", |
| 138 | ], |
| 139 | }, |
| 140 | }, |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 141 | cflags: [ |
| 142 | /* GMOCK defines functions for printing all MOCK_DEVICE arguments and |
| 143 | * MockDevice contains a string pointer which triggers a warning in the |
| 144 | * base logging library. */ |
| 145 | "-Wno-user-defined-warnings", |
| 146 | ], |
| 147 | test_suites: ["general-tests"], |
| 148 | } |