aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-06-28 18:12:08 +0200
committerToni Uhlig <matzeton@googlemail.com>2020-06-28 18:12:08 +0200
commitaa695e6baef96797101d7b7090379e36b1279efd (patch)
tree62755226490311e9bf667c1bb257957b9c8e5f18
parente3ceff428598a688500fdec2ce7e9e82b0b08105 (diff)
using CMake function to clonse submodules required for cnc(master|proxy)
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--cmake/CMakeMillerFuncs.cmake14
-rw-r--r--cmake/CMakeMillerHostTools.cmake8
2 files changed, 22 insertions, 0 deletions
diff --git a/cmake/CMakeMillerFuncs.cmake b/cmake/CMakeMillerFuncs.cmake
index a919904..223819b 100644
--- a/cmake/CMakeMillerFuncs.cmake
+++ b/cmake/CMakeMillerFuncs.cmake
@@ -83,3 +83,17 @@ function(CompileCSource source result cflags defs incl libs quiet)
CHECK_C_SOURCE_COMPILES("${source}" ${result})
endfunction()
+function(CloneGitSubmodule path)
+ find_package(Git QUIET)
+ option(GIT_SUBMODULE "Clone git submodules during build" ON)
+ if(GIT_SUBMODULE)
+ message(STATUS "Git Submodule update: ${GIT_EXECUTABLE} submodule update --init --recursive -- ${path}")
+ execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- "${path}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ RESULT_VARIABLE GIT_SUBMOD_RESULT
+ ERROR_QUIET OUTPUT_QUIET)
+ if(NOT GIT_SUBMOD_RESULT EQUAL "0")
+ message(FATAL_ERROR "Git Submodule update failed with ${GIT_SUBMOD_RESULT}.")
+ endif()
+ endif()
+endfunction()
diff --git a/cmake/CMakeMillerHostTools.cmake b/cmake/CMakeMillerHostTools.cmake
index 8a06cb0..b5870ae 100644
--- a/cmake/CMakeMillerHostTools.cmake
+++ b/cmake/CMakeMillerHostTools.cmake
@@ -84,6 +84,14 @@ add_custom_target(strings
DEPENDS ${HOST_TOOLS_MKSTAMP} ${STRINGS_EXEC}
)
+if (BUILD_CNCMASTER)
+ CloneGitSubmodule(source/tools/host/go/cncmaster/deps/src/github.com/gorilla/mux)
+endif()
+if (BUILD_CNCPROXY)
+ CloneGitSubmodule(source/tools/host/go/cncproxy/deps/src/github.com/gorilla/mux)
+ CloneGitSubmodule(source/tools/host/go/cncproxy/deps/src/github.com/zhuangsirui/binpacker)
+endif()
+
if (BUILD_CNCPROXY)
add_custom_target(
cncproxy