From e3cfa2c0be90855c9b6b7afa1803fc7adc3f131f Mon Sep 17 00:00:00 2001 From: Terry Heo Date: Mon, 23 Nov 2020 18:28:12 -0800 Subject: [PATCH] cmake: Fix Android build error on missing MaybeCreateATraceProfiler() atrace_profiler.cc should be included in tflite library. This CL fixes Github issue #44916. PiperOrigin-RevId: 343968021 Change-Id: I1ae9715ef66e015254ec65701b8b630d0cf63f24 --- tensorflow/lite/CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt index 444cf2991cc..ae956a747dd 100644 --- a/tensorflow/lite/CMakeLists.txt +++ b/tensorflow/lite/CMakeLists.txt @@ -319,6 +319,12 @@ populate_tflite_source_vars("kernels/internal/reference/integer_ops" populate_tflite_source_vars("kernels/internal/reference/sparse_ops" TFLITE_KERNEL_INTERNAL_REF_SPARSE_OPS_SRCS ) +set(TFLITE_PROFILER_SRCS ${TFLITE_SOURCE_DIR}/profiling/platform_profiler.cc) +if(CMAKE_SYSTEM_NAME MATCHES "Android") + list(APPEND TFLITE_PROFILER_SRCS + ${TFLITE_SOURCE_DIR}/profiling/atrace_profiler.cc + ) +endif() # Common include directories set(TFLITE_INCLUDE_DIRS @@ -353,7 +359,7 @@ add_library(tensorflow-lite ${TFLITE_KERNEL_SRCS} ${TFLITE_NNAPI_SRCS} ${TFLITE_SRCS} - ${TFLITE_SOURCE_DIR}/profiling/platform_profiler.cc + ${TFLITE_PROFILER_SRCS} ${TFLITE_SOURCE_DIR}/schema/schema_utils.cc ${TFLITE_SOURCE_DIR}/tools/optimize/sparsity/format_converter.cc ) @@ -392,7 +398,6 @@ populate_source_vars("${TFLITE_SOURCE_DIR}/tools/benchmark" list(APPEND TFLITE_BENCHMARK_SRCS ${TF_SOURCE_DIR}/core/util/stats_calculator.cc ${TFLITE_SOURCE_DIR}/profiling/memory_info.cc - ${TFLITE_SOURCE_DIR}/profiling/platform_profiler.cc ${TFLITE_SOURCE_DIR}/profiling/profile_summarizer.cc ${TFLITE_SOURCE_DIR}/profiling/profile_summary_formatter.cc ${TFLITE_SOURCE_DIR}/profiling/time.cc @@ -424,9 +429,6 @@ else() endif() # TFLITE_ENABLE_XNNPACK if(CMAKE_SYSTEM_NAME MATCHES "Android") - list(APPEND TFLITE_BENCHMARK_SRCS - ${TFLITE_SOURCE_DIR}/profiling/atrace_profiler.cc - ) if(_TFLITE_ENABLE_NNAPI) list(APPEND TFLITE_BENCHMARK_SRCS ${TFLITE_SOURCE_DIR}/tools/delegates/nnapi_delegate_provider.cc