.. _installation-compilation-ubuntu18lts:
-----------------------------------------------------
Building guide: Linux - Ubuntu 18 LTS (Bionic Beaver)
-----------------------------------------------------
IDSimF was tested on Ubuntu 18 LTS extensively. Therefore this guide uses Ubuntu 18 LTS as example how to compile IDSimF on a Linux system. The configuration and compilation process should be very similar on other Debian derived Linux distributions. Configuration and compilation on other distribution families should also be similar, if the required dependencies are available on the target platform.
Update package sources, Check / install Git and cmake:
------------------------------------------------------
First the package sources should be updated:
.. code-block:: console
sudo apt update
Usually ``git`` should be installed already, however check if git is really installed:
.. code-block:: console
git --version
prints the installed ``git`` version. If ``git`` is not installed, install it with
.. code-block:: console
sudo apt install git
``cmake`` is usually not installed. Install it with
.. code-block:: console
sudo apt install cmake
Install a modern C++ compiler:
------------------------------
The default C++ compiler in Ubuntu is too old to support all used C++17 features. Therefore, a modern / recent compiler has to be installed. The c++ compiler of `gnu compiler collection (gcc) `_ gnu compiler collection (``g++``
) in major version 8 is readily available on Ubuntu 18 and is compatible with IDSimF. Install it with
.. code-block:: console
sudo apt install g++-8
Alternatively the `llvm `_ c++ frontend `clang 10 / llvm `_ is also available and can be used to compile IDSimF. Install it with
.. code-block:: console
sudo apt install clang-10
Note that you have to install *both* packages (g++-8 and clang-10) to use ``clang``, since the clang-10 package is missing some header files.
Clone the IDSimF repository
---------------------------
Clone the IDSimF repository to your local machine with ``git`` from GitHub:
.. code-block:: console
git clone https://github.com/IPAMS/IDSimF.git
This clones the IDSimF repository to a local folder ``IDSimF``.
Configuration and building with cmake
--------------------------------------
Preparing the build
...................
IDSimF uses ``cmake`` as helping tool for configuration and compilation. ``cmake`` allows a so called "out of source build". This creates a separated "binary tree" in a separated build folder, in which the compilation of executable binaries takes place without interfering with the cloned sources.
To do an out of source build, change into the cloned IDSimF folder and create a build folder, for example ``build`` in it and change into it:
.. code-block:: console
cd IDSimF
mkdir build
cd build
Basically ``cmake`` prepares a build tree in the current folder if it is called with an source folder as argument. However, since we do not want to build with the default compiler of the system, we have to set some options for ``cmake``. This is done with optional arguments of the form ``-D