...
 
Commits (27)
......@@ -22,3 +22,5 @@ CMakeLists.txt.user*
Tests/**/*.md5
Tests/Data/Parabolic/HT/InvalidProjectFiles/*.prj
web/.netlify
CMakeUserPresets.json
......@@ -25,9 +25,10 @@ workflow:
when: never
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*workflow:paused.*/'
when: never
- if: $CI_MERGE_REQUEST_IID # merge requests
- if: $CI_COMMIT_TAG # tags, ogs/ogs repo only
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # master, ogs/ogs repo only
- if: $CI_MERGE_REQUEST_IID # merge requests
- if: $CI_COMMIT_TAG # tags, ogs/ogs repo only
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # master, ogs/ogs repo only
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/ # release branches, e.g. v6.x.x
include:
# extends
......
......@@ -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"
}
}
]
}
/** \mainpage OpenGeoSys ${OGS_VERSION} source code documentation
*
* \section intro_sec Introduction
* OpenGeoSys (OGS) is a scientific open source project for the development of
* numerical methods for the simulation of thermo-hydro-mechanical-chemical
* (THMC) processes in porous and fractured media. OGS is implemented in C++, it
* is object-oriented with an focus on the numerical solution of coupled multi-field
* problems (multi-physics). Parallel versions of OGS are available relying on
* both MPI and OpenMP concepts.
*
* This page only describes the source code itself. See the following links for additional information:
* Application areas of OGS are currently CO2
* sequestration, geothermal energy, water resources management, hydrology and
* waste deposition. OGS is comprised of the THMC-simulator (simply referred to as
* *OGS*) and a visualization tool (*Data Explorer*).
*
* OGS is developed by the OpenGeoSys Community.
*
* \section source_documentation Source code documentation
*
* You will find the Doxygen documentation for the development branch at
* https://doxygen.opengeosys.org.
*
* The documentation for OGS releases can be found here:
*
* - https://doxygen.opengeosys.org/v6.3.3
*
* \section useful_links Useful links
* - OGS home page: https://opengeosys.org/
* - Selected benchmarks: https://opengeosys.org/docs/benchmarks
* - Developer guide: https://opengeosys.org/docs/devguide
* - Data Explorer (Gui) manual: https://gitlab.opengeosys.org/ogs/data_explorer_manual/-/jobs/artifacts/master/raw/ogsde-man.pdf?job=build
* - Data Explorer (GUI) manual: https://gitlab.opengeosys.org/ogs/data_explorer_manual/-/jobs/artifacts/master/raw/ogsde-man.pdf?job=build
* - Discussion forum: https://discourse.opengeosys.org
*
*
......
......@@ -42,7 +42,6 @@ target_link_libraries(MathLib
${OpenMP_CXX_LIBRARIES}
$<$<TARGET_EXISTS:LAPACK::LAPACK>:LAPACK::LAPACK>
$<$<BOOL:${OGS_USE_LIS}>:${LIS_LIBRARIES}>
$<$<BOOL:${OGS_USE_MKL}>:${MKL_LIBRARIES}>
PRIVATE
spdlog::spdlog
)
......@@ -53,6 +52,9 @@ endif()
if(OGS_USE_CVODE)
target_link_libraries(MathLib PUBLIC ${CVODE_LIBRARIES})
endif()
if(OGS_USE_MKL)
target_link_libraries(MathLib PUBLIC ${MKL_LIBRARIES})
endif()
target_compile_definitions(MathLib
PUBLIC
......@@ -61,5 +63,5 @@ target_compile_definitions(MathLib
$<$<BOOL:${OGS_USE_EIGEN}>:OGS_USE_EIGEN>
$<$<BOOL:${CVODE_FOUND}>:CVODE_FOUND>
PRIVATE
$<$<BOOL:${USE_MKL}>:USE_MKL>
$<$<BOOL:${OGS_USE_MKL}>:USE_MKL>
)
......@@ -57,10 +57,15 @@ std::tuple<bool, double> IterationNumberBasedTimeStepping::next(
{
_iter_times = number_iterations;
if (_previous_time_step_accepted)
{
_ts_prev = _ts_current;
}
// confirm current time and move to the next if accepted
if (accepted())
{
_ts_prev = _ts_current;
_previous_time_step_accepted = true;
return std::make_tuple(true, getNextTimeStepSize());
}
else
......@@ -83,6 +88,9 @@ std::tuple<bool, double> IterationNumberBasedTimeStepping::next(
_ts_prev = // essentially equal to _ts_prev.dt = _ts_current.dt.
TimeStep{_ts_prev.previous(), _ts_prev.previous() + dt,
_ts_prev.steps()};
_previous_time_step_accepted = false;
return std::make_tuple(false, dt);
}
return {};
......
......@@ -102,7 +102,7 @@ public:
bool canReduceTimestepSize() const override;
/// Return the number of repeated steps.
/// Return the number of the total repeated steps.
int getNumberOfRepeatedSteps() const { return _n_rejected_steps; }
private:
......@@ -127,9 +127,11 @@ private:
const int _max_iter;
/// The number of nonlinear iterations.
int _iter_times = 0;
/// The number of rejected steps.
/// The number of total rejected steps.
int _n_rejected_steps = 0;
/// True, if the timestep is accepted.
bool _previous_time_step_accepted = true;
/// True, if the current time step is accepted.
bool _accepted = true;
};
......
......@@ -52,22 +52,20 @@ struct SecondaryVariableFunctions final
static_assert(
std::is_same<
GlobalVector const&,
typename std::result_of<F1(
double const, std::vector<GlobalVector*> const&,
std::vector<NumLib::LocalToGlobalIndexMap const*> const&
dof_table,
std::unique_ptr<GlobalVector>&)>::type>::value,
typename std::invoke_result<
F1, double const, std::vector<GlobalVector*> const&,
std::vector<NumLib::LocalToGlobalIndexMap const*> const&,
std::unique_ptr<GlobalVector>&>::type>::value,
"The function eval_field_ does not return a const reference"
" to a GlobalVector");
static_assert(
std::is_same<
GlobalVector const&,
typename std::result_of<F2(
double const, std::vector<GlobalVector*> const& x,
std::vector<NumLib::LocalToGlobalIndexMap const*> const&
dof_table,
std::unique_ptr<GlobalVector>&)>::type>::value,
typename std::invoke_result<
F2, double const, std::vector<GlobalVector*> const&,
std::vector<NumLib::LocalToGlobalIndexMap const*> const&,
std::unique_ptr<GlobalVector>&>::type>::value,
"The function eval_residuals_ does not return a const reference"
" to a GlobalVector");
}
......@@ -82,11 +80,10 @@ struct SecondaryVariableFunctions final
static_assert(
std::is_same<
GlobalVector const&,
typename std::result_of<F1(
double const, std::vector<GlobalVector*> const& x,
std::vector<NumLib::LocalToGlobalIndexMap const*> const&
dof_table,
std::unique_ptr<GlobalVector>&)>::type>::value,
typename std::invoke_result<
F1, double const, std::vector<GlobalVector*> const&,
std::vector<NumLib::LocalToGlobalIndexMap const*> const&,
std::unique_ptr<GlobalVector>&>::type>::value,
"The function eval_field_ does not return a const reference"
" to a GlobalVector");
}
......
......@@ -640,9 +640,15 @@ bool TimeLoop::loop()
solveUncoupledEquationSystems(t, dt, timesteps);
}
postTimestepForAllProcesses(t, dt, _per_process_data,
_process_solutions,
_process_solutions_prev);
// Run post time step only if the last iteration was successful.
// Otherwise it runs the risks to get the same errors as in the last
// iteration, an exception thrown in assembly, for example.
if (nonlinear_solver_status.error_norms_met)
{
postTimestepForAllProcesses(t, dt, _per_process_data,
_process_solutions,
_process_solutions_prev);
}
INFO("[time] Time step #{:d} took {:g} s.", timesteps,
time_timestep.elapsed());
......
......@@ -19,7 +19,7 @@ waste deposition. OGS is comprised of the THMC-simulator (simply referred to as
- Good starting point for users as well as for developers is the [documentation][documentation]
- Check your code against our [styleguide](http://ufz.github.io/styleguide/cppguide.xml)
- Have a look at the [source code documentation][docs]
- Have a look at the [source code documentation for the current master-branch build][docs-master] or [for the latest release][docs-release]
## License ##
......@@ -28,5 +28,6 @@ OpenGeoSys is distributed under the Modified BSD License. See the
[ogs]: https://www.opengeosys.org
[documentation]: https://www.opengeosys.org/docs/
[docs]: https://doxygen.opengeosys.org
[docs-master]: https://doxygen.opengeosys.org/
[docs-release]: https://doxygen.opengeosys.org/v6.3.3
[license-source]: https://github.com/ufz/ogs/blob/master/LICENSE.txt
Subproject commit 1c4a2e4664b296e24b33253767242f8df247c1d3
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
build docs:
stage: build
tags: [ docker ]
image:
name: $CONTAINER_GCC_IMAGE
dependencies: [meta, meta_container]
tags: [shell, envinf]
dependencies: [meta]
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
ON_MASTER: "true"
DEPLOY: "true"
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/
variables:
DEPLOY: "true"
- when: always
retry:
max: 2
when: runner_system_failure
......@@ -15,6 +22,17 @@ build docs:
script:
- cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DOGS_USE_CONAN=OFF -DOGS_BUILD_PROCESSES=GroundwaterFlow
- cmake --build . --target doc > >(tee make-docs.output)
# ${CI_COMMIT_BRANCH//./-} replaces dots with hyphens
- |
if [ "$DEPLOY" == "true" ]; then
if [ "$ON_MASTER" == "true" ]; then
cp ../scripts/doc/_redirects docs
netlify deploy --prod --dir=docs --site=$DOXYGEN_NETLIFY_SITE_ID
else
netlify link --name ogs-doxygen-${CI_COMMIT_BRANCH//./-}
netlify deploy --prod --dir=docs
fi
fi
artifacts:
expose_as: 'Doxygen'
paths:
......@@ -37,15 +55,3 @@ check docs links:
--white-listed-urls http://www.opengeosys.org/project/license,http://www.opengeosys.org,http://www.opengeosys.org\&quot,http://www.trolltech.com/products/qt/licensing.html,http://www.trolltech.com/products/qt/opensource.html
--white-listed-files project_file_doc_qa.html,ogs_file_
docs
deploy doxygen:
stage: package
tags: [ docker ]
image: $WEB_IMAGE
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
dependencies: [meta_container, "build docs"]
variables:
GIT_STRATEGY: none
script:
- netlify deploy --prod --dir=build/docs --site=$DOXYGEN_NETLIFY_SITE_ID
......@@ -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
......@@ -2,19 +2,15 @@ build gui win:
extends: .template-build-win
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/
- changes:
- Applications/DataExplorer/**/*
- 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
......@@ -3,16 +3,18 @@ build win:
rules:
- if: '$USE_PYTHON =~ /ON$/'
- if: '$CI_COMMIT_BRANCH == "master"'
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/
- 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"]
build container images:
stage: preparation
rules:
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/
when: never
- if: '$CI_PROJECT_NAMESPACE == "bilke" || $CI_PROJECT_NAMESPACE == "ogs"'
changes:
- ThirdParty/container-maker
......@@ -24,6 +26,8 @@ build container images:
build xunit-to-junit image:
stage: .pre
rules:
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/
when: never
- if: '$CI_PROJECT_NAMESPACE == "bilke" || $CI_PROJECT_NAMESPACE == "ogs"'
changes:
- scripts/docker/saxon/**/*
......@@ -39,6 +43,8 @@ build xunit-to-junit image:
build pre-commit image:
stage: .pre
rules:
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/
when: never
- if: '$CI_PROJECT_NAMESPACE == "bilke" || $CI_PROJECT_NAMESPACE == "ogs"'
changes:
- scripts/docker/Dockerfile.pre-commit
......@@ -53,6 +59,8 @@ build pre-commit image:
build web image:
stage: .pre
rules:
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/
when: never
- if: '$CI_PROJECT_NAMESPACE == "bilke" || $CI_PROJECT_NAMESPACE == "ogs"'
changes:
- scripts/docker/Dockerfile.web
......
......@@ -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:
......
# Built for Sandy Bridge (envinf1) and newer
container:
stage: package
tags: [envinf2-shell]
......@@ -5,27 +6,33 @@ container:
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: $CI_COMMIT_TAG
- changes:
- scripts/ci/jobs/container.yml
- if: $CI_COMMIT_BRANCH =~ /^v[0-9]\.[0-9]\.[0-9]/
- when: manual
allow_failure: true
extends:
- .container-maker-setup
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- if [[ "$CI_COMMIT_BRANCH" == "master" ]] ;then export DOCKER_TAG="--tag $CI_REGISTRY/ogs/$CI_PROJECT_NAME/ogs-serial:latest" ; fi
- >
poetry run ogscm compiler.py ogs.py -B -C -R --ogs ../..
--build_args ' --progress=plain'
--pm system --cvode --ccache
--cmake_args ' -DBUILD_TESTING=OFF -DOGS_BUILD_UTILS=ON'
--tag $CI_REGISTRY/ogs/$CI_PROJECT_NAME/ogs-serial --upload
--cmake_args ' -DOGS_CPU_ARCHITECTURE=sandybridge -DBUILD_TESTING=OFF'
$DOCKER_TAG
- >
poetry run ogscm compiler.py mpi.py ogs.py -B -C -R --ogs ../..
--build_args ' --progress=plain'
--pm system --cvode --ccache
--cmake_args ' -DBUILD_TESTING=OFF'
--cmake_args ' -DOGS_CPU_ARCHITECTURE=sandybridge -DBUILD_TESTING=OFF'
--base_image 'centos:8' --ompi 4.0.5 --mpi_benchmarks
- >
poetry run ogscm compiler.py ogs.py -B -C -R --ogs ../..
--build_args ' --progress=plain'
--pm system --cvode --ccache
--cmake_args ' -DBUILD_TESTING=OFF'
--cmake_args ' -DOGS_CPU_ARCHITECTURE=sandybridge -DBUILD_TESTING=OFF'
--gui
artifacts:
name: container
......
meta:
stage: .pre
tags: [shell]
variables:
GIT_DEPTH: 1000
script:
- git fetch --depth 1000
- echo "OGS_VERSION=${CI_COMMIT_TAG:-`git describe --tags --long --dirty --always`}" >> build.env
- cat build.env
artifacts:
......
......@@ -3,7 +3,8 @@ if(NOT OGS_USE_CONAN)
endif()
string(TOLOWER ${OGS_USE_CONAN} OGS_USE_CONAN_lower)
if(OGS_USE_CONAN_lower STREQUAL "auto" AND POETRY)
execute_process(COMMAND ${CMD_COMMAND} poetry add conan)
execute_process(COMMAND ${CMD_COMMAND} poetry add conan==${ogs.minimum_version.conan}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
find_program(CONAN_CMD conan HINTS ${LOCAL_VIRTUALENV_BIN_DIRS}
REQUIRED NO_DEFAULT_PATH
)
......@@ -33,7 +34,7 @@ include(${PROJECT_SOURCE_DIR}/scripts/cmake/conan/conan.cmake)
set(CONAN_REQUIRES
boost/${ogs.minimum_version.boost}@conan/stable
eigen/${ogs.minimum_version.eigen}@conan/stable
eigen/${ogs.minimum_version.eigen}
vtk/${ogs.tested_version.vtk}@bilke/stable
CACHE INTERNAL ""
)
......
......@@ -13,9 +13,13 @@ set(DOXYGEN_EXCLUDE
${PROJECT_SOURCE_DIR}/web)
set(DOXYGEN_FILE_PATTERNS *.h *.cpp *.tpp *.dox)
set(DOXYGEN_PROJECT_NAME "OGS")
set(DOXYGEN_PROJECT_NUMBER "${OGS_GIT_BRANCH}")
set(DOXYGEN_PROJECT_VERSION ${GIT_SHA1_SHORT})
set(DOXYGEN_PROJECT_LOGO ${PROJECT_SOURCE_DIR}/Documentation/OpenGeoSys-Logo.png)
set(DOXYGEN_HTML_OUTPUT ${PROJECT_BINARY_DIR}/docs)
if("${OGS_GIT_BRANCH}" MATCHES "^v[0-9]\\.[0-9]\\.[0-9]")
set(DOXYGEN_HTML_COLORSTYLE_HUE 190)
endif()
set(DOXYGEN_EXTRACT_ALL YES)
set(DOXYGEN_EXTRACT_PRIVATE YES)
set(DOXYGEN_EXTRACT_PACKAGE YES)
......
......@@ -82,7 +82,11 @@ else()
include(${VTK_USE_FILE})
endif()
find_package(Eigen3 ${ogs.minimum_version.eigen} REQUIRED)
if(OGS_USE_CONAN)
set(EIGEN3_INCLUDE_DIR ${CONAN_INCLUDE_DIRS_EIGEN} CACHE INTERNAL "")
else()
find_package(Eigen3 ${ogs.minimum_version.eigen} REQUIRED)
endif()
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})
if(OGS_USE_MFRONT)
......
......@@ -28,6 +28,19 @@ if(NOT IS_GIT_REPO)
endif()
endif()
if(IS_GIT_REPO)
if(DEFINED ENV{CI_COMMIT_BRANCH})
set(OGS_GIT_BRANCH $ENV{CI_COMMIT_BRANCH})
else()
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE OGS_GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
endif()
if(IS_GIT_REPO AND NOT OGS_VERSION)
# Get version info from Git, implementation based on
# https://github.com/tomtom-international/cpp-dependencies
......
find_program(POETRY poetry)
if(POETRY)
configure_file(${PROJECT_SOURCE_DIR}/scripts/python/poetry.in.toml
${PROJECT_BINARY_DIR}/poetry.toml COPYONLY)
if(NOT EXISTS ${PROJECT_BINARY_DIR}/pyproject.toml)
configure_file(${PROJECT_SOURCE_DIR}/scripts/python/pyproject.in.toml
${PROJECT_BINARY_DIR}/pyproject.toml)
endif()
if(NOT EXISTS ${PROJECT_BINARY_DIR}/.venv)
execute_process(COMMAND ${CMD_COMMAND} poetry install)
endif()
set(Python3_ROOT_DIR ${PROJECT_BINARY_DIR}/.venv)
set(Python3_EXECUTABLE ${Python3_ROOT_DIR}/bin/python)
if(MSVC)
set(Python3_EXECUTABLE ${Python3_ROOT_DIR}/Scripts/python.exe)
if(OGS_USE_POETRY)
find_program(POETRY poetry)
if(POETRY)
configure_file(${PROJECT_SOURCE_DIR}/scripts/python/poetry.in.toml
${PROJECT_BINARY_DIR}/poetry.toml COPYONLY)
if(NOT EXISTS ${PROJECT_BINARY_DIR}/pyproject.toml)
configure_file(${PROJECT_SOURCE_DIR}/scripts/python/pyproject.in.toml
${PROJECT_BINARY_DIR}/pyproject.toml)
endif()
if(NOT EXISTS ${PROJECT_BINARY_DIR}/.venv)
execute_process(COMMAND ${CMD_COMMAND} poetry install
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
endif()
set(Python3_ROOT_DIR ${PROJECT_BINARY_DIR}/.venv)
set(Python3_EXECUTABLE ${Python3_ROOT_DIR}/bin/python)
if(MSVC)
set(Python3_EXECUTABLE ${Python3_ROOT_DIR}/Scripts/python.exe)
endif()
endif()
endif()
......@@ -50,5 +53,6 @@ if(POETRY)
)
endif()
endif()
execute_process(COMMAND ${CMD_COMMAND} poetry add ${PYTHON_PACKAGES})
execute_process(COMMAND ${CMD_COMMAND} poetry add ${PYTHON_PACKAGES}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
endif()
/v6.3.3/* https://ogs-doxygen-v6-3-3.netlify.app/:splat 200!
......@@ -8,10 +8,9 @@ fi
module use /global/apps/modulefiles
module load foss/2019b
module load CMake/3.15.3
module load cmake/3.19.4-1
module load ninja
module load git/2.23.0
module load git-lfs/2.7.1
# Libraries
module load boost/1.67.0-1
......
+++
date = "2018-02-26T11:00:13+01:00"
title = "Build with ninja"
author = "Lars Bilke"
weight = 1031
[menu]
[menu.devguide]
parent = "advanced"
+++
## Install ninja
<div class='win'>
Download *ninja.zip* from the [latest GitHub release](https://github.com/ninja-build/ninja/releases/latest). Unzip it and make sure that the directory containing the `ninja.exe` is the `PATH`-environment variable!
</div>
<div class='linux'>
Install with your package manager:
```bash
sudo apt-get install ninja-build
```
</div>
<div class='mac'>
Install via Homebrew:
```bash
brew install ninja
```
</div>
## Configure for ninja and build
Run CMake with the ninja-generator:
```bash
cmake ../source/dir -G Ninja
ninja
```
<div class='note'>
### <i class="far fa-exclamation-triangle"></i> Visual Studio remarks
When you configure with the Ninja generator you have to run CMake from the appropriate Visual Studio Command Prompt! From there you can both use `cmake` as well as `cmake-gui` which starts the GUI. In the GUI select the `Ninja` generator and leave the toggle `Use default native compilers` on.
</div>
......@@ -57,7 +57,7 @@ Generating Doxygen documentation:
module load Doxygen/1.8.14
```
You can [build with Ninja]({{< ref "build-with-ninja" >}}):
You can build with Ninja:
```bash
module load ninja/1.9.0
......
......@@ -11,36 +11,53 @@ weight = 1004
## Overview
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 but should **not** be placed inside the source code. 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:
Before compiling the developer has to choose a configuration of the software. OGS comes in lots of different flavours (e.g. serial / parallelized), can be build with optional features (e.g. with Python scripting support) or modules (e.g. MFront material models).
- `ogs-source-code` (or simply `ogs`)
- `build-release`
- `build-debug`
- `build-release-mpi`
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:
So just go ahead and create a build-directory along your source code directory.
- `ogs-source-code` (or simply `ogs`)
- `build/release`
- `build/debug`
- `build/release-petsc`
- `build` (can also be placed outside the source tree)
## Configure with CMake
For configuring a build the open source [CMake](http://www.cmake.org) tool is used. CMakeLists.txt files replace traditional Makefiles or IDE project files. The CMake tool is run inside the build-directory with a reference to the source code-directory of the project and user-chosen options. CMake then generates based on the chosen *Generator* either Makefiles or project files for IDE such as Visual Studio or Eclipse inside the build directory. Also all the compiled files will be generated in this directory. This keeps the actual source code clean from intermediate files which are generated from the source code. Nothing inside the build directory will ever be version controlled because its contents can be regenerated anytime from the source code.
For configuring a build the open source tool [CMake](http://www.cmake.org) is used. `CMakeLists.txt` files replace traditional Makefiles or IDE project files.
Because of the separation of the source code and all stuff that is generated as a part of the build process it is no problem to have several build configurations (e.g. a serial configuration and a parallelized MPI-enabled configuration) all referring to the same source code.
We provide CMake configuration presets defined in [CMakePresets.json](https://gitlab.opengeosys.org/ogs/ogs/-/blob/master/CMakePresets.json) for simple build configuration (**Note:** Requires CMake $\geq$ 3.19! Otherwise see [Configure manually](#option-configure-manually)). See the following table for commonly used presets:
When you want to start over with a new configuration simply delete the build-directory, create a new one and reconfigure.
### Available CMake presets
[See this]({{< ref "configuration-options" >}}) for a list of available options.
| | Ninja[^1] | Visual Studio |
| ------------- | ------------- | ---------------- |
| CLI Release | release | msvc-release |
| CLI Debug | debug | msvc-debug |
| GUI Release | release-gui | msvc-release-gui |
| GUI Debug | debug-gui | msvc-debug-gui |
| PETSc Release | release-petsc | - |
| PETSc Debug | debug-petsc | - |
<div class='win'>
[^1]: Requires the `ninja`-tool. See [install instructions]({{< ref "prerequisites.md#optional-install-ninja" >}}).
<div class='note'>
### Configure with a preset
### <i class="far fa-exclamation-triangle"></i> Supported Visual Studio Generators
In the source directory run `cmake`:
- `Visual Studio {{< dataFile "versions.minimum_version.msvc.number" >}} {{< dataFile "versions.minimum_version.msvc.year" >}}`
```bash
# Usage: cmake -S [path-to-source] --preset=[preset-name]
cmake -S . --preset=release
```
</div>
This will create a build-directory in the source tree (`build/release`) with the default CMake options and the Release configuration.
</div>
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`)
Also all the compiled files will be generated in this directory. This keeps the actual source code clean from intermediate files which are generated from the source code. Nothing inside the build directory will ever be version controlled because its contents can be regenerated anytime from the source code.
When you want to start over with a new configuration simply delete the build-directory, create a new one and reconfigure.
[See this]({{< ref "configuration-options" >}}) for a list of commonly used available options.
### Note: Installation of required libraries
......@@ -48,63 +65,73 @@ It is preferred to use the Conan package manager to install required third-party
Instead of using Conan you can optionally [install the required libraries manually]({{< ref "third-party-libraries.md" >}}) **before** running CMake.
<div class='win'>
<div class='note'>
#### <i class="far fa-exclamation-triangle"></i> Multi-configuration with Conan and Visual Studio
### User-defined presets
With Conan one build directory corresponds to one configuration. If you want to have e.g. a release and a debug build you need to create two build directories. This is nothing new new to Linux / GCC user but differs to Visual Studios default behavior having just one build-folder / project with different configurations. A typical Visual Studio setup with both Release and Debug configs would be initialized as follows:
You can create a `CMakeUserPresets.json` file in the root source directory with your own presets (this file is ignored by git):
```json
{
"version": 1,
"configurePresets": [
{
"name": "my-release",
"inherits": "release",
"cacheVariables": {
"OGS_USE_POETRY": "OFF"
}
}
]
}
```bash
[assuming you are at the same directory where the source code directory is located]
mkdir ogs-build && cd ogs-build
mkdir debug && cd debug
cmake ../../ogs -G "Visual Studio {{< dataFile "versions.minimum_version.msvc.number" >}} {{< dataFile "versions.minimum_version.msvc.year" >}}" -DCMAKE_BUILD_TYPE=Debug
cd .. && mkdir release && cd release
cmake ../../ogs -G "Visual Studio {{< dataFile "versions.minimum_version.msvc.number" >}} {{< dataFile "versions.minimum_version.msvc.year" >}}" -DCMAKE_BUILD_TYPE=Release
```
`..\..\ogs` represents the relative path to the source code (please adapt if you have a different directory layout).
</div>
Please also note that in Visual Studio you have to choose the correct configuration (i.e. when opening the solution-file in the release-folder you have to switch the Visual Studio configuration to **Release**)!
<div class='win'>
</div>
<div class='note'>
</div>
### Windows notes:
## Option: Configure from the command line
#### <i class="far fa-check"></i> Ninja requirement: Use the Visual Studio command line
CMake can be run from the shell by invoking the cmake command inside a build directory. You can pass any CMake variable or option with `-DVARIABLE_NAME=VALUE` (note the `-D` in front!). You can also pass the generator you want to use (e.g. `Unix Makefiles` or `Visual Studio {{< dataFile "versions.minimum_version.msvc.number" >}} {{< dataFile "versions.minimum_version.msvc.year" >}}`-project files) with the `-G` parameter (to see all available generators just run `cmake --help`), although in most cases the appropriate generator will be chosen automatically. The last parameter to the CMake command is the path to the source code directory. A typical call would look like this:
To use the Ninja build tool you need to configure in the Visual Studio command line. In the Start menu under *Visual Studio {{< dataFile "versions.minimum_version.msvc.year" >}}* you find a application link to *x64 Native Tools Command Prompt for VS {{< dataFile "versions.minimum_version.msvc.year" >}}*. This starts a command line setup for Visual Studio 64-bit. Now you can use a Ninja preset:
```bash
cmake -G "Visual Studio {{< dataFile "versions.minimum_version.msvc.number" >}} {{< dataFile "versions.minimum_version.msvc.year" >}}" -DCMAKE_BUILD_TYPE=Release ../ogs
cmake -S . --preset=release
```
CMake tries to autodetect your compiler so in most cases this should be enough:
#### <i class="far fa-exclamation-triangle"></i> Multi-configuration with Conan and Visual Studio
With Conan one build directory corresponds to one configuration. If you want to have e.g. a release and a debug build you need to create two build directories. This is nothing new to Linux / GCC user but differs to Visual Studios default behavior having just one build-folder / project with different configurations. A typical Visual Studio setup with both Release and Debug configs would be initialized as follows:
```bash
cmake ../ogs
cmake -S . --preset=msvc-release
cmake -S . --preset=msvc-debug
```
{{< asciinema url="https://asciinema.org/a/249004" >}}
Please also note that in Visual Studio you have to choose the correct configuration (i.e. when opening the solution-file in the release-folder you have to switch the Visual Studio configuration to **Release**)!
<div class='note'>
#### <i class="far fa-check"></i> Pro Tip: Use a better terminal application
### <i class="far fa-check"></i> Pro Tip: Use the Visual Studio command line
Use the [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701) for a better terminal experience. It offers modern terminal features such as multiple tabs and panes.
In the Start menu under *Visual Studio {{< dataFile "versions.minimum_version.msvc.year" >}}* you find a application link to *x64 Native Tools Command Prompt for VS {{< dataFile "versions.minimum_version.msvc.year" >}}*. This starts a command line setup for Visual Studio 64-bit. When you run CMake commands in this command line the correct generator will be picked up automatically:
</div>
```bash
cmake ../ogs
```
</div>
This even allows for using [Ninja]({{< ref "build-with-ninja.md" >}}) as the build tool which can effectively utilize all CPU cores
## Option: Configure manually
### <i class="far fa-check"></i> Pro Tip 2: Use a better terminal application
If you cannot use CMake presets (e.g. when your CMake installation does not support it) manually create a build directory and run CMake from within with all required parameters, e.g:
Use the [Windows Terminal](https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701) for a better terminal experience. It offers modern terminal features such as multiple tabs and panes.
</div>
```bash
# in ogs source-directory
mkdir -p build/release
cd build/release
cmake ../.. -G Ninja -DCMAKE_BUILD_TYPE=Release
```
## Option: Configure with a visual tool
......@@ -116,10 +143,10 @@ CMake comes with a graphical tool called **cmake-gui**. You can find it in the *
<div class='linux'>
A more convenient way of running cmake on the command line is to use the `ccmake` tool. This is a shell tool but with some graphical user interface. To use it just run `ccmake` inside your build directory with the path to the source code (and optionally the generator you want to use) as parameter:
A more convenient way of running cmake on the command line is to use the `ccmake` tool. This is a shell tool but with some graphical user interface. To use it just run `ccmake` instead of `cmake`:
```bash
ccmake ../ogs
ccmake -S . --preset=release
```
First press <kbd>C</kbd> to **Configure**. You are now presented the available configuration options. You can navigate in the list with the cursor keys and toggle / alter options with <kbd>Enter</kbd>. You may also press <kbd>T</kbd> to toggle (previously hidden) advanced options. Press <kbd>C</kbd> again until the **Generate**-option becomes visible. Press <kbd>G</kbd> to generate the project files and exit `ccmake`.
......
......@@ -15,7 +15,7 @@ weight = 1005
### Step: Build with Visual Studio
Open the OGS.sln either by double-clicking it in the file browser or opening in Visual Studio via **File / Open / Project**.
Open the OGS.sln (in the build directory) either by double-clicking it in the file browser or opening in Visual Studio via **File / Open / Project**.
On the project explorer right-click on **ogs** or **ogs-gui** and choose **Set as startup project**. Then press <kbd>F5</kbd> or click the green arrow to build and start the project.
......@@ -30,78 +30,20 @@ You can work normally in Visual Studio but remember that you have to make projec
<div class='linux'>
### Option: Make
### With ninja
To build with the `make` tool on the shell go to your previously created build directory and type `make`:
To build with the `ninja` tool on the shell go to your previously configured build directory and type `ninja`:
```bash
cd build
make
cd build/release
ninja
```
To speedup the compilation process append the number of cores of your cpu to the make command. E.g. for 8 cores:
```bash
make -j 8
```
{{< asciinema url="https://asciinema.org/a/249005" preload="1" >}}
### Option: Eclipse
To let CMake generate the Eclipse project files change the generator argument to the CMake run:
```bash
cmake [your configuration options] -G"Eclipse CDT4 - Unix Makefiles" ../sources
```
Or with ccmake
```bash
ccmake -G"Eclipse CDT4 - Unix Makefiles" ../sources
```
Start the Eclipse ide. From the menu choose **File / Import**. In the import dialog choose **General / Existing projects into workspace** and click **Next**. In **Select root directory** select your build directory and make sure that **Copy project into workspace** is unchecked. Click **Finish**.
</div>
<div class='mac'>
### Option: Make
To build with the `make` tool on the shell go to your previously created build directory and type `make`:
```bash
cd build
make
```
To speedup the compilation process append the number of cores of your cpu to the make command. E.g. for 8 cores: