diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 0746ef28f8e31988ceed71e33e49f4da64937df2..1227056c8bdb4b5fac6de31d5cdc3b85384a7af1 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -1,5 +1,6 @@ install(FILES deplist.py dune-codegen_sourcepath.py DuneCodegenMacros.cmake + DuneSubmoduleChecker.cmake GeneratedSystemtest.cmake DESTINATION ${DUNE_INSTALL_MODULEDIR}) diff --git a/cmake/modules/DuneCodegenMacros.cmake b/cmake/modules/DuneCodegenMacros.cmake index 6823107087dbef0040b80d2637d9d604545dd3e7..0bc00246a0194b7dd4bd2c76af3139348bbb9889 100644 --- a/cmake/modules/DuneCodegenMacros.cmake +++ b/cmake/modules/DuneCodegenMacros.cmake @@ -160,3 +160,4 @@ function(add_generated_executable) endfunction() include(GeneratedSystemtests) +include(DuneSubmoduleChecker) diff --git a/cmake/modules/DuneSubmoduleChecker.cmake b/cmake/modules/DuneSubmoduleChecker.cmake new file mode 100644 index 0000000000000000000000000000000000000000..ad640dff5c4d6ae7e6c779aef6d6377e18bbecfd --- /dev/null +++ b/cmake/modules/DuneSubmoduleChecker.cmake @@ -0,0 +1,36 @@ +# A CMake module to check for the existence of submodules! +# +# .. cmake_function:: dune_check_submodule +# +# .. cmake_param:: PATH +# :required: +# +# The relative path to the submodule directory +# +# .. cmake_param:: INDICATOR +# :required: +# +# A filename (like setup.py) that indicates a correctly cloned submodule +# + + +function(dune_check_submodule) + # Parse Arguments + include(CMakeParseArguments) + cmake_parse_arguments(SUBMODULE "" "PATH;INDICATOR" "" ${ARGN}) + + if(SUBMODULE_UNPARSED_ARGUMENTS) + message(WARNING "Unparsed arguments in dune_check_submodule: This often indicates typos!") + endif() + + if(NOT SUBMODULE_PATH) + message(FATAL_ERROR "PATH argument not given to dune_check_submodule!") + endif() + if(NOT SUBMODULE_INDICATOR) + message(FATAL_ERROR "INDICATOR argument not given to dune_check_submodule!") + endif() + + if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${SUBMODULE_PATH}/${SUBMODULE_INDICATOR}) + message(FATAL_ERROR "No git submodule found at location ${CMAKE_CURRENT_SOURCE_DIR}/${SUBMODULE_PATH}. You should clone this repository with the --recursive flag! It is described in the README!") + endif() +endfunction() diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 4c7b4d72c8a0d0cb00b38d0a868b3024f9e29fe7..84ac56603f1c749cf8979d52d3d890ed9d2e0ee4 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,3 +1,10 @@ +# Check that the submodules have been checked out! +dune_check_submodule(PATH pytools INDICATOR setup.py) +dune_check_submodule(PATH cgen INDICATOR setup.py) +dune_check_submodule(PATH pymbolic INDICATOR setup.py) +dune_check_submodule(PATH loopy INDICATOR setup.py) +dune_check_submodule(PATH ufl INDICATOR setup.py) + # Install all the external packages that we have as submodules dune_python_install_package(PATH pytools) dune_python_install_package(PATH cgen)