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 F5 or click the green arrow to build and start the project.
The reason for this is that you can have only one sub-project of your Visual Studio Solution activated for debugging (e.g. by pressing F5). Per default this is the first sub-project (in the case of a CMake-generated project this is ALL_BUILD
). This must be manually set to a sub-project which generates an executable (a library sub-project cannot be started). And because this setting is stored in user specific project file it cannot be set via CMake.
You can work normally in Visual Studio but remember that you have to make project changes in the CMakeLists.txt
-file and not inside Visual Studio. You can add a new source file within Visual Studios File menu but you have to add that file also to the CMake file. Every time you change a CMakeLists.txt
and you build the project a new CMake run is automatically invoked. After that Visual Studio informs you that the project files were changed and it reloads them.
You can also build from the command line:
cd build-directory
cmake --build . --config Release
Please that with Visual Studio you have to provide the --config
-parameter as Visual Studio is a multi-configuration generator in CMake.
If you build with the help of a CMake preset then you can omit the --config
-parameter, e.g.:
cd source-directory
cmake --build --preset msvc-release
To build with the ninja
tool on the shell go to your previously configured build directory and type ninja
:
cd ../build/release
ninja
By default, ninja
uses maximum parallelism which may lead to a memory consumption exceeding the available memory (especially when compiling the processes).
Therefore, we recommend restricting the number of parallel compilations to be used to one per 8 GB RAM, e.g., if your machine has 16 GB RAM type ninja -j 2
for a maximum of two parallel compilations.
Another option is to build just the process you are interested in by configuring with the CMake option OGS_BUILD_PROCESSES
, e.g.: cmake -DOGS_BUILD_PROCESSES=HT ....
. In this case you should be able to compile with full parallelization.
Similar to the configure presets there are build presets, e.g. in your source-directory:
cmake --build --preset release # equivalent to running ninja above
cmake --build --preset release -j 2 -t ogs # build the ogs-target with 2 threads
See Linux-tab!
Now the build process is running… This can take some time because maybe there are external libraries which get automatically downloaded and compiled. This step is only done once per build directory, so subsequent builds will be much faster. See this for more.
Congratulations you have finished the Getting Started-section!
Have a look at the other sections of this guide. Check out Development Workflows if you are interested in actively contributing to the project. The Configuration Options-page shows you all available build customizations. Go ahead!
This article was written by Lars Bilke. If you are missing something or you find an error please let us know.
Generated with Hugo 0.122.0
in CI job 504124
|
Last revision: November 12, 2024
Commit: [BL/MPI] Use MPI_COMM_WORLD in reduceMin 4aae83e
| Edit this page on