This commit introduces TensorFlow Lite 1.7 package to nncc build system.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
--- /dev/null
+# NOTE The followings SHOULD be defined before using this CMakeLists.txt
+#
+# 'TensorFlowSource_DIR' variable
+# 'eigen' target
+# 'gemmlowp' target
+# 'neon2sse' target
+# 'farmhash' target
+# 'flatbuffers' target
+#
+set(TensorFlowLiteSource_DIR ${TensorFlowSource_DIR}/tensorflow/contrib/lite)
+
+file(GLOB CORE_SRCS "${TensorFlowLiteSource_DIR}/*.c" "${TensorFlowLiteSource_DIR}/*.cc")
+file(GLOB CORE_TESTS "${TensorFlowLiteSource_DIR}/*test*.cc")
+list(REMOVE_ITEM CORE_SRCS ${CORE_TESTS})
+
+file(GLOB_RECURSE KERNEL_SRCS "${TensorFlowLiteSource_DIR}/kernels/*.cc")
+file(GLOB_RECURSE KERNEL_TESTS "${TensorFlowLiteSource_DIR}/kernels/*test*.cc")
+list(REMOVE_ITEM KERNEL_SRCS ${KERNEL_TESTS})
+# Exclude buggy kernel(s) from the build
+list(REMOVE_ITEM KERNEL_SRCS "${TensorFlowLiteSource_DIR}/kernels/internal/spectrogram.cc")
+
+list(APPEND SRCS ${CORE_SRCS})
+list(APPEND SRCS ${KERNEL_SRCS})
+
+include(CheckCXXCompilerFlag)
+
+CHECK_CXX_COMPILER_FLAG(-Wno-extern-c-compat COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING)
+
+add_library(tensorflowlite-1.7 ${SRCS})
+set_target_properties(tensorflowlite-1.7 PROPERTIES POSITION_INDEPENDENT_CODE ON)
+target_include_directories(tensorflowlite-1.7 PUBLIC ${TensorFlowSource_DIR})
+target_compile_options(tensorflowlite-1.7 PUBLIC -Wno-ignored-attributes)
+if(COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING)
+ target_compile_options(tensorflowlite-1.7 PUBLIC -Wno-extern-c-compat)
+endif(COMPILER_SUPPORT_EXTERN_C_COMPAT_WARNING)
+target_compile_definitions(tensorflowlite-1.7 PUBLIC "GEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK")
+target_link_libraries(tensorflowlite-1.7 eigen gemmlowp neon2sse farmhash flatbuffers dl)
--- /dev/null
+function(_TensorFlowLite_import)
+ nncc_find_package(TensorFlowSource EXACT 1.7 QUIET)
+
+ if(NOT TensorFlowSource_FOUND)
+ set(TensorFlowLite_FOUND FALSE PARENT_SCOPE)
+ return()
+ endif(NOT TensorFlowSource_FOUND)
+
+ nncc_find_package(FlatBuffers QUIET)
+
+ if(NOT FlatBuffers_FOUND)
+ set(TensorFlowLite_FOUND FALSE PARENT_SCOPE)
+ return()
+ endif(NOT FlatBuffers_FOUND)
+
+ nncc_find_package(Farmhash QUIET)
+
+ if(NOT Farmhash_FOUND)
+ set(TensorFlowLite_FOUND FALSE PARENT_SCOPE)
+ return()
+ endif(NOT Farmhash_FOUND)
+
+ nncc_find_package(Eigen QUIET)
+
+ if(NOT Eigen_FOUND)
+ set(TensorFlowLite_FOUND FALSE PARENT_SCOPE)
+ return()
+ endif(NOT Eigen_FOUND)
+
+ nncc_find_package(GEMMLowp QUIET)
+
+ if(NOT GEMMLowp_FOUND)
+ set(TensorFlowLite_FOUND FALSE PARENT_SCOPE)
+ return()
+ endif(NOT GEMMLowp_FOUND)
+
+ nncc_find_package(NEON2SSE QUIET)
+
+ if(NOT NEON2SSE_FOUND)
+ set(TensorFlowLite_FOUND FALSE PARENT_SCOPE)
+ return()
+ endif(NOT NEON2SSE_FOUND)
+
+ if(NOT TARGET tensorflowlite-1.7)
+ nncc_include(ExternalProjectTools)
+ add_extdirectory("${CMAKE_CURRENT_LIST_DIR}/Lite" tflite-1.7)
+ endif(NOT TARGET tensorflowlite-1.7)
+
+ set(TensorFlowLite_FOUND TRUE PARENT_SCOPE)
+endfunction(_TensorFlowLite_import)
+
+_TensorFlowLite_import()
--- /dev/null
+set(PACKAGE_VERSION "1.7")
+set(PACKAGE_VERSION_EXACT FALSE)
+set(PACKAGE_VERSION_COMPATIBLE FALSE)
+set(PACKAGE_VERSION_UNSUITABLE TRUE)
+
+if(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
+ set(PACKAGE_VERSION_EXACT TRUE)
+ set(PACKAGE_VERSION_UNSUITABLE FALSE)
+endif(PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
--- /dev/null
+# NOTE The general package will be enabled only when VERSION option is not specified.
+set(PACKAGE_VERSION "")
+set(PACKAGE_VERSION_EXACT FALSE)
+set(PACKAGE_VERSION_COMPATIBLE FALSE)
+set(PACKAGE_VERSION_UNSUITABLE TRUE)
+
+if (PACKAGE_FIND_VERSION STREQUAL "")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ set(PACKAGE_VERSION_UNSUITABLE FALSE)
+endif(PACKAGE_FIND_VERSION STREQUAL "")