Add 'TensorFlowSource' as an external module (#155)
author박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh1302.park@samsung.com>
Thu, 26 Apr 2018 06:45:26 +0000 (15:45 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Thu, 26 Apr 2018 06:45:26 +0000 (15:45 +0900)
This commit adds 'TensorFlowSource' as an external module. Any
components in nncc are now able to download TensorFlowSource (if
DOWNLOAD_TENSORFLOW is set as true) and access it through
nncc_find_package macro.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
CMakeLists.txt
cmake/packages/TensorFlowSourceConfig.cmake [new file with mode: 0644]

index 29390c9..190987e 100644 (file)
@@ -13,6 +13,8 @@ endmacro(nncc_find_package)
 ###
 ### Configuration
 ###
+option(DOWNLOAD_TENSORFLOW "Download TensorFlow source" OFF)
+
 option(BUILD_GTEST "Download and build Google Test" ON)
 
 nncc_find_package(GTest QUIET)
diff --git a/cmake/packages/TensorFlowSourceConfig.cmake b/cmake/packages/TensorFlowSourceConfig.cmake
new file mode 100644 (file)
index 0000000..f08e23d
--- /dev/null
@@ -0,0 +1,18 @@
+function(_TensorFlowSource_import)
+  if(NOT DOWNLOAD_TENSORFLOW)
+    set(TensorFlowSource_FOUND FALSE PARENT_SCOPE)
+    return()
+  endif(NOT DOWNLOAD_TENSORFLOW)
+
+  nncc_find_package(ExternalSourceTools REQUIRED)
+  nncc_find_package(OptionTools REQUIRED)
+
+  envoption(TENSORFLOW_URL https://github.com/tensorflow/tensorflow/archive/v1.7.0.tar.gz)
+
+  ExternalSource_Download(TENSORFLOW ${TENSORFLOW_URL})
+
+  set(TensorFlowSource_DIR ${TENSORFLOW_SOURCE_DIR} PARENT_SCOPE)
+  set(TensorFlowSource_FOUND TRUE PARENT_SCOPE)
+endfunction(_TensorFlowSource_import)
+
+_TensorFlowSource_import()