diff --git a/build-config/meson.build b/build-config/meson.build new file mode 100644 index 0000000..cefc100 --- /dev/null +++ b/build-config/meson.build @@ -0,0 +1 @@ +subdir('mfem') \ No newline at end of file diff --git a/build-config/mfem/disable_mfem_selfcheck.patch b/build-config/mfem/disable_mfem_selfcheck.patch new file mode 100644 index 0000000..8e438c0 --- /dev/null +++ b/build-config/mfem/disable_mfem_selfcheck.patch @@ -0,0 +1,41 @@ +--- subprojects/mfem/CMakeLists.txt 2025-02-12 15:54:52.454728232 -0500 ++++ CMakeLists.txt.bak 2025-02-12 16:08:06.654542689 -0500 +@@ -765,7 +765,7 @@ + if (MFEM_ENABLE_EXAMPLES) + add_subdirectory(examples) #install examples if enabled + else() +- add_subdirectory(examples EXCLUDE_FROM_ALL) ++ # add_subdirectory(examples EXCLUDE_FROM_ALL) + endif() + + # Create a target for all miniapps and, optionally, enable it. +@@ -774,7 +774,7 @@ + if (MFEM_ENABLE_MINIAPPS) + add_subdirectory(miniapps) #install miniapps if enabled + else() +- add_subdirectory(miniapps EXCLUDE_FROM_ALL) ++ # add_subdirectory(miniapps EXCLUDE_FROM_ALL) + endif() + + # Target to build all executables, i.e. everything. +@@ -801,19 +801,7 @@ + add_dependencies(${MFEM_EXEC_PREREQUISITES_TARGET_NAME} copy_data) + endif() + +-# Add 'check' target - quick test +-set(MFEM_CHECK_TARGET_NAME ${MFEM_CUSTOM_TARGET_PREFIX}check) +-if (NOT MFEM_USE_MPI) +- add_custom_target(${MFEM_CHECK_TARGET_NAME} +- ${CMAKE_CTEST_COMMAND} -R \"^ex1_ser\" -C ${CMAKE_CFG_INTDIR} +- USES_TERMINAL) +- add_dependencies(${MFEM_CHECK_TARGET_NAME} ex1) +-else() +- add_custom_target(${MFEM_CHECK_TARGET_NAME} +- ${CMAKE_CTEST_COMMAND} -R \"^ex1p\" -C ${CMAKE_CFG_INTDIR} +- USES_TERMINAL) +- add_dependencies(${MFEM_CHECK_TARGET_NAME} ex1p) +-endif() ++message(STATUS "MFEM Miniapps and Examples disabled by patch!") + + #------------------------------------------------------------------------------- + # Documentation diff --git a/build-config/mfem/meson.build b/build-config/mfem/meson.build new file mode 100644 index 0000000..84f69c8 --- /dev/null +++ b/build-config/mfem/meson.build @@ -0,0 +1,24 @@ +cmake = import('cmake') +patchFile = files('disable_mfem_selfcheck.patch') + +patch_check = run_command('grep', '-q', 'MFEM_CHECK_TARGET_NAME', 'subprojects/mfem/CMakeLists.txt', check: false) +if patch_check.returncode() == 0 + message('Patching MFEM CMakeLists.txt to remove self checks') + run_command('patch', '-p4', '-d', '../../subprojects/mfem', '-i', patchFile[0].full_path(), check: true) +else + message('MFEM CMakeLists.txt already patched') +endif + +mfem_cmake_options = cmake.subproject_options() +mfem_cmake_options.add_cmake_defines({ + 'MFEM_ENABLE_EXAMPLES': 'OFF', + 'MFEM_ENABLE_TESTING': 'OFF', + 'MFEM_ENABLE_MINIAPPS': 'OFF', + 'MFEM_USE_BENCMARK': 'OFF', +}) + +mfem_sp = cmake.subproject( + 'mfem', + options: mfem_cmake_options) +mfem_dep = mfem_sp.dependency('mfem') +add_project_arguments('-I' + meson.current_build_dir() + '/subprojects/mfem/__CMake_build/config', language: 'cpp') \ No newline at end of file diff --git a/meson.build b/meson.build index 43145c8..fa228b5 100644 --- a/meson.build +++ b/meson.build @@ -3,7 +3,10 @@ project('4DSSE', 'cpp', version: '0.0.1a', default_options: ['cpp_std=c++23']) # Add default visibility for all C++ targets add_project_arguments('-fvisibility=default', language: 'cpp') +# Build external dependencies +subdir('build-config') +# Build the main project subdir('src') if get_option('build_tests') subdir('tests') diff --git a/subprojects/mfem.wrap b/subprojects/mfem.wrap new file mode 100644 index 0000000..43c167b --- /dev/null +++ b/subprojects/mfem.wrap @@ -0,0 +1,5 @@ +[wrap-git] +url = https://github.com/mfem/mfem.git +revision = master + +[cmake] \ No newline at end of file