1// Copyright (C) 2017 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package { 16 default_applicable_licenses: ["external_tensorflow_license"], 17} 18 19// Added automatically by a large-scale-change that took the approach of 20// 'apply every license found to every target'. While this makes sure we respect 21// every license restriction, it may not be entirely correct. 22// 23// e.g. GPL in an MIT project might only apply to the contrib/ directory. 24// 25// Please consider splitting the single license below into multiple licenses, 26// taking care not to lose any license_kind information, and overriding the 27// default license using the 'licenses: [...]' property on targets as needed. 28// 29// For unused files, consider creating a 'fileGroup' with "//visibility:private" 30// to attach the license to, and including a comment whether the files may be 31// used in the current project. 32// 33// large-scale-change included anything that looked like it might be a license 34// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. 35// 36// Please consider removing redundant or irrelevant files from 'license_text:'. 37// 38// large-scale-change filtered out the below license kinds as false-positives: 39// SPDX-license-identifier-CC-BY-SA 40// SPDX-license-identifier-MPL-2.0 41// See: http://go/android-license-faq 42license { 43 name: "external_tensorflow_license", 44 visibility: [":__subpackages__"], 45 license_kinds: [ 46 "SPDX-license-identifier-Apache-2.0", 47 "SPDX-license-identifier-BSD", 48 "SPDX-license-identifier-MIT", 49 "legacy_unencumbered", 50 ], 51 license_text: [ 52 "LICENSE", 53 "NOTICE", 54 ], 55} 56 57cc_library_headers { 58 name: "tensorflow_headers", 59 export_include_dirs: ["."], 60 vendor_available: true, 61 host_supported: true, 62 sdk_version: "current", 63 min_sdk_version: "apex_inherit", 64 apex_available: [ 65 "//apex_available:platform", 66 "com.android.extservices", 67 "com.android.neuralnetworks", 68 "com.android.adservices", 69 "com.android.ondevicepersonalization", 70 ], 71} 72 73genrule { 74 name: "libtflite_mutable_schema", 75 tools: ["flatc"], 76 cmd: "$(location flatc) --cpp --no-union-value-namespacing --gen-object-api --gen-mutable --keep-prefix -o $$(dirname $(out)) $(in)", 77 srcs: ["tensorflow/lite/schema/schema.fbs"], 78 out: ["tensorflow/lite/schema/mutable/schema_generated.h"], 79} 80 81subdirs = ["tensorflow/lite"] 82 83filegroup { 84 name: "tensorflow_tsl_logging_srcs", 85 srcs: [ 86 "tensorflow/tsl/platform/default/logging.cc", 87 "tensorflow/tsl/platform/default/env_time.cc", 88 ], 89} 90 91cc_library_static { 92 name: "TfliteNnapiDelegateTests_static", 93 srcs: [ 94 "tensorflow/lite/delegates/nnapi/nnapi_delegate_test.cc", 95 "tensorflow/lite/kernels/test_delegate_providers.cc", 96 "tensorflow/lite/kernels/test_util.cc", 97 "tensorflow/lite/kernels/acceleration_test_util.cc", 98 "tensorflow/lite/kernels/acceleration_test_util_internal.cc", 99 "tensorflow/lite/delegates/nnapi/acceleration_test_list.cc", 100 "tensorflow/lite/delegates/nnapi/acceleration_test_util.cc", 101 ], 102 include_dirs: [ 103 "external/flatbuffers/include", 104 "external/tensorflow", 105 "external/ruy", 106 ], 107 cflags: [ 108 "-DPLATFORM_POSIX_ANDROID", 109 "-Wextra", 110 "-Wno-extern-c-compat", 111 "-Wno-sign-compare", 112 "-Wno-unused-parameter", 113 "-Wno-unused-private-field", 114 ], 115 shared_libs: [ 116 "libandroid", 117 "liblog", 118 "libneuralnetworks", 119 ], 120 static_libs: [ 121 "libabsl", 122 "libgtest_ndk_c++", 123 "libgmock_ndk", 124 "libtflite_static", 125 ], 126 header_libs: [ 127 "libeigen", 128 "gemmlowp_headers", 129 "libtflite_schema_headers", 130 ], 131 sdk_version: "current", 132 stl: "c++_static", 133} 134 135cc_library_static { 136 name: "libtflite_flex_delegate", 137 srcs: [ 138 ":tflite_src", 139 ":tflite_flex_delegate", 140 ":tensorflow_c_srcs", 141 ":tensorflow_c_eager_srcs", 142 ":tensorflow_core_data_mobile_srcs_no_runtime", 143 ":tensorflow_core_kernels_mobile_srcs", 144 ":tensorflow_core_common_runtime_mobile_srcs_only_runtime", 145 ":tensorflow_core_framework_mobile_srcs_only_runtime", 146 ":tensorflow_core_framework_mobile_srcs_no_runtime", 147 ":tensorflow_core_graph_mobile_srcs_only_runtime", 148 ":tensorflow_core_util_mobile_srcs_no_runtime", 149 ":tensorflow_core_util_mobile_srcs_only_runtime", 150 ":tensorflow_core_platform_mobile_srcs_no_runtime", 151 ":tensorflow_core_platform_mobile_srcs_only_runtime", 152 ":tensorflow_core_profiler_mobile_srcs_no_runtime", 153 ":tensorflow_core_tfrt_fallback_op_kernel_runner", 154 ":tensorflow_tsl_platform_default_mobile_srcs_no_runtime", 155 ":tensorflow_tsl_platform_default_mobile_srcs_only_runtime", 156 ":tensorflow_core_lib_io_mobile_src_only_runtime", 157 ":tensorflow_core_lib_mobile_src_only_runtime", 158 ":tensorflow_core_lib_mobile_src_no_runtime", 159 "tensorflow/core/nccl/collective_communicator.cc", 160 "tensorflow/core/example/feature_util.cc", 161 "tensorflow/core/ops/no_op.cc", 162 "tensorflow/core/ops/array_ops.cc", 163 "tensorflow/core/ops/parsing_ops.cc", 164 "tensorflow/core/ops/dataset_ops.cc", 165 "tensorflow/core/ops/function_ops.cc", 166 "tensorflow/core/ops/io_ops.cc", 167 "tensorflow/core/ops/nn_ops.cc", 168 "tensorflow/core/ops/string_ops.cc", 169 "tensorflow/core/lib/wav/wav_io.cc", 170 "tensorflow/compiler/jit/defs.cc", 171 ], 172 export_include_dirs: ["."], 173 whole_static_libs: [ 174 "libabsl", 175 "libdoubleconversion", 176 "libfft2d", 177 "libruy_static", 178 "libtextclassifier_hash_static", 179 "tensorflow_core_proto_cpp_lite", 180 ], 181 header_libs: [ 182 "fp16_headers", 183 "jni_headers", 184 "liblog_headers", 185 ], 186 generated_headers: ["libtflite_mutable_schema"], 187 shared_libs: [ 188 "libz", 189 ], 190 include_dirs: [ 191 "external/FP16", 192 "external/eigen", 193 "external/flatbuffers/include", 194 "external/gemmlowp", 195 "external/libtextclassifier/native/", 196 "external/tensorflow", 197 "external/neon_2_sse", 198 ], 199 cflags: [ 200 "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash", 201 "-DTF_ANDROID_ENABLE_LOGSINK", 202 "-DPLATFORM_POSIX_ANDROID", 203 "-DENABLE_ABSL_IN_TENSORFLOW", 204 "-DIS_MOBILE_PLATFORM", 205 "-DTF_ANDROID_ENABLE_LOG_EVERY_N_SECONDS", 206 // Used to support int64, string type in //tensorflow/core/framework/register_types.h. 207 "-D__ANDROID_TYPES_FULL__", 208 // This code uses malloc_usable_size(), 209 // and thus can't be built with _FORTIFY_SOURCE=3. 210 "-U_FORTIFY_SOURCE", 211 "-D_FORTIFY_SOURCE=2", 212 "-Wno-defaulted-function-deleted", 213 "-Wno-deprecated-builtins", 214 "-Wno-deprecated-declarations", 215 "-Wno-expansion-to-defined", 216 "-Wno-ignored-qualifiers", 217 "-Wno-missing-field-initializers", 218 "-Wno-mismatched-tags", 219 "-Wno-unused-const-variable", 220 "-Wno-unused-but-set-variable", 221 "-Wno-unused-parameter", 222 "-Wno-user-defined-warnings", 223 "-Wno-gnu-inline-cpp-without-extern", 224 ], 225 cpp_std: "gnu++17", 226 stl: "libc++_static", 227 min_sdk_version: "33", 228 sdk_version: "current", 229 apex_available: ["com.android.ondevicepersonalization"], 230} 231 232cc_library_static { 233 name: "tflite_configuration_proto", 234 proto: { 235 type: "lite", 236 canonical_path_from_root: false, 237 export_proto_headers: true, 238 }, 239 stl: "libc++", 240 srcs: ["tensorflow/lite/experimental/acceleration/configuration/**/*.proto"], 241 sdk_version: "current", 242 min_sdk_version: "30", 243 apex_available: [ 244 "com.android.adservices", 245 "com.android.extservices", 246 ], 247} 248 249filegroup { 250 name: "tensorflow_core_protobuf_src", 251 srcs: [ 252 "tensorflow/core/protobuf/bfc_memory_map.proto", 253 "tensorflow/core/protobuf/config.proto", 254 "tensorflow/core/protobuf/coordination_config.proto", 255 "tensorflow/core/protobuf/coordination_service.proto", 256 "tensorflow/core/protobuf/cluster.proto", 257 "tensorflow/core/protobuf/debug.proto", 258 "tensorflow/core/protobuf/device_filters.proto", 259 "tensorflow/core/protobuf/device_properties.proto", 260 "tensorflow/core/protobuf/data_service.proto", 261 "tensorflow/core/protobuf/debug_event.proto", 262 "tensorflow/core/protobuf/eager_service.proto", 263 "tensorflow/core/protobuf/graph_debug_info.proto", 264 "tensorflow/core/protobuf/queue_runner.proto", 265 "tensorflow/core/protobuf/rewriter_config.proto", 266 "tensorflow/core/protobuf/tensor_bundle.proto", 267 "tensorflow/core/protobuf/saver.proto", 268 "tensorflow/core/protobuf/verifier_config.proto", 269 "tensorflow/core/protobuf/error_codes.proto", 270 "tensorflow/core/protobuf/composite_tensor_variant.proto", 271 "tensorflow/core/protobuf/master.proto", 272 "tensorflow/core/protobuf/meta_graph.proto", 273 "tensorflow/core/protobuf/named_tensor.proto", 274 "tensorflow/core/protobuf/remote_tensor_handle.proto", 275 "tensorflow/core/protobuf/saved_model.proto", 276 "tensorflow/core/protobuf/saved_object_graph.proto", 277 "tensorflow/core/protobuf/status.proto", 278 "tensorflow/core/protobuf/struct.proto", 279 "tensorflow/core/protobuf/worker.proto", 280 "tensorflow/core/protobuf/tensorflow_server.proto", 281 "tensorflow/core/protobuf/trackable_object_graph.proto", 282 "tensorflow/core/protobuf/transport_options.proto", 283 "tensorflow/core/grappler/costs/op_performance_data.proto", 284 "tensorflow/compiler/xla/pjrt/distributed/protocol.proto", 285 "tensorflow/compiler/xla/stream_executor/dnn.proto", 286 ], 287} 288 289cc_library_static { 290 name: "tensorflow_core_proto_cpp_lite", 291 proto: { 292 export_proto_headers: true, 293 canonical_path_from_root: false, 294 type: "lite", 295 include_dirs: ["external/protobuf/src"], 296 }, 297 srcs: [ 298 "tensorflow/core/framework/*.proto", 299 "tensorflow/core/example/example.proto", 300 "tensorflow/core/example/feature.proto", 301 "tensorflow/core/example/example_parser_configuration.proto", 302 "tensorflow/core/profiler/protobuf/xplane.proto", 303 "tensorflow/core/profiler/profiler_options.proto", 304 "tensorflow/core/util/saved_tensor_slice.proto", 305 "tensorflow/core/util/event.proto", 306 ":tensorflow_core_protobuf_src", 307 ":libprotobuf-internal-protos", 308 ], 309 shared_libs: [ 310 "liblog", 311 ], 312 static_libs: [ 313 "libprotobuf-cpp-lite-ndk", 314 ], 315 sdk_version: "current", 316 export_include_dirs: ["."], 317 stl: "libc++_static", 318 min_sdk_version: "33", 319 apex_available: ["com.android.ondevicepersonalization"], 320} 321 322java_library_static { 323 name: "tensorflow_core_proto_java_lite", 324 srcs: [ 325 "tensorflow/core/framework/*.proto", 326 "tensorflow/core/example/example.proto", 327 "tensorflow/core/example/feature.proto", 328 "tensorflow/core/example/example_parser_configuration.proto", 329 "tensorflow/core/profiler/protobuf/xplane.proto", 330 "tensorflow/core/profiler/profiler_options.proto", 331 "tensorflow/core/util/saved_tensor_slice.proto", 332 "tensorflow/core/util/event.proto", 333 ":tensorflow_core_protobuf_src", 334 ":libprotobuf-internal-protos", 335 ], 336 proto: { 337 canonical_path_from_root: false, 338 include_dirs: [ 339 "external/protobuf/src", 340 "external/protobuf/java", 341 ], 342 type: "lite", 343 }, 344 static_libs: ["libprotobuf-java-lite"], 345 sdk_version: "current", 346 min_sdk_version: "33", 347 apex_available: ["com.android.ondevicepersonalization"], 348} 349 350// Clients that want to link in custom ops/delegates need to manually link in the JNI bridge 351// to their own custom shared libraries. 352filegroup { 353 name: "tensorflowlite_jni_src", 354 srcs: ["tensorflow/lite/java/src/main/native/*.cc"], 355 visibility: [ 356 "//packages/modules/OnDevicePersonalization:__subpackages__", 357 ], 358} 359