Building the Pastel library

Back to Pastel

This section describes how to build the Pastel library.


Since Pastel uses C++14, it requires a recent compiler to be built. The following work:

Build process

The steps to build Pastel are as follows:

1. Install external libraries

See the dependencies page.

2. Install CMake

Pastel uses the CMake build-script generator to abstract away the specifics of a given build-environment. CMake is a program which reads in a generic build-script and outputs a tool-specific build-script (e.g. Unix makefiles, Visual Studio projects, etc.)

CMake can be downloaded from here.

3. Set the external library directories

Modify the directories to refer to the locations you installed the external libraries at:

4. Generate tool-specific build-scripts using CMake.

Build options

Whether to build Pastel’s example executables.
Whether to build Pastel’s core libraries.
Whether to build Pastel’s Matlab libraries.
Whether to build Pastel’s test executables.


If you want to change the tool-set later, you need to remove the CMakeCache.txt file, and run these instructions again. The purpose of this file is to remember options so that they need not specified repeatedly.

Build type

For a single-configuration tool-set, such as makefiles, you choose a debug build by choosing Debug as the CMAKE_BUILD_TYPE in cmake-gui. For a multiple-configuration tool-set, such as Visual Studio or XCode, you choose the debug configuration from inside the IDE. Similarly for other build-types.


Pastel comes with the standard CMake build configurations, which are

The Debug configuration enables debugging information and ASSERTs and PENSUREs. The RelWithDebInfo configuration disables ASSERTs and PENSUREs, but enables debug information. The Release configuration disables both.

Property / Config Debug Release RelWithDebInfo
ENSURE x x x
Debug information x x


When CMake has generated the build-scripts, you probably already know how to proceed. However, here are some specific examples.


In the build/ directory, run

make -j 4

The j option specifies the number of threads to use in the building process. On multi-core machines this shortens the build-times dramatically.

Visual Studio

To build Pastel using Visual Studio:


To build Pastel in XCode 4:

Output files

The libraries will be placed in the lib/toolset/config directory, and the executables will be placed in the bin/toolset/config directory, where the toolset is the used tool-set, and config is the used configuration.

Learn more


Armadillo configuration

Blas configuration

Boost configuration

CMake utilities

Compiler setup

Lapack configuration

Matlab configuration

Tbb configuration