File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,26 @@ set(OPENMC_DIR /opt/openmc)
1818set (OPENMC_INC_DIR ${OPENMC_DIR} /include)
1919set (OPENMC_LIB_DIR ${OPENMC_DIR} /lib)
2020
21+ # Ensure submodules are available and up to date
22+ find_package (Git QUIET )
23+ if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR } /.git" )
24+ # Update submodules as needed
25+ option (GIT_SUBMODULE "Check submodules during build" ON )
26+ if (GIT_SUBMODULE)
27+ message (STATUS "Submodule update" )
28+ execute_process (COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
29+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR }
30+ RESULT_VARIABLE GIT_SUBMOD_RESULT )
31+ if (NOT GIT_SUBMOD_RESULT EQUAL "0" )
32+ message (FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT} , please checkout submodules" )
33+ endif ()
34+ endif ()
35+ endif ()
36+
37+ if (NOT EXISTS "${PROJECT_SOURCE_DIR } /pybind11/CMakeLists.txt" )
38+ message (FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again." )
39+ endif ()
40+
2141# Build source_sampling
2242list (APPEND source_sampling_SOURCES
2343 ${SRC_DIR} /source_sampling.cpp
You can’t perform that action at this time.
0 commit comments