summaryrefslogtreecommitdiff
path: root/infra/nncc/cmake/modules/ThirdPartyTools.cmake
diff options
context:
space:
mode:
authorChunseok Lee <chunseok.lee@samsung.com>2020-03-05 15:10:09 +0900
committerChunseok Lee <chunseok.lee@samsung.com>2020-03-05 15:22:53 +0900
commitd91a039e0eda6fd70dcd22672b8ce1817c1ca50e (patch)
tree62668ec548cf31fadbbf4e99522999ad13434a25 /infra/nncc/cmake/modules/ThirdPartyTools.cmake
parentbd11b24234d7d43dfe05a81c520aa01ffad06e42 (diff)
downloadnnfw-d91a039e0eda6fd70dcd22672b8ce1817c1ca50e.tar.gz
nnfw-d91a039e0eda6fd70dcd22672b8ce1817c1ca50e.tar.bz2
nnfw-d91a039e0eda6fd70dcd22672b8ce1817c1ca50e.zip
catch up to tizen_5.5 and remove unness dir
- update to tizen_5.5 - remove dirs
Diffstat (limited to 'infra/nncc/cmake/modules/ThirdPartyTools.cmake')
-rw-r--r--infra/nncc/cmake/modules/ThirdPartyTools.cmake42
1 files changed, 42 insertions, 0 deletions
diff --git a/infra/nncc/cmake/modules/ThirdPartyTools.cmake b/infra/nncc/cmake/modules/ThirdPartyTools.cmake
new file mode 100644
index 000000000..8fbeacf6e
--- /dev/null
+++ b/infra/nncc/cmake/modules/ThirdPartyTools.cmake
@@ -0,0 +1,42 @@
+function(ThirdParty_URL VARNAME)
+ # PACKAGE (mandatory)
+ # VERSION (mandatory)
+ # ENV ... (optional, for backward compatibility)
+
+ include(CMakeParseArguments)
+
+ cmake_parse_arguments(ARG "" "PACKAGE;VERSION;ENV" "" ${ARGN})
+
+ if(NOT ARG_PACKAGE)
+ message(FATAL_ERROR "PACKAGE is missing")
+ endif(NOT ARG_PACKAGE)
+
+ if(NOT ARG_VERSION)
+ message(FATAL_ERROR "VERSION is missing")
+ endif(NOT ARG_VERSION)
+
+ set(PACKAGE_INFO_DIR "${NNCC_PROJECT_SOURCE_DIR}/infra/nncc/3rdparty/${ARG_PACKAGE}/${ARG_VERSION}")
+ set(PACKAGE_URL_FILE "${PACKAGE_INFO_DIR}/URL.default")
+ set(PACKAGE_URL_LOCAL_FILE "${PACKAGE_INFO_DIR}/URL.local")
+
+ if(NOT EXISTS "${PACKAGE_URL_FILE}")
+ message(FATAL_ERROR "URL file does not exist")
+ endif()
+
+ # Read URL from "[PACKAGE NAME]/[PACKAGE VERSION]/URL.default"
+ file(STRINGS "${PACKAGE_URL_FILE}" VALUE)
+
+ # Read URL from "[PACKAGE NAME]/[PACAKGE VERSION]/URL.local" (if it exists)
+ if(EXISTS "${PACKAGE_URL_LOCAL_FILE}")
+ file(STRINGS "${PACKAGE_URL_LOCAL_FILE}" VALUE)
+ endif()
+
+ # Read URL from process environment (if ENV option is specified)
+ if(ARG_ENV)
+ if(DEFINED ENV{${ARG_ENV}})
+ set(VALUE $ENV{${ARG_ENV}})
+ endif()
+ endif(ARG_ENV)
+
+ set("${VARNAME}" "${VALUE}" PARENT_SCOPE)
+endfunction(ThirdParty_URL)