Get fast_lio cmake execute the git submodule init
This commit is contained in:
+25
-2
@@ -1,14 +1,37 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index be3040b..4931c35 100644
|
||||
index be3040b..3176847 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -5,17 +5,16 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
@@ -5,17 +5,39 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
-ADD_COMPILE_OPTIONS(-std=c++14)
|
||||
-ADD_COMPILE_OPTIONS(-std=c++14)
|
||||
-set(CMAKE_CXX_FLAGS "-std=c++14 -O3")
|
||||
+# Ensure the bundled ikd-Tree submodule (include/ikd-Tree/ikd_Tree.cpp) is present.
|
||||
+# Auto-initialize it when building from a git checkout; otherwise fail with guidance.
|
||||
+if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/ikd-Tree/ikd_Tree.cpp")
|
||||
+ find_package(Git QUIET)
|
||||
+ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||
+ message(STATUS "fast_lio: initializing git submodule include/ikd-Tree")
|
||||
+ execute_process(
|
||||
+ COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
|
||||
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
+ RESULT_VARIABLE GIT_SUBMOD_RESULT)
|
||||
+ if(NOT GIT_SUBMOD_RESULT EQUAL "0")
|
||||
+ message(FATAL_ERROR
|
||||
+ "git submodule update --init failed with ${GIT_SUBMOD_RESULT}. "
|
||||
+ "Run it manually in ${CMAKE_CURRENT_SOURCE_DIR}.")
|
||||
+ endif()
|
||||
+ endif()
|
||||
+ if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/ikd-Tree/ikd_Tree.cpp")
|
||||
+ message(FATAL_ERROR
|
||||
+ "include/ikd-Tree/ikd_Tree.cpp is missing and could not be fetched automatically "
|
||||
+ "(no git checkout available). Run: git submodule update --init --recursive")
|
||||
+ endif()
|
||||
+endif()
|
||||
+
|
||||
+ADD_COMPILE_OPTIONS(-std=c++17)
|
||||
+set(CMAKE_CXX_FLAGS "-std=c++17 -O3")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user