diff --git a/Applications/ApplicationsLib/CMakeLists.txt b/Applications/ApplicationsLib/CMakeLists.txt index 9da6fe882cc..0b1b31de32b 100644 --- a/Applications/ApplicationsLib/CMakeLists.txt +++ b/Applications/ApplicationsLib/CMakeLists.txt @@ -7,8 +7,11 @@ ogs_add_library(ApplicationsLib ${LIB_SOURCES}) target_link_libraries( ApplicationsLib - PUBLIC BaseLib GeoLib NumLib - $<$:VTK::ParallelMPI> + PUBLIC + BaseLib + GeoLib + NumLib + $<$,$>:VTK::ParallelMPI> PRIVATE CMakeInfoLib MathLib MeshLib diff --git a/Applications/CLI/CMakeLists.txt b/Applications/CLI/CMakeLists.txt index dcf2b6774b7..e522f9a6f81 100644 --- a/Applications/CLI/CMakeLists.txt +++ b/Applications/CLI/CMakeLists.txt @@ -52,17 +52,17 @@ ogs_add_executable(ogs ogs.cpp CommandLineArgumentParser.cpp) target_link_libraries( ogs - PRIVATE ApplicationsLib - BaseLib - CMakeInfoLib - GitInfoLib - MeshLib - ProcessLib - $<$:MPI::MPI_CXX> - $<$:InSituLib> - $<$:petsc> - $<$:VTK::ParallelMPI> - tclap + PRIVATE + ApplicationsLib + BaseLib + CMakeInfoLib + GitInfoLib + MeshLib + ProcessLib + $<$,$>:MPI::MPI_CXX> + $<$:InSituLib> + $<$:petsc> + tclap ) # ---- Tests ---- diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/CMakeLists.txt b/Applications/Utils/ModelPreparation/PartitionMesh/CMakeLists.txt index ad4aa95d9ad..67a4ebe663c 100644 --- a/Applications/Utils/ModelPreparation/PartitionMesh/CMakeLists.txt +++ b/Applications/Utils/ModelPreparation/PartitionMesh/CMakeLists.txt @@ -3,8 +3,14 @@ if(OGS_USE_MPI) binaryToPVTU BinaryToPVTU.cpp NodeWiseMeshPartitioner.cpp ) target_link_libraries( - binaryToPVTU GitInfoLib ProcessLib MeshLib MeshToolsLib tclap - $<$:MPI::MPI_CXX> VTK::ParallelMPI + binaryToPVTU + GitInfoLib + ProcessLib + MeshLib + MeshToolsLib + tclap + $<$,$>:MPI::MPI_CXX> + $<$,$>:VTK::ParallelMPI> ) install(TARGETS binaryToPVTU RUNTIME DESTINATION bin) endif() diff --git a/CMakePresets.json b/CMakePresets.json index e983c4b7cd1..f353743696d 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -215,6 +215,27 @@ "OGS_USE_MFRONT": "ON", "BUILD_SHARED_LIBS": "ON" } + }, + { + "name": "sanitizer", + "inherits": "debug-all", + "cacheVariables": { + "BUILD_SHARED_LIBS": "ON", + "OGS_CXX_FLAGS": "-O3;-fno-var-tracking", + "OGS_EIGEN_DYNAMIC_SHAPE_MATRICES": "OFF", + "ENABLE_ASAN": "ON", + "ENABLE_UBSAN": "ON", + "ENABLE_LSAN": "ON", + "OGS_BUILD_TFEL": "ON", + "OGS_BUILD_VTK": "ON", + "OGS_BUILD_HDF5": "ON" + }, + "environment": { + "CC": "clang", + "CXX": "clang++", + "UBSAN_OPTIONS": "print_stacktrace=1", + "LSAN_OPTIONS": "suppressions=${sourceDir}/scripts/test/leak_sanitizer.suppressions" + } } ], "buildPresets": [ @@ -314,6 +335,10 @@ { "name": "wheel", "configurePreset": "wheel" + }, + { + "name": "sanitizer", + "configurePreset": "sanitizer" } ], "testPresets": [ @@ -326,6 +351,9 @@ "filter": { "include": { "label": "default" + }, + "exclude": { + "name": "nb-" } }, "execution": { @@ -403,6 +431,13 @@ "inherits": [ "release" ] + }, + { + "name": "sanitizer", + "configurePreset": "sanitizer", + "inherits": [ + "release" + ] } ] } diff --git a/MeshLib/CMakeLists.txt b/MeshLib/CMakeLists.txt index 5bd9bae01e2..59f9c825567 100644 --- a/MeshLib/CMakeLists.txt +++ b/MeshLib/CMakeLists.txt @@ -34,18 +34,19 @@ ogs_add_library(MeshLib ${SOURCES}) target_link_libraries( MeshLib - PUBLIC BaseLib - GeoLib - GitInfoLib - ${HDF5_LIBRARIES} - MathLib - VTK::IOXML - VTK::IOLegacy - range-v3 - $<$:VTK::IOParallelXML> - $<$:VTK::ParallelMPI> - $<$:MPI::MPI_CXX> - $<$:petsc> + PUBLIC + BaseLib + GeoLib + GitInfoLib + ${HDF5_LIBRARIES} + MathLib + VTK::IOXML + VTK::IOLegacy + range-v3 + $<$,$>:VTK::IOParallelXML> + $<$,$>:VTK::ParallelMPI> + $<$,$>:MPI::MPI_CXX> + $<$:petsc> PRIVATE nlohmann_json::nlohmann_json ) @@ -54,7 +55,7 @@ target_include_directories(MeshLib PUBLIC ${HDF5_INCLUDE_DIRS}) target_compile_definitions( MeshLib PUBLIC - $<$,$>>:VTK_USE_64BIT_IDS> + $<$,$>>:VTK_USE_64BIT_IDS> ) target_precompile_headers( diff --git a/MeshToolsLib/CMakeLists.txt b/MeshToolsLib/CMakeLists.txt index dd60ad02704..98e8d6f83a5 100644 --- a/MeshToolsLib/CMakeLists.txt +++ b/MeshToolsLib/CMakeLists.txt @@ -9,16 +9,24 @@ append_source_files(SOURCES MeshQuality) ogs_add_library(MeshToolsLib ${SOURCES}) target_link_libraries( - MeshToolsLib PUBLIC GeoLib - MeshLib - range-v3 - VTK::IOXML - VTK::IOLegacy - $<$:VTK::IOParallelXML> - $<$:VTK::ParallelMPI> - PRIVATE BaseLib MathLib NumLib GitInfoLib + MeshToolsLib + PUBLIC + GeoLib + MeshLib + range-v3 + VTK::IOXML + VTK::IOLegacy + $<$,$>:VTK::IOParallelXML> + $<$,$>:VTK::ParallelMPI> + PRIVATE BaseLib MathLib NumLib GitInfoLib ) -target_precompile_headers(MeshToolsLib PRIVATE [["BaseLib/Error.h"]] - [["BaseLib/ConfigTree.h"]] [["BaseLib/Logging.h"]] [["MeshLib/Mesh.h"]] - [["MeshLib/Elements/Element.h"]]) +target_precompile_headers( + MeshToolsLib + PRIVATE + [["BaseLib/Error.h"]] + [["BaseLib/ConfigTree.h"]] + [["BaseLib/Logging.h"]] + [["MeshLib/Mesh.h"]] + [["MeshLib/Elements/Element.h"]] +) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index a07732faf08..cfa57f3705d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -85,40 +85,39 @@ endif() ogs_add_executable(testrunner ${TEST_SOURCES}) -target_sources(testrunner - PRIVATE - ProcessLib/Graph/TestGet.cpp - ProcessLib/Graph/TestApply.cpp +target_sources( + testrunner PRIVATE ProcessLib/Graph/TestGet.cpp + ProcessLib/Graph/TestApply.cpp ) target_link_libraries( testrunner - PRIVATE $<$>:ApplicationsLib> - ApplicationsFileIO - autocheck - gmock - gtest - MeshToolsLib - MeshGeoToolsLib - MaterialLib - MathLib - MeshLib - MeshToolsLib - NumLib - ParameterLib - $<$>:ProcessLib> - $<$>:Processes> - TestInfoLib - VTK::FiltersGeneral - VTK::FiltersSources - Boost::boost # TODO move OGSMFrontThermodynamicForcesView to - # MathLib? - $<$:LIE> - $<$:TH2M> - $<$:MPI::MPI_CXX> - $<$:SwmmInterface> - $<$:InSituLib> - $<$:petsc> + PRIVATE + $<$>:ApplicationsLib> + ApplicationsFileIO + autocheck + gmock + gtest + MeshToolsLib + MeshGeoToolsLib + MaterialLib + MathLib + MeshLib + MeshToolsLib + NumLib + ParameterLib + $<$>:ProcessLib> + $<$>:Processes> + TestInfoLib + VTK::FiltersGeneral + VTK::FiltersSources + Boost::boost # TODO move OGSMFrontThermodynamicForcesView to MathLib? + $<$:LIE> + $<$:TH2M> + $<$,$>:MPI::MPI_CXX> + $<$:SwmmInterface> + $<$:InSituLib> + $<$:petsc> PUBLIC $<$:OgsMFrontBehaviourForUnitTests> ) diff --git a/scripts/ci/jobs/build-docs.yml b/scripts/ci/jobs/build-docs.yml index eb47489eb9b..d4d811c64a0 100644 --- a/scripts/ci/jobs/build-docs.yml +++ b/scripts/ci/jobs/build-docs.yml @@ -1,7 +1,7 @@ build docs: stage: build needs: [meta] - tags: [shell, envinf23] + tags: [shell, envinf] timeout: 30 minutes variables: DOX_WARNINGS_THRESHOLD: 18 diff --git a/scripts/ci/jobs/build-linux-arch.yml b/scripts/ci/jobs/build-linux-arch.yml index 14eea177281..091f6cbea3e 100644 --- a/scripts/ci/jobs/build-linux-arch.yml +++ b/scripts/ci/jobs/build-linux-arch.yml @@ -2,7 +2,7 @@ build linux arch: extends: - .template-build-linux - .test-artifacts - tags: [shell, envinf23] + tags: [shell, envinf] needs: [meta] timeout: 3h variables: diff --git a/scripts/ci/jobs/build-linux.yml b/scripts/ci/jobs/build-linux.yml index b78a7394b6d..3ff235f9843 100644 --- a/scripts/ci/jobs/build-linux.yml +++ b/scripts/ci/jobs/build-linux.yml @@ -2,7 +2,7 @@ linux ctest large: extends: - .template-build-linux - .test-artifacts - tags: [shell, envinf23] + tags: [shell, envinf] needs: [meta] rules: - when: manual @@ -26,6 +26,7 @@ build linux (no unity): needs: [meta] timeout: 3h variables: + BUILD_PACKAGE: "false" BUILD_TESTS: "false" BUILD_CTEST: "false" CHECK_WARNINGS: "true" @@ -46,27 +47,14 @@ build linux debug with sanitizers: extends: - .template-build-linux - .test-artifacts - tags: [envinf23, shell] + tags: [envinf, shell] needs: [meta] variables: BUILD_PACKAGE: "false" - CMAKE_PRESET: debug + CMAKE_PRESET: sanitizer CMAKE_ARGS: >- - -DCMAKE_C_COMPILER=/usr/bin/clang - -DCMAKE_CXX_COMPILER=/usr/bin/clang++ - -DBUILD_SHARED_LIBS=ON - -DOGS_CXX_FLAGS=-O3;-fno-var-tracking - -DOGS_EIGEN_DYNAMIC_SHAPE_MATRICES=OFF - -DENABLE_ASAN=ON - -DENABLE_UBSAN=ON - -DENABLE_LSAN=ON - -DOGS_CTEST_MAX_RUNTIME=5 - -DOGS_USE_PIP=ON - -DOGS_USE_MFRONT=ON - -DOGS_BUILD_TFEL=ON - UBSAN_OPTIONS: "print_stacktrace=1" - LSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/scripts/test/leak_sanitizer.suppressions" - CTEST_TIMEOUT: 120 + -DOGS_CTEST_MAX_RUNTIME=60 + -DOGS_BUILD_PROCESSES=SteadyStateDiffusion build linux ubuntu perf: extends: diff --git a/scripts/ci/jobs/code-coverage.yml b/scripts/ci/jobs/code-coverage.yml index ddb52e16ed3..6e2a3a31d8a 100644 --- a/scripts/ci/jobs/code-coverage.yml +++ b/scripts/ci/jobs/code-coverage.yml @@ -1,6 +1,6 @@ code coverage: stage: check - tags: [shell, envinf23] + tags: [shell, envinf] needs: [meta] variables: CMAKE_PRESET: coverage diff --git a/scripts/ci/jobs/code-quality.yml b/scripts/ci/jobs/code-quality.yml index c3d3c3ced6d..98a444f8b2c 100644 --- a/scripts/ci/jobs/code-quality.yml +++ b/scripts/ci/jobs/code-quality.yml @@ -30,7 +30,6 @@ ruff: # Disabled, see !3053 .code_quality: stage: check - tags: [envinf1] needs: [] rules: variables: diff --git a/scripts/ci/jobs/package.yml b/scripts/ci/jobs/package.yml index bf48a8ef875..65164b49d8b 100644 --- a/scripts/ci/jobs/package.yml +++ b/scripts/ci/jobs/package.yml @@ -6,12 +6,7 @@ create cpm cache: - if: $CI_COMMIT_TITLE == "[versions] Updated cpm cache info." when: never - if: $CI_PIPELINE_SOURCE == "merge_request_event" - changes: - - scripts/cmake/CMakeSetup.cmake - - scripts/cmake/Dependencies.cmake - - scripts/ci/jobs/package.yml - - scripts/cmake/ExternalDependencies.cmake - - web/data/versions.json + when: manual variables: BUILD_DIR: "$CI_PROJECT_DIR/../build/cpm" allow_failure: diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index 23af87884e8..7a957fe0ebc 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -358,7 +358,7 @@ if((OGS_BUILD_TESTING OR OGS_BUILD_UTILS) AND NOT GUIX_BUILD) NAME xdmf VERSION 3.0.0 GIT_REPOSITORY https://gitlab.opengeosys.org/ogs/xdmflib.git - GIT_TAG 92a851f1acb87ad5367eb62f9b97785bedb700bb + GIT_TAG 374ee63abf605ab4c6639989bebc5096881f4f57 OPTIONS "XDMF_LIBNAME OgsXdmf" "CMAKE_MACOSX_RPATH ON" "HDF5_C_INCLUDE_DIR ${HDF5_INCLUDE_DIRS}" EXCLUDE_FROM_ALL YES SYSTEM TRUE diff --git a/scripts/cmake/DependenciesExternalProject.cmake b/scripts/cmake/DependenciesExternalProject.cmake index 688dd22d3b7..b59a2a75847 100644 --- a/scripts/cmake/DependenciesExternalProject.cmake +++ b/scripts/cmake/DependenciesExternalProject.cmake @@ -303,7 +303,6 @@ if("${ZLIB_INCLUDE_DIRS}" MATCHES "${build_dir_ZLIB}") endif() endif() if(OGS_USE_MPI) - set(HDF5_PREFER_PARALLEL ON) list(APPEND _hdf5_options "-DHDF5_ENABLE_PARALLEL=ON") endif() if(WIN32 OR HDF5_USE_STATIC_LIBRARIES) @@ -327,15 +326,18 @@ set(_hdf5_source GIT_REPOSITORY https://github.com/HDFGroup/hdf5.git GIT_TAG set(_hdf5_source_file ${OGS_EXTERNAL_DEPENDENCIES_CACHE}/hdf5-${ogs.tested_version.hdf5}.zip ) + +set(HDF5_PREFER_PARALLEL ON) + if(EXISTS ${_hdf5_source_file}) set(_hdf5_source URL ${_hdf5_source_file}) elseif(NOT OGS_BUILD_HDF5) - find_package(HDF5 ${ogs.minimum_version.hdf5}) + find_package(HDF5 ${ogs.minimum_version.hdf5} COMPONENTS C) endif() if(NOT _HDF5_FOUND AND NOT HDF5_FOUND) BuildExternalProject( HDF5 ${_hdf5_source} CMAKE_ARGS ${_hdf5_options} ${_defaultCMakeArgs} - ${_cmake_generator} + ${_cmake_generator} SKIP_FIND ) message( STATUS @@ -345,8 +347,28 @@ if(NOT _HDF5_FOUND AND NOT HDF5_FOUND) set(_HDF5_FOUND ON CACHE INTERNAL "") endif() if(_HDF5_FOUND) - # Somehow needs an extra run of ..._find_package() - BuildExternalProject_find_package(HDF5 REQUIRED) + # Use HDF-provided install method, see ext build directory / + # share/USING_HDF5_CMake.txt + if(HDF5_USE_STATIC_LIBRARIES) + set(_hdf5_LIB_TYPE STATIC) # or SHARED + else() + set(_hdf5_LIB_TYPE SHARED) # or SHARED + endif() + string(TOLOWER ${_hdf5_LIB_TYPE} _hdf5_SEARCH_TYPE) + set(HDF5_ROOT ${build_dir_HDF5}) + find_package( + HDF5 REQUIRED NAMES hdf5 + COMPONENTS C ${_hdf5_SEARCH_TYPE} NO_CMAKE_PATH + NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH + ) + set(HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR}) + set(HDF5_LIBRARIES ${HDF5_C_${_hdf5_LIB_TYPE}_LIBRARY}) + set(HDF5_C_LIBRARIES ${HDF5_LIBRARIES}) + if(WIN32) + set(HDF5_LIBRARIES ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES}) + endif() + message(STATUS "Using HDF5_LIBRARIES: ${HDF5_LIBRARIES}") endif() # VTK