The minimum prerequisites to build OGS are:
A fresh system with none of the prerequisites fulfilled is assumed. Skipping installation steps or using a non-supported version might result in unexpected problems. If possible, you may consider reinstalling or manual modifying the configuration of the already installed tool.
Please note that the following setup on Windows is the native Windows development setup. This native setup is quite involved and heavy on system resources. We can recommend an alternative setup in which the Windows Subsystem for Linux is used: Setup and development of OGS follows the Linux way but you can use your Windows IDE (especially Visual Studio Code) for development and debugging. If this sounds interesting please follow the steps here!
As we use lots of features of the C++17-standard we support Visual Studio 2019 with compiler version 19.24 and up. Therefore you will need at least Windows 7 (64-bit required). It is perfectly fine to use the free Community Edition of Visual Studio.
Desktop Development with C++
On Debian-based (we recommend using Ubuntu 22.04) you need to install the build-essential
-package (which contains the gcc
-compiler and the make
-tool):
sudo apt install build-essential
You need to have at least GCC 11.3.0 which you can check with gcc --version
.
If you are on an older Ubuntu version than 22.04 you can install a newer compiler from the ubuntu-toolchain-r/test
-repository (with the following steps e.g. you can install GCC 11 on Ubuntu 20.04):
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-11
sudo apt-get install g++-11
To make the newly installed compiler the default one:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 60 \
--slave /usr/bin/g++ g++ /usr/bin/g++-11
If you do not do this you have to specify the compiler during the first CMake run:
CC=gcc-11 CXX=c++-11 cmake ../ogs [more CMake options]
xcode-select --install
Open Xcode one time to install some other Xcode stuff.
Now also install the Homebrew package manager:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
The Homebrew package manager is needed for installing other libraries and packages. It is just like a Linux package manager.
Git is a powerful and distributed version control system. OGS source code is hosted on GitLab. See the developer guide page on Code Reviews for more info on how OGS uses GitLab for collaborative development.
Download and install git from the git homepage. Use the default installer options but also enable Enable symbolic links
under the Configuring extra options page.
This install a new command line called Git Bash which should be used for all git operations.
Let Git know who you are:
git config --global user.name "Your Name Here"
git config --global user.email "your_email@example.com"
Enable the long paths feature:
git config --global core.longpaths true
You may also have enable the long paths feature in the Windows registry.
In some corporate environments you may have to use a proxy server. In this case tell git about it:
git config --global http.proxy http://yourproxy.example.com
Please check if Git is already installed:
$ git --version
git version 2.14
Otherwise please install Git with your favorite package manager:
sudo apt-get install git
Let Git know who you are:
git config --global user.name "Your Name Here"
git config --global user.email "your_email@example.com"
Optionally enable password storing when interacting with a remote server:
git config --global credential.helper store
In some corporate environments you may have to use a proxy server. In this case tell git about it:
git config --global http.proxy http://yourproxy.example.com
Git is already installed.
Let Git know who you are:
git config --global user.name "Your Name Here"
git config --global user.email "your_email@example.com"
The graphical GitHub client is also maybe worth a look.
In some corporate environments you may have to use a proxy server. In this case tell git about it:
git config --global http.proxy http://yourproxy.example.com
Install CMake using system package manager, e.g. on Ubuntu
sudo apt install cmake
For other Linux distributions you want to use your distributions package manager, pip or snap.
Install CMake with Homebrew:
brew install cmake
We recommend ninja
as a cross-platform build tool (make
-replacement).
Download the binary from GitHub and put the extracted ninja.exe
in the PATH
.
sudo apt-get install ninja-build
Install Ninja with Homebrew:
brew install ninja
pip
enabled (you may uncheck Documentation, tcl/tk, Python test suite)Install Python 3 and pip:
sudo apt-get install python3 python3-pip
Install Python 3 with Homebrew:
brew install python
Use Another Qt installer (aqt
) for installing the Qt binaries to some path on your machine:
pip install aqtinstall
mkdir qt
cd qt
aqt install-qt win desktop 5.15.2 win64_msvc2019_64
aqt install-qt win desktop 5.15.2 win64_msvc2019_64 --archives qtxmlpatterns
This will install Qt to [your-directory]/qt/5.15.2/msvc2019_64
.
To finish add [your-directory]/qt/5.15.2/msvc2019_64/bin
bin to the PATH
environment variable.
Install NetCDF4 by downloading and installing the official installer. The C++-bindings to NetCDF are automatically build via CPM.
pip install aqtinstall
mkdir /opt/qt
cd /opt/qt
aqt install-qt linux desktop 5.15.2 gcc_64
aqt install-qt linux desktop 5.15.2 gcc_64 --archives qtxmlpatterns qtx11extras
Make sure to add /opt/qt/5.15.2/gcc_64/bin
to the PATH
.
Install more dependencies for VTK rendering and for NetCDF IO:
sudo apt-get install freeglut3 freeglut3-dev libglew-dev libglu1-mesa libglu1-mesa-dev \
libgl1-mesa-glx libgl1-mesa-dev libnetcdf-c++4-dev
pip install aqtinstall
mkdir /opt/qt
cd /opt/qt
aqt install-qt mac desktop 5.15.2 clang_64
aqt install-qt mac desktop 5.15.2 clang_64 --archives qtxmlpatterns qtx11extras
Make sure to add /opt/qt/5.15.2/clang_64/bin
to the PATH
.
Install NetCDF:
brew install netcdf-cxx
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: December 13, 2024
Commit: [doc] Devguide; install cmake via system pkg mgr 3932d44
| Edit this page on