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
15// Create a static version for apps to use.
16cc_library_static {
17    name: "libtflite_static",
18    host_supported: true,
19    vendor_available: true,
20    sdk_version: "current",
21    min_sdk_version: "30",
22    rtti: true,
23    srcs: [
24        "allocation.cc",
25        "arena_planner.cc",
26        "c/common.c",
27        "core/api/error_reporter.cc",
28        "core/api/flatbuffer_conversions.cc",
29        "core/api/op_resolver.cc",
30        "core/api/tensor_utils.cc",
31        "core/subgraph.cc",
32        "create_op_resolver_with_builtin_ops.cc",
33        "delegates/nnapi/nnapi_delegate.cc",
34        "delegates/nnapi/quant_lstm_sup.cc",
35        "experimental/resource/resource_variable.cc",
36        "external_cpu_backend_context.cc",
37        "graph_info.cc",
38        "interpreter.cc",
39        "interpreter_builder.cc",
40        "kernels/activations.cc",
41        "kernels/add.cc",
42        "kernels/add_n.cc",
43        "kernels/arg_min_max.cc",
44        "kernels/basic_rnn.cc",
45        "kernels/batch_matmul.cc",
46        "kernels/batch_to_space_nd.cc",
47        "kernels/bidirectional_sequence_lstm.cc",
48        "kernels/bidirectional_sequence_rnn.cc",
49        "kernels/broadcast_to.cc",
50        "kernels/call_once.cc",
51        "kernels/cast.cc",
52        "kernels/ceil.cc",
53        "kernels/comparisons.cc",
54        "kernels/complex_support.cc",
55        "kernels/concatenation.cc",
56        "kernels/conv.cc",
57        "kernels/conv3d.cc",
58        "kernels/cpu_backend_context.cc",
59        "kernels/cpu_backend_gemm_eigen.cc",
60        "kernels/cumsum.cc",
61        "kernels/densify.cc",
62        "kernels/depth_to_space.cc",
63        "kernels/depthwise_conv.cc",
64        "kernels/dequantize.cc",
65        "kernels/detection_postprocess.cc",
66        "kernels/div.cc",
67        "kernels/eigen_support.cc",
68        "kernels/elementwise.cc",
69        "kernels/embedding_lookup.cc",
70        "kernels/embedding_lookup_sparse.cc",
71        "kernels/exp.cc",
72        "kernels/expand_dims.cc",
73        "kernels/fake_quant.cc",
74        "kernels/fill.cc",
75        "kernels/floor.cc",
76        "kernels/floor_div.cc",
77        "kernels/floor_mod.cc",
78        "kernels/fully_connected.cc",
79        "kernels/gather.cc",
80        "kernels/gather_nd.cc",
81        "kernels/hashtable_lookup.cc",
82        "kernels/if.cc",
83        "kernels/internal/kernel_utils.cc",
84        "kernels/internal/optimized/cpu_check.cc",
85        "kernels/internal/optimized/neon_tensor_utils.cc",
86        "kernels/internal/optimized/sse_tensor_utils.cc",
87        "kernels/internal/quantization_util.cc",
88        "kernels/internal/reference/portable_tensor_utils.cc",
89        "kernels/internal/tensor_utils.cc",
90        "kernels/internal/transpose_utils.cc",
91        "kernels/kernel_util.cc",
92        "kernels/l2norm.cc",
93        "kernels/local_response_norm.cc",
94        "kernels/logical.cc",
95        "kernels/lsh_projection.cc",
96        "kernels/lstm.cc",
97        "kernels/lstm_eval.cc",
98        "kernels/matrix_diag.cc",
99        "kernels/matrix_set_diag.cc",
100        "kernels/maximum_minimum.cc",
101        "kernels/mirror_pad.cc",
102        "kernels/mul.cc",
103        "kernels/neg.cc",
104        "kernels/non_max_suppression.cc",
105        "kernels/numeric_verify.cc",
106        "kernels/one_hot.cc",
107        "kernels/pack.cc",
108        "kernels/pad.cc",
109        "kernels/pooling.cc",
110        "kernels/pow.cc",
111        "kernels/quantize.cc",
112        "kernels/random_uniform.cc",
113        "kernels/range.cc",
114        "kernels/rank.cc",
115        "kernels/reduce.cc",
116        "kernels/register.cc",
117        "kernels/register_ref.cc",
118        "kernels/reshape.cc",
119        "kernels/resize_bilinear.cc",
120        "kernels/resize_nearest_neighbor.cc",
121        "kernels/reverse.cc",
122        "kernels/reverse_sequence.cc",
123        "kernels/round.cc",
124        "kernels/scatter_nd.cc",
125        "kernels/segment_sum.cc",
126        "kernels/select.cc",
127        "kernels/shape.cc",
128        "kernels/skip_gram.cc",
129        "kernels/slice.cc",
130        "kernels/space_to_batch_nd.cc",
131        "kernels/space_to_depth.cc",
132        "kernels/sparse_to_dense.cc",
133        "kernels/split.cc",
134        "kernels/split_v.cc",
135        "kernels/squared_difference.cc",
136        "kernels/squeeze.cc",
137        "kernels/strided_slice.cc",
138        "kernels/sub.cc",
139        "kernels/svdf.cc",
140        "kernels/test_delegate_providers.cc",
141        "kernels/tile.cc",
142        "kernels/topk_v2.cc",
143        "kernels/transpose.cc",
144        "kernels/transpose_conv.cc",
145        "kernels/unidirectional_sequence_lstm.cc",
146        "kernels/unidirectional_sequence_rnn.cc",
147        "kernels/unique.cc",
148        "kernels/unpack.cc",
149        "kernels/where.cc",
150        "kernels/while.cc",
151        "kernels/zeros_like.cc",
152        "minimal_logging.cc",
153        "minimal_logging_android.cc",
154        "mmap_allocation.cc",
155        "model_builder.cc",
156        "mutable_op_resolver.cc",
157        "nnapi/nnapi_implementation.cc",
158        "nnapi/nnapi_util.cc",
159        "optional_debug_tools.cc",
160        "profiling/atrace_profiler.cc",
161        "profiling/platform_profiler.cc",
162        "schema/schema_conversion_utils.cc",
163        "schema/schema_utils.cc",
164        "simple_memory_arena.cc",
165        "stderr_reporter.cc",
166        "string_util.cc",
167        "tflite_with_xnnpack_optional.cc",
168        "tools/optimize/sparsity/format_converter.cc",
169        "tools/tool_params.cc",
170        "tools/versioning/op_version.cc",
171        "util.cc",
172    ],
173    header_libs: ["liblog_headers"],
174    generated_headers: ["libtflite_mutable_schema"],
175    include_dirs: [
176        "external/eigen",
177        "external/flatbuffers/include",
178        "external/gemmlowp",
179        "external/libtextclassifier/native/",
180        "external/tensorflow",
181    ],
182    whole_static_libs: [
183        "libruy_static",
184        "libtextclassifier_hash_static",
185    ],
186    cflags: [
187        "-DNAMESPACE_FOR_HASH_FUNCTIONS=farmhash",
188        "-DTF_LITE_DISABLE_X86_NEON",
189        "-Wall",
190        "-Werror",
191        "-Wextra",
192        "-Wno-array-bounds",
193        "-Wno-deprecated-declarations",
194        "-Wno-extern-c-compat",
195        "-Wno-invalid-partial-specialization",
196        "-Wno-invalid-partial-specialization",
197        "-Wno-mismatched-tags",
198        "-Wno-mismatched-tags",
199        "-Wno-missing-field-initializers",
200        "-Wno-sign-compare",
201        "-Wno-typedef-redefinition",
202        "-Wno-unused-function",
203        "-Wno-unused-lambda-capture",
204        "-Wno-unused-local-typedef",
205        "-Wno-unused-parameter",
206        "-Wno-unused-private-field",
207        "-Wno-unused-variable",
208        "-Wno-visibility",
209    ],
210    stl: "libc++_static",
211
212    apex_available: [
213        "//apex_available:platform",
214        "com.android.extservices",
215    ],
216}
217
218// Header library for CTS target
219cc_library_headers {
220    name: "libtflite_schema_headers",
221    generated_headers: [
222        "libtflite_mutable_schema",
223    ],
224    export_generated_headers: [
225        "libtflite_mutable_schema",
226    ],
227}
228