From fca233eed08f4ec3b793fe76abae540e391f8319 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Thu, 23 Sep 2021 12:16:53 +0100 Subject: IVGCVSW-6181 patch to allow building against tflite > v2.3 Change-Id: I292add699b2af32fab87b98929fe6fee79fdf356 Signed-off-by: Jim Flynn --- src/armnnTfLiteParser/CMakeLists.txt | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/armnnTfLiteParser/CMakeLists.txt') diff --git a/src/armnnTfLiteParser/CMakeLists.txt b/src/armnnTfLiteParser/CMakeLists.txt index 6a02c94b82..0988420dde 100755 --- a/src/armnnTfLiteParser/CMakeLists.txt +++ b/src/armnnTfLiteParser/CMakeLists.txt @@ -19,10 +19,30 @@ if(BUILD_TF_LITE_PARSER) target_include_directories(armnnTfLiteParser PRIVATE ../armnnUtils) target_include_directories(armnnTfLiteParser SYSTEM PRIVATE "${TF_LITE_SCHEMA_INCLUDE_PATH}") + + # using the armnn/delegate/cmake/Modules/FindTfLiteSrc.cmake to find the TfLite sources + # so that we can use the tensorflow/lite/version.h to determine which version of + # tensorflow lite we are compiling against + find_package(TfLiteSrc REQUIRED MODULE) + + # Various tflite header files are not warning clean + # We can't change compilation flags on header files directly, so we need to add them to an interface library first + add_library(tflite_version_headers INTERFACE) + target_include_directories(tflite_version_headers INTERFACE $ + $) + + target_compile_options(tflite_version_headers INTERFACE -Wno-conversion + -Wno-sign-conversion + -Wno-unused-parameter + -Wno-unused-function) + # If user has explicitly specified flatbuffers lib then use that, # otherwise search for it based on FLATBUFFERS_BUILD_DIR if (FLATBUFFERS_LIBRARY) - target_link_libraries(armnnTfLiteParser armnn ${FLATBUFFERS_LIBRARY}) + target_link_libraries(armnnTfLiteParser + armnn + tflite_version_headers + ${FLATBUFFERS_LIBRARY}) else() # Use PATH_SUFFIXES to help find separate libs for debug/release on Windows builds find_library(FLATBUFFERS_LIBRARY_DEBUG NAMES flatbuffers @@ -31,7 +51,11 @@ if(BUILD_TF_LITE_PARSER) find_library(FLATBUFFERS_LIBRARY_RELEASE NAMES flatbuffers HINTS ${FLATBUFFERS_BUILD_DIR} PATH_SUFFIXES "Release") - target_link_libraries(armnnTfLiteParser armnn debug ${FLATBUFFERS_LIBRARY_DEBUG} optimized ${FLATBUFFERS_LIBRARY_RELEASE}) + target_link_libraries(armnnTfLiteParser + armnn + tflite_version_headers + debug ${FLATBUFFERS_LIBRARY_DEBUG} + optimized ${FLATBUFFERS_LIBRARY_RELEASE}) endif() set_target_properties(armnnTfLiteParser PROPERTIES VERSION ${TFLITE_PARSER_LIB_VERSION} SOVERSION ${TFLITE_PARSER_LIB_SOVERSION} ) -- cgit v1.2.1