1package { 2 default_applicable_licenses: ["external_tflite-support_license"], 3} 4 5// Added automatically by a large-scale-change that took the approach of 6// 'apply every license found to every target'. While this makes sure we respect 7// every license restriction, it may not be entirely correct. 8// 9// e.g. GPL in an MIT project might only apply to the contrib/ directory. 10// 11// Please consider splitting the single license below into multiple licenses, 12// taking care not to lose any license_kind information, and overriding the 13// default license using the 'licenses: [...]' property on targets as needed. 14// 15// For unused files, consider creating a 'fileGroup' with "//visibility:private" 16// to attach the license to, and including a comment whether the files may be 17// used in the current project. 18// See: http://go/android-license-faq 19license { 20 name: "external_tflite-support_license", 21 visibility: [":__subpackages__"], 22 license_kinds: [ 23 "SPDX-license-identifier-Apache-2.0", 24 "SPDX-license-identifier-BSD", 25 "SPDX-license-identifier-MIT", 26 ], 27 license_text: [ 28 "LICENSE", 29 ], 30} 31 32cc_library_static { 33 name: "tflite_support", 34 sdk_version: "current", 35 min_sdk_version: "30", 36 stl: "libc++_static", 37 export_include_dirs: ["."], 38 srcs: [ 39 "tensorflow_lite_support/cc/utils/common_utils.cc", 40 "tensorflow_lite_support/custom_ops/kernel/sentencepiece/sentencepiece_tokenizer_tflite.cc", 41 "tensorflow_lite_support/custom_ops/kernel/sentencepiece/optimized_encoder.cc", 42 "tensorflow_lite_support/custom_ops/kernel/ragged/ragged_range_tflite.cc", 43 "tensorflow_lite_support/custom_ops/kernel/ragged/ragged_tensor_to_tensor_tflite.cc", 44 ], 45 cflags: [ 46 "-Werror", 47 "-Wall", 48 "-O2", 49 "-Wno-missing-field-initializers", 50 "-Wno-unused-parameter", 51 "-Wno-unused-variable", 52 ], 53 generated_headers: [ 54 "tflite_support_spm_config", 55 "tflite_support_spm_encoder_config" 56 ], 57 header_libs: [ 58 "tensorflow_headers", 59 "flatbuffer_headers", 60 ], 61 static_libs: [ 62 "libtextclassifier_abseil", 63 "libtflite_static", 64 ], 65 apex_available: [ 66 "//apex_available:platform", 67 "com.android.extservices", 68 ], 69 70 visibility: ["//external/libtextclassifier:__subpackages__"], 71} 72 73 74// ----------------- 75// Generate headers with FlatBuffer schema compiler. 76// ----------------- 77genrule_defaults { 78 name: "tflite_support_fbgen", 79 tools: ["flatc"], 80 // "depfile" is used here in conjunction with flatc's -M to gather the deps 81 cmd: "$(location flatc) --cpp --no-union-value-namespacing --gen-object-api --keep-prefix -I external/tflite-support -M $(in) >$(depfile) && " + 82 "$(location flatc) --cpp --no-union-value-namespacing --gen-object-api --keep-prefix -I external/tflite-support -o $$(dirname $(out)) $(in)", 83 depfile: true, 84} 85 86genrule { 87 name: "tflite_support_spm_config", 88 srcs: ["tensorflow_lite_support/custom_ops/kernel/sentencepiece/config.fbs"], 89 out: ["tensorflow_lite_support/custom_ops/kernel/sentencepiece/config_generated.h"], 90 defaults: ["tflite_support_fbgen"], 91} 92 93genrule { 94 name: "tflite_support_spm_encoder_config", 95 srcs: ["tensorflow_lite_support/custom_ops/kernel/sentencepiece/encoder_config.fbs"], 96 out: ["tensorflow_lite_support/custom_ops/kernel/sentencepiece/encoder_config_generated.h"], 97 defaults: ["tflite_support_fbgen"], 98} 99