.. _getting_started_building_project: .. role:: raw-html(raw) :format: html Building the Project ==================== Requirements ------------ To use this project ``CMake`` is required. You can check if CMake is installed by running .. code-block:: bash cmake --version .. note:: ``CMake`` can be `downloaded `_ or installed OS specific through other methods *Windows* There are several ways to install ``CMake`` on Windows. Using `Windows Package Manager `_ ``CMake`` can be installed using the following command .. code-block:: bash winget install kitware.cmake Using `Chocolatey `_ ``CMake`` can be installed using the following command .. code-block:: bash choco install cmake Using `Visual Studio `_ `Official Installation Guid `_ .. image:: ../_static/photos/VisualStudio_CMake_Installation.png :align: right :scale: 75% 1. Therefore you need to `download Visual Studio `_. The Community Edition is free. 2. Starting the Visual Studio Installer 3. Select ``Desktop development with C++`` and make sure that ``C++-CMake-Tools für Windows`` is checked on the right side of the installer. 4. Press Install *Linux* A simple way is using ``apt-get`` by running the command .. code-block:: bash sudo apt-get install cmake *MacOS* A simple way is using ``brew`` by running the command .. code-block:: bash brew install cmake As the project also uses ``netCDF``, this must also be installed on the PC. You can check if netCDF is installed by running .. code-block:: bash nc-config --version .. note:: ``netCDF`` can be installed OS specific **Windows** 1. `Download `_ and install the netCDF-C library and utilities 2. Install as usual and make sure to ``add netCDF`` to the system ``PATH`` for all users **Linux and MAC** The easiest way to install netCDF is via `Homebrew `_. Run the following command in the terminal: .. code-block:: bash brew install netcdf Building -------- 1. Download the `git repository `_ with git HTTPS .. code-block:: bash git clone https://github.com/RivinHD/Tsunami-Simulation.git SSH .. code-block:: bash git clone git@github.com:RivinHD/Tsunami-Simulation.git 2. Go into the project folder. Your current path should look like this ``../Tsunami-Simulation``. 3. Install submodules with git .. code-block:: bash git submodule init git submodule update 4. Now create a new folder called ``build`` with .. code-block:: bash mkdir build 5. Go into this directory. Your current path should look like this ``../Tsunami-Simulation/build``. 6. Now we can start with CMake. Run the following command .. code-block:: bash cmake .. -DCMAKE_BUILD_TYPE= Supported values for ```` are **Release** and **Debug**. If only ``cmake ..`` is used the Release build is selected. The most desired command might be: .. code-block:: bash cmake .. -DCMAKE_BUILD_TYPE=Release .. note:: With the Option ``-G`` a Generator can be defined used to create the make files and compile the Code. All available Generators can be found at the bottom of the :raw-html:`
` ``cmake --help`` text. An Example could look like this .. code-block:: bash cmake .. -G "MinGW Makefiles" .. important:: When using a multi-config Generator, i.e. Ninja Multi-Config, Visual Studio Generators, Xcode, ``-DCMAKE_BUILD_TYPE=`` is not needed, and the build type is configured on compilation. Therefore, this cmake build command is used: .. code-block:: cmake cmake --build . --config Release --target simulation Options for ``--config`` are **Release** and **Debug**. :raw-html:`
` Options for ``--target`` are **simulation**, **sanitize**, **test**, **sanitize_test** and **test_middle_states**. .. note:: With the Option ``-D`` toggle options can be activated supported only by this ``CMakeLists.txt``. Available options are: +--------------------+--------------------------------------------------------------------------------------------------------------------+ | Option | Description | +====================+====================================================================================================================+ | DISABLE_IO | Completely disable any file IO i.e. Solutions, Stations and Checkpoints | +--------------------+--------------------------------------------------------------------------------------------------------------------+ | REPORT | Enables the report out for the used compiler | +--------------------+--------------------------------------------------------------------------------------------------------------------+ To activate an option, the following must be written: .. code-block:: bash cmake .. -D