Building TIM

Back to TIM 1.2.0

This page describes how to build the TIM libraries. This is only necessary if prebuilt binaries are not available for your platform at the main page. TIM 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. The TIM Matlab interface requires an additional build step, since the final build must be done from Matlab. However, the first step is to build the TIM libraries.

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 TIM 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 TIM root directory.

3. Modify the Premake build file

In the TIM root directory, open the file premake4.lua, and scroll down to the section Paths. It will look something like this:

-- The directory of the Pastel library's source code.
-- The includes are of the form 'pastel/sys/array.h'
pastelIncludeDir = "../pastel"
pastelLibraryDir = "../pastel/build/vs2008/lib"

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

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

-- The directory of the Matlab header files.
-- The includes are of the form 'mex.h'.
matlabIncludeDir = "C:/Program Files/MATLAB/R2008a/extern/include"

Modify the directories to correspond to the locations you installed the external libraries in step 1. Now scroll up to the Main build switches section. It will look something like this:

-- Whether to build the libraries.
buildLibraries = true

-- Whether to build the tests.
buildTests = false

Here you may want to eliminate the SDL dependence by not building the tests.

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

In the TIM 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.


TIM 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
OpenMP x
Debug information x


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 TIM using Visual Studio:


To build TIM 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.