DGtal  0.9.3
Building DGtal

Table of Contents

Author(s) of this documentation:
David Coeurjolly - Martial Tola

This part of the manual describes how to build DGtal on Linux, Mac OS X and Windows.

Introduction and first build

The DGtal library uses cmake to manage the project build on various systems.

To build DGtal in is minimal configuration, you need at least these dependencies:

To build DGtal in is full configuration, you may need these dependencies too:

If you want to generate the documentation, you would need:

Build on Linux-based distributions

To build DGtal from the source archive, we use the CMake tool to generate a Makefile or a project file for various IDE (KDevelop, Xcode, Codeblock...). In most linux distributions, all mandatory and optional dependencies are available as packages (debian, ubuntu, ...). Please refer to your package manager to find the appropriate package name and versions.

An important feature of cmake is the "out-of-source" build process. Let us suppose that DGtal sources are in the DGTALSOURCES folder. Hence, in a terminal you can create a build folder:

cd DGTALSOURCES
mkdir build
cd build

Next, use the cmake command to generate your Unix Makefile project (default generator on Unix/Linux) like below for the minimal DGtal configuration:

cmake ..

For the full DGtal configuration, you have to set these options with cmake:

cmake .. -DWITH_GMP=true -DWITH_ITK=true -DWITH_CAIRO=true -DWITH_QGLVIEWER=true -DWITH_MAGICK=true

If no error occurs, you can build the DGtal lib and install it:

make
sudo make install

Build on Mac OS X

Then, since recent Mac OS systems are unix-like operating systems, the easiest way to compile DGtal with cmake/make is to follow Linux-based instructions from source code archive.

If you use Homebrew package manager on Mac, DGtal is available in the package repository:

brew install dgtal

and to get build options:

brew options dgtal

Main DGtal cmake options

In DGtal CMakeLists.txt, several options can be specified to custom the library build. First, cmake has predefined build options (CMAKE_BUILD_TYPE) such as:

Beside these options, user can also specify these options:

Build on Windows / Visual Studio

DGtal core library compiles on Windows using Visual Studio 2015 or newer (note that building DGtal on cygwin or MinGW environments is trivial using linux based build). Since DGtal requires C++11 features since release 0.9.1, compiling the library with older Visual Studio compilers is not supported.

To generate the Visual Studio project, use the cmake (or cmake-gui) tools with recent Visual Studio target. During the project generation, you would have to specify the path to boost headers (or paths needed for any optional dependency such as GMP, CGAL, Cairo...).

Note
Do not forget to set BUILD_SHARED_LIBS cmake to false (static DGtal lib target).
Advanced:
When working on DGtal within github, we have set up a Windows container (using appeveyor for continuous integration. In the "appeveyor.yml" script, you would find information about how we compile the DGtal library on this windows environnement.