DGtal  0.6.devel
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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

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 need these dependencies too:

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

Build on Linux-based distributions

From a clean Ubuntu installation, you can download and install all dependencies using:

sudo apt-get install cmake g++ libboost-dev libboost-program-options-dev
sudo apt-get install libgmp-dev libcairo2-dev libqglviewer-qt4-dev
libgraphicsmagick++1-dev libinsighttoolkit3-dev libgdcm2-dev doxygen graphviz

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

First of all,

To install DGtal dependencies, we can use any of the available package managers (MacPorts, Fink, Homebrew). However, for DGtal, we recommend to use Homebrew (simpler, faster, ...):

From a clean Mac OS X Lion (10.7) installation, you first need to do that to install all the dependencies:

brew install cmake doxygen graphviz boost
brew install gmp cairo libqglviewer graphicsmagick

Finally, for now, ITK is not available via Homebrew so you have to download this package and then do:

tar zxvf InsightToolkit-4.1.0.tar.gz
cd InsightToolkit-4.1.0
mkdir build
cd build
cmake ..
make
sudo make install

here 4.1.0 is an example but you may need to adjust the version number...

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.

Build on Windows / Visual Studio

First of all,

Procedure with Visual Studio Express 2008 and 32 bit libraries

Procedure with Visual Studio Express 2010 and 64 bit libraries

Cairo dependency

Because on Windows, Cairo dependencies are MSYS, curl, zlib, libpng, pixman and a bit long & not so easy to compile, we provide for you the Cairo library and headers files for vs2008-32 and for vs2010-64.

Then, finally, use the cmake Windows interface (cmake-gui) to generate your Visual Studio project. Again, a good practise is to specify a different build folder.

On windows, there are no specific locations in the folder tree where cmake could find the include files and DLLs shared libraries of the DGtal dependencies. Hence, you will have to manually set the paths to find the dependencies.

For example, with cmake-gui,

Important:

Once the Visual Studio project as been created, you just have to simply open it with VS and compile it (but for the moment there are still compilation errors on Windows with some modules...).

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: