diff options
author | Jim Flynn <jim.flynn@arm.com> | 2021-09-23 12:16:53 +0100 |
---|---|---|
committer | KeithARM <keith.davis@arm.com> | 2021-09-23 15:21:28 +0000 |
commit | fca233eed08f4ec3b793fe76abae540e391f8319 (patch) | |
tree | 92c91e0fa06c58d72514ae39fc452b89b9b4b559 /delegate/cmake/Modules | |
parent | ce083d2ea1964411ce5d8f2ff05f6e0004978703 (diff) | |
download | armnn-fca233eed08f4ec3b793fe76abae540e391f8319.tar.gz |
IVGCVSW-6181 patch to allow building against tflite > v2.3
Change-Id: I292add699b2af32fab87b98929fe6fee79fdf356
Signed-off-by: Jim Flynn <jim.flynn@arm.com>
Diffstat (limited to 'delegate/cmake/Modules')
-rw-r--r-- | delegate/cmake/Modules/FindTfLite.cmake | 20 | ||||
-rw-r--r-- | delegate/cmake/Modules/FindTfLiteSrc.cmake | 28 |
2 files changed, 38 insertions, 10 deletions
diff --git a/delegate/cmake/Modules/FindTfLite.cmake b/delegate/cmake/Modules/FindTfLite.cmake index 7940e9cad7..907c3847cb 100644 --- a/delegate/cmake/Modules/FindTfLite.cmake +++ b/delegate/cmake/Modules/FindTfLite.cmake @@ -6,15 +6,19 @@ include(FindPackageHandleStandardArgs) unset(TFLITE_FOUND) +# +# NOTE: this module is used to find the tensorflow lite binary libraries only +# the FindTfLiteSrc.cmake module is used to find the tensorflow lite include directory. +# This is to allow components like the Tensorflow lite parser that have a source dependency +# on tensorflow lite headers but no need to link to the binary libraries to use only the sources +# and not have an artificial dependency on the libraries. +# + # First look for the static version of tensorflow lite find_library(TfLite_LIB NAMES "libtensorflow-lite.a" HINTS ${TFLITE_LIB_ROOT} ${TFLITE_LIB_ROOT}/tensorflow/lite) # If not found then, look for the dynamic library of tensorflow lite find_library(TfLite_LIB NAMES "libtensorflow_lite_all.so" "libtensorflowlite.so" HINTS ${TFLITE_LIB_ROOT} ${TFLITE_LIB_ROOT}/tensorflow/lite) -# Set relevant paths -find_path(TfLite_INCLUDE_DIR NAMES tensorflow/lite third_party HINTS ${TENSORFLOW_ROOT}) -find_path(TfLite_Schema_INCLUDE_PATH schema_generated.h HINTS ${TENSORFLOW_ROOT}/tensorflow/lite/schema) - # If the static library was found, gather all of its dependencies if (TfLite_LIB MATCHES .a$) message("-- Static tensorflow lite library found, using for ArmNN build") @@ -32,21 +36,17 @@ if (TfLite_LIB MATCHES .a$) PATH ${TFLITE_LIB_ROOT}/_deps/flatbuffers-build) ## Set TFLITE_FOUND if all libraries are satisfied for static lib - find_package_handle_standard_args(TfLite DEFAULT_MSG TfLite_INCLUDE_DIR TfLite_LIB TfLite_abseilstrings_LIB TfLite_ruy_LIB TfLite_fftsg_LIB TfLite_fftsg2d_LIB TfLite_farmhash_LIB TfLite_flatbuffers_LIB TfLite_Schema_INCLUDE_PATH) + find_package_handle_standard_args(TfLite DEFAULT_MSG TfLite_LIB TfLite_abseilstrings_LIB TfLite_ruy_LIB TfLite_fftsg_LIB TfLite_fftsg2d_LIB TfLite_farmhash_LIB TfLite_flatbuffers_LIB) # Set external variables for usage in CMakeLists.txt if (TFLITE_FOUND) set(TfLite_LIB ${TfLite_LIB} ${TfLite_abseilstrings_LIB} ${TfLite_ruy_LIB} ${TfLite_fftsg_LIB} ${TfLite_fftsg2d_LIB} ${TfLite_farmhash_LIB} ${TfLite_flatbuffers_LIB}) - set(TfLite_INCLUDE_DIR ${TfLite_INCLUDE_DIR}) - set(TfLite_Schema_INCLUDE_PATH ${TfLite_Schema_INCLUDE_PATH}) endif () elseif (TfLite_LIB MATCHES .so$) message("-- Dynamic tensorflow lite library found, using for ArmNN build") - find_package_handle_standard_args(TfLite DEFAULT_MSG TfLite_INCLUDE_DIR TfLite_LIB TfLite_Schema_INCLUDE_PATH) + find_package_handle_standard_args(TfLite DEFAULT_MSG TfLite_LIB) ## Set external variables for usage in CMakeLists.txt if (TFLITE_FOUND) set(TfLite_LIB ${TfLite_LIB}) - set(TfLite_INCLUDE_DIR ${TfLite_INCLUDE_DIR}) - set(TfLite_Schema_INCLUDE_PATH ${TfLite_Schema_INCLUDE_PATH}) endif () else() message(FATAL_ERROR "Could not find a tensorflow lite library to use") diff --git a/delegate/cmake/Modules/FindTfLiteSrc.cmake b/delegate/cmake/Modules/FindTfLiteSrc.cmake new file mode 100644 index 0000000000..91833c18e6 --- /dev/null +++ b/delegate/cmake/Modules/FindTfLiteSrc.cmake @@ -0,0 +1,28 @@ +# +# Copyright © 2021 Arm Ltd and Contributors. All rights reserved. +# SPDX-License-Identifier: MIT +# + +include(FindPackageHandleStandardArgs) +unset(TFLITE_SRC_FOUND) + +find_path(TfLite_INCLUDE_DIR + NAMES + tensorflow/lite + third_party + HINTS + ${TENSORFLOW_ROOT}) + +find_path(TfLite_Schema_INCLUDE_PATH + schema_generated.h + HINTS + ${TENSORFLOW_ROOT}/tensorflow/lite/schema) + +## Set TFLITE_FOUND +find_package_handle_standard_args(TfLiteSrc DEFAULT_MSG TfLite_INCLUDE_DIR TfLite_Schema_INCLUDE_PATH) + +## Set external variables for usage in CMakeLists.txt +if(TFLITE_SRC_FOUND) + set(TfLite_INCLUDE_DIR ${TfLite_INCLUDE_DIR}) + set(TfLite_Schema_INCLUDE_PATH ${TfLite_Schema_INCLUDE_PATH}) +endif() |