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", |
Sally Qi | 784c253 | 2022-08-22 13:50:32 -0700 | [diff] [blame^] | 28 | defaults: [ |
| 29 | "android.hardware.graphics.common-ndk_static", |
| 30 | "neuralnetworks_utils_defaults", |
| 31 | ], |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame] | 32 | 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 Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 40 | local_include_dirs: ["include/nnapi/hal/aidl/"], |
| 41 | export_include_dirs: ["include"], |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 42 | cflags: ["-Wthread-safety"], |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 43 | static_libs: [ |
Michael Butler | f03ebd9 | 2021-03-25 15:27:38 -0700 | [diff] [blame] | 44 | "libaidlcommonsupport", |
Michael Butler | ab2f482 | 2021-02-08 00:05:07 -0800 | [diff] [blame] | 45 | "libarect", |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 46 | "neuralnetworks_types", |
| 47 | "neuralnetworks_utils_hal_common", |
| 48 | ], |
| 49 | shared_libs: [ |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 50 | "libbinder_ndk", |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 51 | ], |
Ray Hernandez | 338d6f8 | 2021-08-11 21:29:20 +0000 | [diff] [blame] | 52 | target: { |
| 53 | android: { |
| 54 | shared_libs: ["libnativewindow"], |
| 55 | }, |
| 56 | }, |
Lev Proleev | 6b6dfcd | 2020-11-11 18:28:50 +0000 | [diff] [blame] | 57 | } |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 58 | |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame] | 59 | // Deprecated. Remove once all modules depending on this are migrated away. |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 60 | cc_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 Wang | 9763a95 | 2021-10-05 10:07:12 -0700 | [diff] [blame] | 65 | ], |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | cc_library_static { |
David Gross | 04ed859 | 2021-11-17 15:39:18 -0800 | [diff] [blame] | 69 | name: "neuralnetworks_utils_hal_aidl", |
| 70 | defaults: ["neuralnetworks_utils_hal_aidl_defaults"], |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame] | 71 | 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 Gross | 04ed859 | 2021-11-17 15:39:18 -0800 | [diff] [blame] | 83 | ], |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame] | 84 | shared_libs: [ |
| 85 | "android.hardware.neuralnetworks-V4-ndk", |
| 86 | ], |
| 87 | cflags: ["-DNN_AIDL_V4_OR_ABOVE"], |
David Gross | 04ed859 | 2021-11-17 15:39:18 -0800 | [diff] [blame] | 88 | } |
| 89 | |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 90 | // 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. |
| 93 | cc_defaults { |
| 94 | name: "neuralnetworks_use_latest_utils_hal_aidl", |
Sally Qi | 784c253 | 2022-08-22 13:50:32 -0700 | [diff] [blame^] | 95 | defaults: ["android.hardware.graphics.common-ndk_static"], |
Xusong Wang | 9763a95 | 2021-10-05 10:07:12 -0700 | [diff] [blame] | 96 | static_libs: [ |
Michael Butler | 932e82b | 2021-10-26 03:29:13 +0000 | [diff] [blame] | 97 | "android.hardware.common-V2-ndk", |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame] | 98 | "android.hardware.neuralnetworks-V4-ndk", |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 99 | "neuralnetworks_utils_hal_aidl", |
| 100 | ], |
Xusong Wang | 7f5c7d2 | 2021-10-05 14:10:41 -0700 | [diff] [blame] | 101 | cflags: ["-DNN_AIDL_V4_OR_ABOVE"], |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | cc_test { |
| 105 | name: "neuralnetworks_utils_hal_aidl_test", |
| 106 | defaults: [ |
| 107 | "neuralnetworks_use_latest_utils_hal_aidl", |
| 108 | "neuralnetworks_utils_defaults", |
| 109 | ], |
Chih-Hung Hsieh | ad1bf31 | 2022-02-17 21:56:13 -0800 | [diff] [blame] | 110 | tidy_timeout_srcs: [ |
| 111 | "test/DeviceTest.cpp", |
| 112 | "test/PreparedModelTest.cpp", |
| 113 | ], |
Michael Butler | 478a78e | 2021-10-28 01:54:26 +0000 | [diff] [blame] | 114 | srcs: [ |
| 115 | "test/*.cpp", |
| 116 | ], |
| 117 | static_libs: [ |
Michael Butler | f03ebd9 | 2021-03-25 15:27:38 -0700 | [diff] [blame] | 118 | "libaidlcommonsupport", |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 119 | "libgmock", |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 120 | "neuralnetworks_types", |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 121 | "neuralnetworks_utils_hal_common", |
| 122 | ], |
| 123 | shared_libs: [ |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 124 | "libbase", |
| 125 | "libbinder_ndk", |
| 126 | "libcutils", |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 127 | ], |
Ray Hernandez | 338d6f8 | 2021-08-11 21:29:20 +0000 | [diff] [blame] | 128 | target: { |
| 129 | android: { |
| 130 | shared_libs: ["libnativewindow"], |
| 131 | }, |
Ray Hernandez | 338d6f8 | 2021-08-11 21:29:20 +0000 | [diff] [blame] | 132 | }, |
Lev Proleev | 900c28a | 2021-01-26 19:40:20 +0000 | [diff] [blame] | 133 | 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 | } |