mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-24 21:10:33 +05:00
Merge branch 'netgen_force_rebuild' into 'master'
Force rebuild of Netgen subproject when building the Superbuild CMake is using stamp files to check if the external projects are out of date. There is an option 'BUILD_ALWAYS 1' of ExternalProject_Add, but it is not available prior to CMake 3.1. To work around it, this commit solves two problems at once: - Add a new step 'check_submodules' between configure and build to check if all submodules are up to date. This step has the option 'ALWAYS 1', which means it is always considered outdated. - Since 'build' depends on the above step, it will always be started See merge request !30
This commit is contained in:
commit
c992c64401
@ -79,6 +79,7 @@ endif(NOT WIN32)
|
||||
if (USE_PYTHON)
|
||||
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h PATHS ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include NO_DEFAULT_PATH)
|
||||
if( NOT PYBIND_INCLUDE_DIR )
|
||||
# if the pybind submodule is missing, try to initialize and update all submodules
|
||||
execute_process(COMMAND git submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/pybind11/include)
|
||||
endif( NOT PYBIND_INCLUDE_DIR )
|
||||
@ -151,6 +152,23 @@ ExternalProject_Add (netgen
|
||||
STEP_TARGETS build
|
||||
)
|
||||
|
||||
# Check if the git submodules (i.e. pybind11) are up to date
|
||||
# in case, something is wrong, emit a warning but continue
|
||||
ExternalProject_Add_Step(netgen check_submodules
|
||||
COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/check_submodules.cmake
|
||||
DEPENDERS install # Steps on which this step depends
|
||||
)
|
||||
|
||||
# Due to 'ALWAYS 1', this step is always run which also forces a build of
|
||||
# the Netgen subproject
|
||||
ExternalProject_Add_Step(netgen check_submodules1
|
||||
COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/check_submodules.cmake
|
||||
DEPENDEES configure # Steps on which this step depends
|
||||
DEPENDERS build # Steps that depend on this step
|
||||
ALWAYS 1 # No stamp file, step always runs
|
||||
)
|
||||
|
||||
|
||||
install(CODE "execute_process(COMMAND cmake --build . --target install --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/netgen)")
|
||||
|
||||
add_custom_target(test_netgen
|
||||
|
13
cmake_modules/check_submodules.cmake
Normal file
13
cmake_modules/check_submodules.cmake
Normal file
@ -0,0 +1,13 @@
|
||||
execute_process(COMMAND git submodule status --recursive WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../" OUTPUT_VARIABLE git_status_output)
|
||||
string(REPLACE "\n" ";" git_status_output "${git_status_output}")
|
||||
foreach( a ${git_status_output})
|
||||
if(NOT ${a} MATCHES " [a-f,0-9]* external_dependencies[.]*")
|
||||
message(WARNING
|
||||
"*****************************************************************
|
||||
WARNING: The git submodules are out of sync! Please run
|
||||
git submodule update --init --recursive
|
||||
in your source directory
|
||||
*****************************************************************")
|
||||
endif()
|
||||
endforeach()
|
||||
|
Loading…
Reference in New Issue
Block a user