Add 'FarmhashSource' as an external module (#177)
author박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh1302.park@samsung.com>
Mon, 30 Apr 2018 07:44:24 +0000 (16:44 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 30 Apr 2018 07:44:24 +0000 (16:44 +0900)
This commit adds 'FarmhashSource' (which is necessary to build
tensorflow lite) as an external module that nncc_find_package can load.

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

index d202e35..3addb55 100644 (file)
@@ -14,6 +14,7 @@ endmacro(nncc_find_package)
 ### Configuration
 ###
 option(DOWNLOAD_EIGEN "Download Eigen source" OFF)
+option(DOWNLOAD_FARMHASH "Download farmhash source" OFF)
 option(DOWNLOAD_FLATBUFFERS "Download FlatBuffers source" OFF)
 option(DOWNLOAD_TENSORFLOW "Download TensorFlow source" OFF)
 
diff --git a/cmake/packages/FarmhashSourceConfig.cmake b/cmake/packages/FarmhashSourceConfig.cmake
new file mode 100644 (file)
index 0000000..4f5345b
--- /dev/null
@@ -0,0 +1,19 @@
+function(_FarmhashSource_import)
+  if(NOT DOWNLOAD_FARMHASH)
+    set(FarmhashSource_FOUND FALSE PARENT_SCOPE)
+    return()
+  endif(NOT DOWNLOAD_FARMHASH)
+
+  nncc_find_package(ExternalSourceTools REQUIRED)
+  nncc_find_package(OptionTools REQUIRED)
+
+  # NOTE TensorFlow 1.7 downloads farmhash from the following URL
+  envoption(FARMHASH_URL https://github.com/google/farmhash/archive/816a4ae622e964763ca0862d9dbd19324a1eaf45.tar.gz)
+
+  ExternalSource_Download(FARMHASH ${FARMHASH_URL})
+
+  set(FarmhashSource_DIR ${FARMHASH_SOURCE_DIR} PARENT_SCOPE)
+  set(FarmhashSource_FOUND TRUE PARENT_SCOPE)
+endfunction(_FarmhashSource_import)
+
+_FarmhashSource_import()