Skip to content
Snippets Groups Projects
Commit d1599976 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Merge branch 'out-of-source' into 'master'

Change back to out-of-source builds

See merge request ogs/ogs!3466
parents 0c1d852e 0be9bcb7
No related branches found
No related tags found
No related merge requests found
Showing
with 33 additions and 27 deletions
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v3.4.0
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md, --markdown-linebreak-ext=pandoc]
......@@ -10,6 +10,7 @@ repos:
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
exclude: 'scripts/ci/*'
- id: check-toml
- repo: local
hooks:
......
......@@ -9,7 +9,7 @@
{
"name": "_binary_dir",
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}"
"binaryDir": "${sourceParentDir}/build/${presetName}"
},
{
"name": "_release",
......
......@@ -6,11 +6,14 @@
before_script:
- "echo \"For debugging run: docker run --rm -it -v $CI_BUILDS_DIR:/builds -w=$CI_PROJECT_DIR $CI_JOB_IMAGE\""
- build_dir=${BUILD_DIR:-../build/$CMAKE_PRESET}
- rm -rf $build_dir
- mkdir -p $build_dir
- ln -s ../build .
- ([ "${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:
- cmake -S . --preset=$CMAKE_PRESET $CMAKE_ARGS -DOGS_BUILD_PROCESSES=$BUILD_PROCESSES
- build_dir=${BUILD_DIR:-build/$CMAKE_PRESET}
- cd $build_dir
- |
if [[ -z "$TARGETS" ]]; then
......
......@@ -8,7 +8,11 @@
dependencies: [meta]
variables:
script:
- $build_directory = if ($env:BUILD_DIR) { $env:BUILD_DIR } else { "build/" + $env:CMAKE_PRESET }
- $build_directory = if ($env:BUILD_DIR) { $env:BUILD_DIR } else { "..\build\" + $env:CMAKE_PRESET }
- (rm -r -fo $build_directory)
- cmd /c if not exist $build_directory mkdir $build_directory
# Create symlink https://stackoverflow.com/a/34905638/80480
- cmd /c mklink /D build ..\build
- $cmake_cmd = "cmake -S . --preset=$env:CMAKE_PRESET
$env:CMAKE_ARGS
-DOGS_BUILD_PROCESSES=$env:BUILD_PROCESSES"
......
......@@ -12,4 +12,5 @@ build linux frontend:
CMAKE_PRESET: release
CMAKE_ARGS: "-DOGS_USE_CONAN=OFF -DOGS_USE_PYTHON=OFF -DOGS_CPU_ARCHITECTURE=generic"
before_script:
- !reference [.template-build-linux, before_script]
- source scripts/env/eve/cli.sh
......@@ -47,7 +47,7 @@ build linux (no unity):
needs: [meta, "pre commit"]
timeout: 1h
variables:
BUILD_DIR: "build/no-unity"
BUILD_DIR: "../build/no-unity"
BUILD_TESTS: "false"
BUILD_CTEST: "false"
CMAKE_PRESET: release
......
......@@ -6,7 +6,7 @@ build mac:
- .test-artifacts
needs: [meta]
variables:
BUILD_DIR: "build/mac-release"
BUILD_DIR: "../build/mac-release"
CMAKE_PRESET: release
CMAKE_ARGS: >-
-DOGS_INSTALL_DEPENDENCIES=ON
......
......@@ -7,7 +7,7 @@ build win:
- when: manual
allow_failure: true
variables:
BUILD_DIR: build/win-release
BUILD_DIR: ..\build\win-release
CMAKE_PRESET: release
CMAKE_ARGS: >-
-DOGS_CI_TESTRUNNER_REPEAT=1
......
......@@ -5,7 +5,7 @@ check header:
- .rules-master-manual
dependencies: [meta]
variables:
BUILD_DIR: "build-check-header"
BUILD_DIR: "../build/check-header"
CMAKE_ARGS: "-DOGS_CHECK_HEADER_COMPILATION=ON -DOGS_BUILD_GUI=ON -DBUILD_SHARED_LIBS=ON"
image: $CONTAINER_GCC_GUI_IMAGE
script:
......
......@@ -10,10 +10,7 @@ compiler warnings:
- job: build mac
script:
- exit_code=0
- 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 ../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 ../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"
- "if [[ $(cat build/no-unity/make.output | grep warning -i) ]]; then printf 'There were GCC compiler warnings:\n\n'; cat make.output | grep warning -i; exit_code=1; fi"
- "if [[ $(cat build/win-release/make.output | grep ': warning' -i) ]]; then printf 'There were MSVC compiler warnings:\n\n'; cat make.output | grep ': warning' -i; exit_code=1; fi"
- "if [[ $(cat build/mac-release/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
......@@ -4,7 +4,7 @@ clang sanitizer:
- .rules-manual
needs: ["pre commit"]
variables:
BUILD_DIR: "build-sanitizer"
BUILD_DIR: "../build/sanitizer"
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"
......
......@@ -4,7 +4,7 @@ clang tidy:
- .rules-manual
needs: ["pre commit"]
variables:
BUILD_DIR: "build-tidy"
BUILD_DIR: "../build/tidy"
CMAKE_ARGS: "-DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DCMAKE_CXX_CLANG_TIDY=clang-tidy-9"
image:
......
......@@ -11,10 +11,11 @@ code coverage:
CMAKE_PRESET: coverage
TARGETS: "testrunner_coverage ctest_coverage"
before_script:
# HACK to easier linking to the generated pages
- !reference [.template-build-linux, before_script]
# Shortcut to the generated pages:
- echo '<meta http-equiv="REFRESH" content="0;URL=build/coverage/coverage_report/index.html">' >> Coverage.html
after_script:
- cd build/coverage
- cd ../build/coverage
- poetry run fastcov -C testrunner_coverage.info ctest_coverage.info --lcov -o coverage.info
- poetry run fastcov -C testrunner_coverage.info ctest_coverage.info -o coverage.json
- genhtml --demangle-cpp -o coverage_report coverage.info
......
......@@ -16,10 +16,9 @@ Before compiling the developer has to choose a configuration of the software. OG
To separate source code from generated files such as compiled libraries, executables, test outputs and IDE projects we create build-directories. They can be placed arbitrarily. You can have as many build-directories as you like for e.g. different configurations but they will all use one source code directory. A typically directory structure:
- `ogs-source-code` (or simply `ogs`)
- `build/release`
- `build/debug`
- `build/release-petsc`
- `build` (can also be placed outside the source tree)
- `build` (should be placed outside the source directory)
- `release`
- `debug`
## Configure with CMake
......@@ -49,7 +48,7 @@ In the source directory run `cmake`:
cmake -S . --preset=release
```
This will create a build-directory in the source tree (`build/release`) with the default CMake options and the Release configuration.
This will create a build-directory outside the source tree (`../build/release`) with the default CMake options and the Release configuration.
Additionally you can pass any CMake variable or option with `-DVARIABLE_NAME=VALUE` (note the `-D` in front!) to the CMake command. You can also overwrite the generator with the `-G` parameter or the build-directory with the `-B` parameter (to see all available options just run `cmake --help`)
......@@ -128,9 +127,9 @@ If you cannot use CMake presets (e.g. when your CMake installation does not supp
```bash
# in ogs source-directory
mkdir -p build/release
cd build/release
cmake ../.. -G Ninja -DCMAKE_BUILD_TYPE=Release
mkdir -p ../build/release
cd ../build/release
cmake ../../ogs -G Ninja -DCMAKE_BUILD_TYPE=Release
```
## Option: Configure with a visual tool
......
......@@ -35,7 +35,7 @@ You can work normally in Visual Studio but remember that you have to make projec
To build with the `ninja` tool on the shell go to your previously configured build directory and type `ninja`:
```bash
cd build/release
cd ../build/release
ninja
```
</div>
......
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