Skip to content
Snippets Groups Projects
Commit cff73d7f authored by Tom Fischer's avatar Tom Fischer
Browse files

Merge branch 'cmake-presets' into 'master'

CMake presets

See merge request ogs/ogs!3428
parents bf1adccb 86440457
No related branches found
No related tags found
No related merge requests found
Showing
with 216 additions and 80 deletions
......@@ -22,3 +22,5 @@ CMakeLists.txt.user*
Tests/**/*.md5
Tests/Data/Parabolic/HT/InvalidProjectFiles/*.prj
web/.netlify
CMakeUserPresets.json
......@@ -38,6 +38,14 @@ endif()
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.16)
option(OGS_USE_UNITY_BUILDS "Enables Unity builds for faster compilation." ON)
endif()
option(OGS_USE_PYTHON "Interface with Python" ON)
option(OGS_USE_POETRY "Enables automatic Python virtual environment handling with poetry." ON)
if(WIN32)
option(OGS_BUILD_SWMM "Should the SWMM interface be built?" ON)
endif()
if(NOT WIN32 AND OGS_BUILD_SWMM)
message(FATAL_ERROR "OGS_BUILD_SWMM requires Windows!")
endif()
# Third-party libraries, names come from Conan package names
set(OGS_LIBS
......@@ -63,6 +71,7 @@ if(OGS_USE_PETSC)
set(OGS_USE_MPI ON CACHE BOOL "Use MPI" FORCE)
endif()
option(OGS_USE_CVODE "Use the Sundials CVODE module?" OFF)
option(OGS_BUILD_UTILS "Should the utilities programms be built?" ON)
# ---- CMake includes ----
include(GitSetup)
......@@ -93,15 +102,6 @@ if((CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) AND GPROF_PATH)
endif() # GCC AND GPROF_PATH
option(OGS_BUILD_GUI "Should the Data Explorer be built?" OFF)
option(OGS_BUILD_UTILS "Should the utilities programms be built?" OFF)
if(WIN32)
option(OGS_BUILD_SWMM "Should the SWMM interface be built?" OFF)
endif()
if(NOT WIN32 AND OGS_BUILD_SWMM)
message(FATAL_ERROR "OGS_BUILD_SWMM requires Windows!")
endif()
option(OGS_NO_EXTERNAL_LIBS "Builds OGS without any external dependencies." OFF)
option(OGS_INSITU "Builds OGS with insitu visualization capabilities." OFF)
option(OGS_USE_LIS "Use Lis" OFF)
......@@ -182,11 +182,6 @@ endif()
option(OGS_CHECK_HEADER_COMPILATION "Check header for standalone compilation."
OFF)
option(OGS_USE_PYTHON "Interface with Python" OFF)
if(OGS_USE_PYTHON AND NOT Python3_FOUND)
message(FATAL_ERROR "Python not found but required for OGS_USE_PYTHON=ON!")
endif()
option(OGS_USE_MFRONT
"Enable solid material models by MFront (https://tfel.sourceforge.net)"
OFF)
......
{
"version": 1,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"patch": 0
},
"configurePresets": [
{
"name": "_binary_dir",
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}"
},
{
"name": "_release",
"hidden": true,
"inherits": "_binary_dir",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "_debug",
"hidden": true,
"inherits": "_binary_dir",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "_ninja",
"hidden": true,
"generator": "Ninja"
},
{
"name": "_msvc",
"hidden": true,
"generator": "Visual Studio 16 2019"
},
{
"name": "_gui",
"hidden": true,
"cacheVariables": {
"OGS_BUILD_CLI": "OFF",
"OGS_BUILD_GUI": "ON",
"OGS_USE_NETCDF": "ON"
}
},
{
"name": "_petsc",
"hidden": true,
"cacheVariables": {
"OGS_USE_PYTHON": "OFF",
"BUILD_SHARED_LIBS": "ON",
"OGS_USE_CONAN": "OFF",
"OGS_USE_PETSC": "ON"
},
"environment": {
"CC": "mpicc",
"CXX": "mpic++"
}
},
{
"name": "release",
"inherits": [
"_ninja",
"_release"
]
},
{
"name": "debug",
"inherits": [
"_ninja",
"_debug"
]
},
{
"name": "release-gui",
"inherits": [
"release",
"_gui"
]
},
{
"name": "debug-gui",
"inherits": [
"debug",
"_gui"
]
},
{
"name": "release-petsc",
"inherits": [
"release",
"_petsc"
]
},
{
"name": "debug-petsc",
"inherits": [
"debug",
"_petsc"
]
},
{
"name": "msvc-release",
"inherits": [
"_msvc",
"_release"
]
},
{
"name": "msvc-debug",
"inherits": [
"_msvc",
"_debug"
]
},
{
"name": "msvc-release-gui",
"inherits": [
"msvc-release",
"_gui"
]
},
{
"name": "msvc-debug-gui",
"inherits": [
"msvc-debug",
"_gui"
]
},
{
"name": "_all",
"hidden": true,
"cacheVariables": {
"OGS_USE_MFRONT": "ON",
"OGS_USE_XDMF": "ON"
}
},
{
"name": "release-all",
"inherits": [
"release",
"_all"
]
},
{
"name": "debug-all",
"inherits": [
"debug",
"_all"
]
},
{
"name": "ci-simplest",
"inherits": "release",
"cacheVariables": {
"OGS_BUILD_UTILS": "OFF",
"OGS_USE_PYTHON": "OFF",
"OGS_USE_CONAN": "OFF",
"OGS_USE_POETRY": "OFF"
}
}
]
}
Subproject commit 6fc82f9e2954fc1a676e69425af8d78cb1cc1239
Subproject commit 35d81f1b2fa2470035eb578364e4b867dc41aa8e
......@@ -9,17 +9,12 @@
before_script:
- "echo \"For debugging run: docker run --rm -it -v $CI_BUILDS_DIR:/builds -w=$CI_PROJECT_DIR $CI_JOB_IMAGE\""
- mkdir -p $BUILD_DIR
- cd $BUILD_DIR
- ([ "${CONAN_USER_HOME}" == "${CI_PROJECT_DIR}/.conan" ]) && conan remove --system-reqs '*'
- ([[ $BUILD_CTEST_LARGE_ON_MASTER && "${CI_COMMIT_BRANCH}" == "master" && "${CMAKE_ARGS}" == *"USE_PYTHON=ON"* ]]) && export BUILD_CTEST_LARGE=true
script:
- "echo \"Running: cmake .. -G Ninja $CMAKE_ARGS -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DOGS_BUILD_PROCESSES=$BUILD_PROCESSES\""
- >
cmake .. -G Ninja
$CMAKE_ARGS
-DCMAKE_BUILD_TYPE=$BUILD_TYPE
-DOGS_BUILD_PROCESSES=$BUILD_PROCESSES
- cmake -S . --preset=$CMAKE_PRESET $CMAKE_ARGS -DOGS_BUILD_PROCESSES=$BUILD_PROCESSES
- build_dir=${BUILD_DIR:-build/$CMAKE_PRESET}
- cd $build_dir
- $BUILD_CMD_PREFIX cmake --build . --target package > >(tee make.output)
- if [ "$BUILD_TESTS" = true ] ; then $BUILD_CMD_PREFIX cmake --build . --target tests ; fi
- if [ "$BUILD_CTEST" = true ] ; then $BUILD_CMD_PREFIX cmake --build . --target ctest ; fi
......
......@@ -8,14 +8,13 @@
dependencies: [meta, meta_container]
variables:
script:
- mkdir -p $env:BUILD_DIR
- cd $env:BUILD_DIR
- $cmake_cmd = "cmake .. -G Ninja
- $build_directory = if ($env:BUILD_DIR) { $env:BUILD_DIR } else { "build/" + $env:CMAKE_PRESET }
- $cmake_cmd = "cmake -S . --preset=$env:CMAKE_PRESET
$env:CMAKE_ARGS
-DCMAKE_BUILD_TYPE=$env:BUILD_TYPE
-DOGS_BUILD_PROCESSES=$env:BUILD_PROCESSES"
- $cmake_cmd
- Invoke-Expression $cmake_cmd
- cd $build_directory
- cmake --build . --target package | Tee-Object -FilePath make.output
- if($env:BUILD_TESTS -eq "true") { cmake --build . --target tests }
- if($env:BUILD_CTEST -eq "true") { cmake --build . --target ctest }
......
.test-artifacts:
artifacts:
paths:
- $BUILD_DIR/Tests/ctest.xml
- $BUILD_DIR/Tests/testrunner.xml
- $BUILD_DIR/make.output
- $BUILD_DIR/*.zip
- $BUILD_DIR/*.tar.gz
- build/*/Tests/ctest.xml
- build/*/Tests/testrunner.xml
- build/*/make.output
- build/*/*.zip
- build/*/*.tar.gz
expire_in: 1 week
reports:
junit:
- $BUILD_DIR/Tests/testrunner.xml
- build/*/Tests/testrunner.xml
......@@ -10,11 +10,7 @@ build gui linux:
- when: manual
allow_failure: true
variables:
BUILD_DIR: "build-gui-linux"
CMAKE_PRESET: release-gui
CMAKE_ARGS: >-
-DOGS_USE_CONAN=OFF
-DOGS_BUILD_CLI=OFF
-DOGS_BUILD_GUI=ON
-DOGS_BUILD_UTILS=ON
-DOGS_USE_NETCDF=ON
-DOGS_INSTALL_DEPENDENCIES=ON
......@@ -9,11 +9,7 @@ build gui mac:
- when: manual
allow_failure: true
variables:
BUILD_DIR: "build-gui-mac"
CMAKE_PRESET: release-gui
CMAKE_ARGS: >-
-DOGS_USE_CONAN=auto
-DOGS_BUILD_CLI=OFF
-DOGS_BUILD_GUI=ON
-DOGS_BUILD_UTILS=ON
-DOGS_USE_NETCDF=OFF
-DOGS_INSTALL_DEPENDENCIES=ON
......@@ -8,14 +8,9 @@ build gui win:
- when: manual
allow_failure: true
variables:
BUILD_DIR: build-gui-win
CMAKE_PRESET: release-gui
CMAKE_ARGS: >-
-DOGS_$USE_PYTHON
-DOGS_BUILD_CLI=OFF
-DOGS_BUILD_GUI=ON
-DOGS_BUILD_UTILS=ON
-DOGS_BUILD_SWMM=ON
-DOGS_USE_NETCDF=ON
-DOGS_CI_TESTRUNNER_REPEAT=1
parallel:
matrix:
......
......@@ -4,10 +4,9 @@ build linux conan:
- .rules-master-manual
tags: [shell, envinf1-shell]
variables:
BUILD_DIR: build
CMAKE_PRESET: release
CMAKE_ARGS: >-
-DBUILD_SHARED_LIBS=ON
-DOGS_BUILD_UTILS=ON
-DOGS_USE_CONAN=AUTO
-DOGS_USE_MFRONT=ON
-DOGS_USE_XDMF=ON
......@@ -6,10 +6,8 @@ build linux frontend:
- frontend2
allow_failure: true
variables:
BUILD_DIR: "build"
CCACHE_DIR: "/data/ogs/.ccache"
CMAKE_ARGS: "-DOGS_USE_CONAN=OFF -DOGS_DISABLE_CCACHE=OFF -DOGS_CPU_ARCHITECTURE=generic"
CMAKE_PRESET: release
CMAKE_ARGS: "-DOGS_USE_CONAN=OFF -DOGS_USE_PYTHON=OFF -DOGS_CPU_ARCHITECTURE=generic"
before_script:
- source scripts/env/eve/cli.sh
- mkdir -p $BUILD_DIR
- cd $BUILD_DIR
......@@ -4,10 +4,5 @@ build linux petsc:
- envinf1-shell
timeout: 2h
variables:
BUILD_DIR: "build-petsc"
BUILD_CTEST_LARGE_ON_MASTER: "true"
CMAKE_ARGS: >-
-DBUILD_SHARED_LIBS=ON
-DOGS_BUILD_UTILS=ON
-DOGS_USE_CONAN=OFF
-DOGS_USE_PETSC=ON
CMAKE_PRESET: release-petsc
......@@ -4,10 +4,9 @@ build linux:
tags: [ docker ]
timeout: 2h
variables:
BUILD_DIR: "build"
BUILD_CTEST_LARGE_ON_MASTER: "true"
CMAKE_PRESET: release
CMAKE_ARGS: >-
-DOGS_BUILD_UTILS=ON
-DOGS_USE_CONAN=OFF
-DOGS_USE_MFRONT=ON
-DOGS_$USE_PYTHON
......@@ -24,16 +23,17 @@ build linux (no unity):
tags: [ docker ]
timeout: 1h
variables:
BUILD_DIR: "build-no-unity"
BUILD_DIR: "build/no-unity"
BUILD_TESTS: "false"
BUILD_CTEST: "false"
CMAKE_PRESET: release
CMAKE_ARGS: >-
-DOGS_BUILD_UTILS=ON
-DOGS_USE_PYTHON=OFF
-DOGS_USE_CONAN=OFF
-DOGS_USE_UNITY_BUILDS=OFF
-DOGS_USE_MFRONT=ON
-DOGS_USE_UNITY_BUILDS=OFF
-DOGS_USE_XDMF=ON
-DOGS_USE_PYTHON=ON
-B $BUILD_DIR
build linux (no deps, no procs):
image: $CONTAINER_GCC_IMAGE
......@@ -41,9 +41,7 @@ build linux (no deps, no procs):
tags: [ docker ]
timeout: 1h
variables:
BUILD_DIR: "build-no-unity"
BUILD_TESTS: "false"
BUILD_CTEST: "false"
BUILD_PROCESSES: "SteadyStateDiffusion"
CMAKE_ARGS: >-
-DOGS_USE_CONAN=OFF
CMAKE_PRESET: ci-simplest
......@@ -3,9 +3,9 @@ build mac:
tags:
- mac
variables:
BUILD_DIR: "build-mac"
BUILD_DIR: "build/mac-release"
CMAKE_PRESET: release
CMAKE_ARGS: >-
-DOGS_BUILD_UTILS=ON
-DOGS_USE_PYTHON=ON
-DOGS_INSTALL_DEPENDENCIES=ON
-DOGS_USE_XDMF=ON
-B $BUILD_DIR
......@@ -7,13 +7,14 @@ build win:
- when: manual
allow_failure: true
variables:
BUILD_DIR: build-win
BUILD_DIR: build/win-release
CMAKE_PRESET: release
CMAKE_ARGS: >-
-DOGS_BUILD_UTILS=ON
-DOGS_CI_TESTRUNNER_REPEAT=1
-DOGS_$USE_PYTHON
-DOGS_USE_CONAN=AUTO
-DOGS_USE_XDMF=ON
-B $BUILD_DIR
parallel:
matrix:
- USE_PYTHON: ["USE_PYTHON=ON", "USE_PYTHON=OFF"]
......@@ -6,7 +6,7 @@ check header:
dependencies: [meta, meta_container]
variables:
BUILD_DIR: "build-check-header"
CMAKE_ARGS: "-DOGS_CHECK_HEADER_COMPILATION=ON -DOGS_BUILD_UTILS=ON -DOGS_BUILD_GUI=ON -DOGS_USE_PYTHON=ON -DBUILD_SHARED_LIBS=ON"
CMAKE_ARGS: "-DOGS_CHECK_HEADER_COMPILATION=ON -DOGS_BUILD_GUI=ON -DBUILD_SHARED_LIBS=ON"
image: $CONTAINER_GCC_GUI_IMAGE
script:
- mkdir -p $BUILD_DIR
......
......@@ -10,10 +10,10 @@ compiler warnings:
- job: build mac
script:
- exit_code=0
- cd build-no-unity
- cd build/no-unity
- "if [[ $(cat make.output | grep warning -i) ]]; then printf 'There were GCC compiler warnings:\n\n'; cat make.output | grep warning -i; exit_code=1; fi"
- cd ../build-win
- cd ../win-release
- "if [[ $(cat make.output | grep ': warning' -i) ]]; then printf 'There were MSVC compiler warnings:\n\n'; cat make.output | grep ': warning' -i; exit_code=1; fi"
- cd ../build-mac
- cd ../mac-release
- "if [[ $(cat make.output | grep warning -i) ]]; then printf 'There were Clang (macOS) compiler warnings:\n\n'; cat make.output | grep warning -i; exit_code=1; fi"
- exit $exit_code
......@@ -5,7 +5,7 @@ clang sanitizer:
needs: ["pre commit"]
variables:
BUILD_DIR: "build-sanitizer"
CMAKE_ARGS: "-DOGS_ADDRESS_SANITIZER=ON -DOGS_UNDEFINED_BEHAVIOR_SANITIZER=ON -DOGS_BUILD_UTILS=ON"
CMAKE_ARGS: "-DOGS_ADDRESS_SANITIZER=ON -DOGS_UNDEFINED_BEHAVIOR_SANITIZER=ON"
UBSAN_OPTIONS: "print_stacktrace=1"
LSAN_OPTIONS: "suppressions=$CI_PROJECT_DIR/scripts/test/leak_sanitizer.suppressions"
image:
......
......@@ -8,6 +8,7 @@ cppcheck:
script:
- >
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DOGS_USE_CONAN=OFF
-DOGS_USE_PYTHON=OFF -DOGS_BUILD_UTILS=OFF
-DOGS_USE_UNITY_BUILDS=OFF -DOGS_USE_XDMF=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- bash cppcheck.sh
artifacts:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment