| /* | |
| * Copyright 2017 The Android Open Source Project | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software | |
| * distributed under the License is distributed on an "AS IS" BASIS, | |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| * See the License for the specific language governing permissions and | |
| * limitations under the License. | |
| */ | |
| package { | |
| default_applicable_licenses: ["Android-Apache-2.0"], | |
| } | |
| cc_library_headers { | |
| name: "libneuralnetworks_common_headers", | |
| host_supported: true, | |
| export_include_dirs: ["include"], | |
| } | |
| // The following files took too much time to compile with clang-tidy. | |
| tidy_disabled_common_operations_files = [ | |
| "operations/Activation.cpp", | |
| "operations/Broadcast.cpp", | |
| "operations/Concatenation.cpp", | |
| "operations/Conv2D.cpp", | |
| "operations/FullyConnected.cpp", | |
| "operations/L2Normalization.cpp", | |
| "operations/LocalResponseNormalization.cpp", | |
| "operations/PRelu.cpp", | |
| "operations/Pooling.cpp", | |
| "operations/Reshape.cpp", | |
| "operations/SimpleMath.cpp", | |
| "operations/Softmax.cpp", | |
| "operations/Transpose.cpp", | |
| ] | |
| cc_defaults { | |
| name: "neuralnetworks_operations", | |
| host_supported: true, | |
| srcs: [ | |
| "OperationResolver.cpp", | |
| "operations/Activation.cpp", | |
| "operations/BatchMatmul.cpp", | |
| "operations/BidirectionalSequenceRNN.cpp", | |
| "operations/Broadcast.cpp", | |
| "operations/ChannelShuffle.cpp", | |
| "operations/Comparisons.cpp", | |
| "operations/Concatenation.cpp", | |
| "operations/Conv2D.cpp", | |
| "operations/Densify.cpp", | |
| "operations/DepthwiseConv2D.cpp", | |
| "operations/Dequantize.cpp", | |
| "operations/Elementwise.cpp", | |
| "operations/Elu.cpp", | |
| "operations/Fill.cpp", | |
| "operations/FullyConnected.cpp", | |
| "operations/Gather.cpp", | |
| "operations/GenerateProposals.cpp", | |
| "operations/HeatmapMaxKeypoint.cpp", | |
| "operations/InstanceNormalization.cpp", | |
| "operations/L2Normalization.cpp", | |
| "operations/LocalResponseNormalization.cpp", | |
| "operations/LogSoftmax.cpp", | |
| "operations/LogicalAndOr.cpp", | |
| "operations/LogicalNot.cpp", | |
| "operations/MirrorPad.cpp", | |
| "operations/Neg.cpp", | |
| "operations/PRelu.cpp", | |
| "operations/Pack.cpp", | |
| "operations/Pooling.cpp", | |
| "operations/QLSTM.cpp", | |
| "operations/Quantize.cpp", | |
| "operations/Rank.cpp", | |
| "operations/Reduce.cpp", | |
| "operations/ResizeImageOps.cpp", | |
| "operations/Reverse.cpp", | |
| "operations/RoiAlign.cpp", | |
| "operations/RoiPooling.cpp", | |
| "operations/Select.cpp", | |
| "operations/Slice.cpp", | |
| "operations/Softmax.cpp", | |
| "operations/Squeeze.cpp", | |
| "operations/StridedSlice.cpp", | |
| "operations/TopK_V2.cpp", | |
| "operations/Transpose.cpp", | |
| "operations/TransposeConv2D.cpp", | |
| "operations/UnidirectionalSequenceLSTM.cpp", | |
| "operations/UnidirectionalSequenceRNN.cpp", | |
| ], | |
| tidy_disabled_srcs: tidy_disabled_common_operations_files, | |
| } | |
| // libneuralnetworks_common* provides common utilities for the NNAPI runtime, drivers, and tests to | |
| // use. Two variants of the common library are provided: | |
| // - libneuralnetworks_common: the common library, used by NNAPI runtime and tests. | |
| // - libneuralnetworks_common_experimental: the common library with NN_EXPERIMENTAL_FEATURE flag | |
| // turned on, used by NNAPI drivers and tests for experimental features. | |
| // | |
| // Both variants of the common library also link against all versions (1.0-3) of the NNAPI HIDL | |
| // library. | |
| // | |
| cc_defaults { | |
| name: "libneuralnetworks_common_defaults", | |
| defaults: [ | |
| "neuralnetworks_defaults", | |
| "neuralnetworks_operations", | |
| ], | |
| host_supported: true, | |
| apex_available: [ | |
| "//apex_available:platform", | |
| "com.android.neuralnetworks", | |
| "test_com.android.neuralnetworks", | |
| ], | |
| vendor_available: true, | |
| // b/109953668, disable OpenMP | |
| // openmp: true, | |
| export_include_dirs: [ | |
| "include", | |
| ], | |
| srcs: [ | |
| "ActivationFunctor.cpp", | |
| "BufferTracker.cpp", | |
| "CpuExecutor.cpp", | |
| "ExecutionBurstController.cpp", | |
| "ExecutionBurstServer.cpp", | |
| "GraphDump.cpp", | |
| "HalBufferTracker.cpp", | |
| "IndexedShapeWrapper.cpp", | |
| "LegacyHalUtils.cpp", | |
| "LegacyUtils.cpp", | |
| "MemoryUtils.cpp", | |
| "MetaModel.cpp", | |
| "OperationsUtils.cpp", | |
| "QuantUtils.cpp", | |
| "TokenHasher.cpp", | |
| "ValidateHal.cpp", | |
| "operations/ArgMinMax.cpp", | |
| "operations/BidirectionalSequenceLSTM.cpp", | |
| "operations/Cast.cpp", | |
| "operations/EmbeddingLookup.cpp", | |
| "operations/ExpandDims.cpp", | |
| "operations/GroupedConv2D.cpp", | |
| "operations/HashtableLookup.cpp", | |
| "operations/LSHProjection.cpp", | |
| "operations/LSTM.cpp", | |
| "operations/MaximumMinimum.cpp", | |
| "operations/Multinomial.cpp", | |
| "operations/Pow.cpp", | |
| "operations/QuantizedLSTM.cpp", | |
| "operations/RNN.cpp", | |
| "operations/Reshape.cpp", | |
| "operations/SVDF.cpp", | |
| "operations/SimpleMath.cpp", | |
| "operations/Split.cpp", | |
| "operations/Tile.cpp", | |
| ], | |
| shared_libs: [ | |
| "android.hardware.neuralnetworks@1.0", | |
| "android.hardware.neuralnetworks@1.1", | |
| "android.hardware.neuralnetworks@1.2", | |
| "android.hardware.neuralnetworks@1.3", | |
| "android.hidl.allocator@1.0", | |
| "android.hidl.memory@1.0", | |
| "libbase", | |
| "libcutils", | |
| "libfmq", | |
| "libhidlbase", | |
| "libhidlmemory", | |
| "liblog", | |
| "libutils", | |
| ], | |
| target: { | |
| android: { | |
| shared_libs: ["libnativewindow"], | |
| }, | |
| host: { | |
| cflags: [ | |
| "-D__ANDROID_API__=10000", | |
| "-D__INTRODUCED_IN(x)=", | |
| "-D__assert(a,b,c)=", | |
| ], | |
| }, | |
| }, | |
| header_libs: [ | |
| "gemmlowp_headers", | |
| "libeigen", | |
| "libneuralnetworks_headers", | |
| "libtextclassifier_hash_headers", | |
| "philox_random_headers", | |
| "tensorflow_headers", | |
| ], | |
| whole_static_libs: [ | |
| "libarect", | |
| "libtflite_kernel_utils", | |
| "neuralnetworks_types", | |
| "neuralnetworks_utils_hal_1_0", // TODO(b/160669116): Remove VNDK dependencies. | |
| "neuralnetworks_utils_hal_1_1", | |
| "neuralnetworks_utils_hal_1_2", | |
| "neuralnetworks_utils_hal_1_3", | |
| "neuralnetworks_utils_hal_common", | |
| "philox_random", | |
| ], | |
| static_libs: [ | |
| "libcrypto_static", | |
| "libruy_static", | |
| "libtextclassifier_hash_static", | |
| ], | |
| cflags: [ | |
| "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash", | |
| "-DNN_INCLUDE_CPU_IMPLEMENTATION", | |
| "-DTF_LITE_DISABLE_X86_NEON", | |
| ], | |
| } | |
| cc_library_static { | |
| name: "libneuralnetworks_common", | |
| defaults: [ | |
| "libneuralnetworks_common_defaults", | |
| ], | |
| } | |
| cc_library_static { | |
| name: "libneuralnetworks_common_experimental", | |
| defaults: [ | |
| "libneuralnetworks_common_defaults", | |
| ], | |
| exclude_static_libs: [ | |
| "neuralnetworks_types", | |
| ], | |
| static_libs: [ | |
| "neuralnetworks_types_experimental", | |
| ], | |
| cflags: [ | |
| "-DNN_EXPERIMENTAL_FEATURE", | |
| ], | |
| } | |
| cc_defaults { | |
| name: "neuralnetworks_cl_defaults", | |
| host_supported: false, | |
| vendor_available: false, | |
| stl: "libc++_static", | |
| sdk_version: "current", | |
| min_sdk_version: "29", | |
| cflags: [ | |
| "-DNN_COMPATIBILITY_LIBRARY_BUILD", | |
| ], | |
| } | |
| cc_defaults { | |
| name: "libneuralnetworks_common_cl_defaults", | |
| defaults: [ | |
| "neuralnetworks_cl_defaults", | |
| "neuralnetworks_defaults", | |
| "neuralnetworks_operations", | |
| ], | |
| host_supported: false, | |
| apex_available: [ | |
| "//apex_available:platform", | |
| "com.android.neuralnetworks", | |
| "test_com.android.neuralnetworks", | |
| ], | |
| // b/109953668, disable OpenMP | |
| // openmp: true, | |
| export_include_dirs: [ | |
| "include", | |
| ], | |
| srcs: [ | |
| "BufferTracker.cpp", | |
| "CpuExecutor.cpp", | |
| "GraphDump.cpp", | |
| "IndexedShapeWrapper.cpp", | |
| "LegacyUtils.cpp", | |
| "MetaModel.cpp", | |
| "OperationsUtils.cpp", | |
| "TokenHasher.cpp", | |
| ], | |
| header_libs: [ | |
| "libneuralnetworks_headers_ndk", | |
| ], | |
| static_libs: [ | |
| "libbase_ndk", | |
| "libcrypto_static", | |
| ], | |
| shared_libs: [ | |
| "libnativewindow", | |
| ], | |
| cflags: [ | |
| "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash", | |
| "-DTF_LITE_DISABLE_X86_NEON", | |
| ], | |
| } | |
| cc_library_static { | |
| name: "libneuralnetworks_common_cl", | |
| defaults: ["libneuralnetworks_common_cl_defaults"], | |
| } | |
| cc_library_static { | |
| name: "libneuralnetworks_common_cl_cpu", | |
| defaults: ["libneuralnetworks_common_cl_defaults"], | |
| sdk_version: "", // Override neuralnetworks_cl_defaults | |
| min_sdk_version: "", | |
| header_libs: [ | |
| "gemmlowp_headers", | |
| "libeigen", | |
| "libruy_headers", | |
| "libtextclassifier_hash_headers", | |
| "philox_random_headers", | |
| "tensorflow_headers", | |
| ], | |
| whole_static_libs: [ | |
| "libarect", | |
| "libtflite_kernel_utils", | |
| "neuralnetworks_types_cl", | |
| "philox_random", | |
| ], | |
| static_libs: [ | |
| "libcrypto_static", | |
| "libtextclassifier_hash_static", | |
| ], | |
| srcs: [ | |
| "ActivationFunctor.cpp", | |
| "QuantUtils.cpp", | |
| "operations/ArgMinMax.cpp", | |
| "operations/BidirectionalSequenceLSTM.cpp", | |
| "operations/Cast.cpp", | |
| "operations/EmbeddingLookup.cpp", | |
| "operations/ExpandDims.cpp", | |
| "operations/GroupedConv2D.cpp", | |
| "operations/HashtableLookup.cpp", | |
| "operations/LSHProjection.cpp", | |
| "operations/LSTM.cpp", | |
| "operations/MaximumMinimum.cpp", | |
| "operations/Multinomial.cpp", | |
| "operations/Pow.cpp", | |
| "operations/QuantizedLSTM.cpp", | |
| "operations/RNN.cpp", | |
| "operations/Reshape.cpp", | |
| "operations/SVDF.cpp", | |
| "operations/SimpleMath.cpp", | |
| "operations/Split.cpp", | |
| "operations/Tile.cpp", | |
| ], | |
| cflags: [ | |
| "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash", | |
| "-DNN_COMPATIBILITY_LIBRARY_BUILD", | |
| "-DNN_INCLUDE_CPU_IMPLEMENTATION", | |
| "-DTF_LITE_DISABLE_X86_NEON", | |
| ], | |
| } | |
| cc_defaults { | |
| name: "neuralnetworks_utils_defaults", | |
| defaults: ["neuralnetworks_defaults"], | |
| host_supported: true, | |
| vendor_available: true, | |
| apex_available: [ | |
| "//apex_available:platform", | |
| "com.android.neuralnetworks", | |
| "test_com.android.neuralnetworks", | |
| ], | |
| min_sdk_version: "30", | |
| target: { | |
| host: { | |
| cflags: [ | |
| "-D__ANDROID_API_S__=31", | |
| "-D__ANDROID_API__=10000", | |
| "-D__INTRODUCED_IN(x)=", | |
| "-D__assert(a,b,c)=", | |
| ], | |
| }, | |
| }, | |
| } | |
| cc_defaults { | |
| name: "neuralnetworks_types_defaults", | |
| defaults: ["neuralnetworks_utils_defaults"], | |
| srcs: [ | |
| "SharedMemory.cpp", | |
| "SharedMemoryAndroid.cpp", | |
| "TypeUtils.cpp", | |
| "Types.cpp", | |
| "Validation.cpp", | |
| ], | |
| target: { | |
| android: { | |
| shared_libs: [ | |
| "libnativewindow", | |
| ], | |
| static_libs: ["libarect"], | |
| }, | |
| }, | |
| local_include_dirs: ["include/nnapi"], | |
| export_include_dirs: ["include"], | |
| shared_libs: [ | |
| "libbase", | |
| "libcutils", | |
| "libutils", | |
| ], | |
| export_shared_lib_headers: [ | |
| "libbase", | |
| "libcutils", | |
| "libutils", | |
| ], | |
| } | |
| cc_library_static { | |
| name: "neuralnetworks_types", | |
| defaults: ["neuralnetworks_types_defaults"], | |
| } | |
| cc_library_static { | |
| name: "neuralnetworks_types_experimental", | |
| defaults: ["neuralnetworks_types_defaults"], | |
| cflags: ["-DNN_EXPERIMENTAL_FEATURE"], | |
| } | |
| cc_library_static { | |
| name: "neuralnetworks_types_cl", | |
| host_supported: false, | |
| defaults: [ | |
| "neuralnetworks_cl_defaults", | |
| "neuralnetworks_utils_defaults", | |
| ], | |
| srcs: [ | |
| "DynamicCLDeps.cpp", | |
| "SharedMemory.cpp", | |
| "SharedMemoryAndroid.cpp", | |
| "TypeUtils.cpp", | |
| "Types.cpp", | |
| "Validation.cpp", | |
| ], | |
| local_include_dirs: ["include/nnapi"], | |
| export_include_dirs: ["include"], | |
| static_libs: [ | |
| "libbase_ndk", | |
| ], | |
| export_static_lib_headers: [ | |
| "libbase_ndk", | |
| ], | |
| shared_libs: [ | |
| "libandroid", | |
| ], | |
| } | |
| cc_defaults { | |
| name: "NeuralNetworksTest_common", | |
| defaults: [ | |
| "neuralnetworks_float16", | |
| "neuralnetworks_use_latest_utils_hal_aidl", | |
| ], | |
| host_supported: true, | |
| shared_libs: [ | |
| "android.hidl.allocator@1.0", | |
| "android.hidl.memory@1.0", | |
| "libcutils", | |
| "libhidlbase", | |
| "libhidlmemory", | |
| "libneuralnetworks", | |
| "libneuralnetworks_packageinfo", | |
| "libutils", | |
| ], | |
| static_libs: [ | |
| "android.hardware.neuralnetworks@1.0", | |
| "android.hardware.neuralnetworks@1.1", | |
| "android.hardware.neuralnetworks@1.2", | |
| "android.hardware.neuralnetworks@1.3", | |
| "libbase", | |
| "libgmock", | |
| "liblog", | |
| "libneuralnetworks_common", | |
| ], | |
| target: { | |
| android: { | |
| shared_libs: [ | |
| "libnativewindow", | |
| ], | |
| }, | |
| host: { | |
| cflags: [ | |
| "-D__ANDROID_API_S__=31", | |
| "-D__ANDROID_API__=10000", | |
| "-D__INTRODUCED_IN(n)=", | |
| "-D__assert(a,b,c)=", | |
| ], | |
| }, | |
| }, | |
| local_include_dirs: ["include"], | |
| } | |
| cc_test { | |
| name: "NeuralNetworksTest_operations", | |
| defaults: ["NeuralNetworksTest_common"], | |
| srcs: [ | |
| "operations/*Test.cpp", | |
| ], | |
| header_libs: [ | |
| "gemmlowp_headers", | |
| "libeigen", | |
| "philox_random_headers", | |
| "tensorflow_headers", | |
| ], | |
| } | |
| cc_test { | |
| name: "NeuralNetworksTest_utils", | |
| defaults: ["NeuralNetworksTest_common"], | |
| srcs: [ | |
| "UtilsTest.cpp", | |
| ], | |
| header_libs: [ | |
| "gemmlowp_headers", | |
| "libeigen", | |
| "tensorflow_headers", | |
| ], | |
| test_suites: [ | |
| "general-tests", | |
| ], | |
| } | |
| cc_test { | |
| name: "NeuralNetworksTest_logtag", | |
| defaults: ["NeuralNetworksTest_common"], | |
| srcs: [ | |
| "LogTagTest.cpp", | |
| "LogTagTestExtra.cpp", | |
| ], | |
| } |