Building the Pastel library

Back to Pastel

This page describes how to build the Pastel library. This is only necessary if prebuilt binaries are not available for your platform at the main page. Pastel uses the Premake build-script generator to turn cross-platform building into a trivial task. Premake is a program, contained in a single executable, which reads in a generic build-script and outputs a tool-specific build-script.

Note: While the source code contains Visual Studio specific build files, you should ignore them, and follow the build process described here.

Build process

The steps to build Pastel are as follows:

1. Install external libraries

See the dependencies page.

2. Install Premake

Premake can be downloaded from here. You might want to make it so that it can be invoked from any location, or alternatively just copy it to the Pastel root directory.

3. Set the external library directories

In the Pastel root directory, open the file premake4.lua, and modify the directories to refer to the locations you installed the external libraries at in step 1.

-- The directory of the Boost library's source code.
-- The includes are of the form 'boost/static_assert.hpp'.
boostIncludeDir = "../boost_1_43_0"

-- The directory of the SDL library's header files.
-- The includes are of the form 'SDL.h'.
sdlIncludeDir = "../SDL-1.2.14/include"
sdlLibraryDir = "../SDL-1.2.14/lib"

-- The directory of the GLEW library's header files.
-- The includes are of the form 'glew.h'.
glewIncludeDir = "../glew-1.5.7/include"
glewLibraryDir = "../glew-1.5.7/lib"

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

In the Pastel root directory, type

premake4 action

where action describes the tool-set you want to generate the build-scripts for (Visual Studio, gcc and makefiles, etc.). To see the supported tool-sets, type

premake4 --help

5. Choose configuration and build

Go to the generated directory build/action/, where action is the tool-set you chose in step 4, choose the desired configuration, and start the build.

Configurations

Pastel comes with four different build configurations. These are:

The debug configuration enables debugging information and turns on all ASSERTs and PENSUREs. All other configurations disable debugging information. The develop version retains ASSERTs and PENSUREs, while release and release-without-openmp removes them. The release-without-openmp configuration is otherwise equivalent to release configuration, but disables OpenMP (e.g. when your tool-set does not support it, as is the case with Express versions of Visual Studio). Only the release configuration enables OpenMP.

Property / Config debug develop release release-without-openmp
ASSERT and PENSURE x x
OpenMP x
Debug information x

Building

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

Visual Studio

To build Pastel using Visual Studio:

Makefiles

To build Pastel using makefiles, type

make config=configuration

Where configuration is one of the configurations listed in the previous section. To obtain further information, type

make help

Output files

The libraries and executables will be written to the lib/ sub-directory of the build/action/ directory. The intermediate files, such as object files, will be written to the obj/ sub-directory of the build/action directory. The debug versions will be suffixed with _d, while the develop versions will be suffixed with _v.

Learn more

Build switches