[T/F Lite] Gather source files when adding a target (#561)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 9 Jul 2018 04:01:44 +0000 (13:01 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 9 Jul 2018 04:01:44 +0000 (13:01 +0900)
Currently, source files are gathered inside 'TensorFlowLiteConfig.cmake',
but the target is defined in 'TensorFlowLite/CMakeLists.txt'.

This commit moves source file gathering scripts to 'TensorFlowLite/CMakeLists.txt'
to make it easy to understand tensorflow lite target itself.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
cmake/packages/TensorFlowLite/CMakeLists.txt
cmake/packages/TensorFlowLiteConfig.cmake

index d636854..2f6cbc4 100644 (file)
@@ -1,3 +1,27 @@
+# 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})
+
 add_library(tensorflowlite ${SRCS})
 set_target_properties(tensorflowlite PROPERTIES POSITION_INDEPENDENT_CODE ON)
 target_include_directories(tensorflowlite PUBLIC ${TensorFlowSource_DIR})
index ef990cb..cb5e5e5 100644 (file)
@@ -41,21 +41,6 @@ function(_TensorFlowLite_import)
     return()
   endif(NOT NEON2SSE_FOUND)
 
-  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})
-
   if(NOT TARGET tensorflowlite)
     nncc_find_package(ExternalProjectTools REQUIRED)
     add_extdirectory("${CMAKE_CURRENT_LIST_DIR}/TensorFlowLite" tflite)