11. Compilation

11.1. Setup

Comp3D depends on the libraries:

  • Boost

  • Eigen v3

  • proj 9.3

  • Qt 5 (optional)

The main tools used for its compilation are:

  • a c++17 compiler (gcc or vc++)

  • cmake

11.1.1. GNU/Linux

All the GNU/Linux commands are described for Ubuntu 22.04.

11.1.1.1. Packages

sudo apt install cmake libboost-all-dev qttools5-dev-tools qtbase5-dev \
                 libeigen3-dev libclang-common-11-dev qttools5-dev

11.1.1.2. Proj

LibProj version is fixed to 9.3, installed into /usr/local/proj93/.

Download grids:

wget https://download.osgeo.org/proj/proj-datumgrid-1.8.zip
unzip proj-datumgrid-1.8.zip -d proj-data
sudo mkdir -p /usr/local/proj93/share/proj/
sudo cp proj-data/* /usr/local/proj93/share/proj/

Compile proj-9.3 :

sudo apt install sqlite libsqlite3-dev
wget https://download.osgeo.org/proj/proj-9.3.1.tar.gz
tar -xf proj-9.3.1.tar.gz
cd proj-9.3.1
mkdir build
cd build
cmake .. -DBUILD_SHARED_LIBS=OFF -DBUILD_PROJSYNC=OFF  -DENABLE_CURL=OFF -DENABLE_TIFF=OFF -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/usr/local/proj93
make
sudo make install

11.1.1.3. Configure Comp3D

git clone https://github.com/IGNF/Comp3D
cd Comp3D
mkdir build
cd build
cmake ..

11.1.1.4. Configure tests

cd Comp3D
cd tests
mkdir build
cd build
cmake ..

11.1.2. Windows

11.1.2.1. vcpkg

Choose a directory to install vcpkg in (here marked *VCPKG_DIR*)

cd *VCPKG_DIR*
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
bootstrap-vcpkg.bat

11.1.2.2. Configure Comp3D

git clone https://github.com/IGNF/Comp3D
cd Comp3D
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=*VCPKG_DIR*/vcpkg/scripts/buildsystems/vcpkg.cmake

(The first time, this configuration will be very long due to the QT5 donwload and compilation)

11.1.2.3. Configure tests

cd Comp3D
cd tests
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=*VCPKG_DIR*/vcpkg/scripts/buildsystems/vcpkg.cmake

11.2. Compilation

11.2.1. GNU/Linux

Comp3D (in Comp3D/build/ directory):

make -j4

Tests (in Comp3D/tests/build/ directory):

make -j4

Then run the tests from Comp3D/tests/ directory:

./build/Comp3D_tests

11.2.2. Windows

Comp3D (in Comp3D/build/ directory):

cmake --build . --config Release

Tests (in Comp3D/tests/build/ directory):

cmake --build . --config Release

Then run the tests from Comp3D/tests/ directory:

./build/Release/Comp3D_tests.exe

11.3. Automatic compilation/cross-compilation/tests/packaging

All these actions are done with the command:

./run_compile-test-package_docker.sh

This command will:

  • setup the compilation docker image if needed

  • compile user documentation

  • compile Comp3D for GNU/Linux

  • compile and run tests

  • cross-compile for Windows

  • cross-compile and run tests

  • packages (appimage, deb, zip)

See docker/README.md for more information and check the docker scripts to learn more about cross-complation and packaging.

11.4. Build options

The software project is defined by Comp3D_cpp.pro. It is possible to change the compilation options on the DEFINES += lines of this file:

  • USE_QT: to use Qt, mandatory in order to have messages translation

  • USE_RES: depends on USE_QT, to be able to create report resources directory res/ (see Computation Report)

  • USE_GUI: depends on USE_QT, to enable the GUI

  • USE_AUTO: to enable the automatic mode (see Automatization)

  • ADD_PROJ_CC, ADD_PROJ_NTF, ADD_PROJ_UTM: to fill the pre-recorded projections list

11.5. Documentation generation

11.5.1. User documentation

The user documentation is in doc_uni/. It is written in reStructuredText and compiled by sphinx.

Linux dependencies:

sudo apt install python3-stemmer qttranslations5-l10n

On any OS (python3 must be installed):

pip3 install -U sphinx sphinx-mathjax-offline sphinx_intl

To generate the html pages for every supported language:

On Linux:

./build_doc.sh

On Windows:

build_doc.bat

11.5.2. Math documentation

The math documentation is in doc_math/, written in LaTeX.

Linux dependencies:

sudo apt install texlive-latex-extra texlive-lang-french

To generate de pdf file:

make