Building TIM

Back to TIM

This page describes how to build the TIM libraries.

Compiler

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

Operating system Compiler
Windows Visual Studio 2019 16.11.5 or later
Linux GCC 11 or later
Linux Clang ? or later
Mac OS X Xcode ? or later

If you also want to build the Matlab libraries, then the compiler version must match the version of the supported compiler in Matlab.

Build process

The steps to build TIM are as follows:

Clone Tim from github

cd ~
mkdir code
cd code
git clone https://github.com/kaba2/tim

Install external libraries

See the dependencies page.

Either install vcpkg:

cd tim
git clone https://github.com/microsoft/vcpkg
./vcpkg/bootstrap-vcpkg.sh
./vcpkg/vcpkg integrate bash

or alternatively create a symbolic link to an existing vcpkg:

ln -s ../pastel/vcpkg vcpkg

Modify the CMake build file

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

# The directory of the Matlab header files.
# The includes are of the form 'mex.h'.
set (MatlabIncludeDirectory /Applications/MATLAB_R2020b.app/extern/include)

Modify the paths to correspond to your directory structure.

Generate build-scripts using CMake

cmake -S . -DCMAKE_BUILD_TYPE=Release -B build

The build options are:

BuildLibraries
Whether to build TIM’s core libraries.
BuildMatlab
Whether to build TIM’s Matlab libraries.
BuildTests
Whether to build TIM’s test executables.

Note: 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.

Note: You can follow similar instructions to create a debug build instead.

Build

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

Visual Studio

To build TIM using Visual Studio:

Makefiles

To build TIM using makefiles, type

cd build    
make -j 4

in the release directory. The j option specifies that make should use 4 threads; this speeds the build with multi-core machines. Depending on the number of cores in your machine, you may want to increase or decrease this number.

Configurations

TIM comes with different build configurations which are to be passed to CMAKE_BUILD_TYPE when invoking CMake, as above. These are:

The Debug configuration enables debugging information, turns on all ASSERTs and PENSUREs, and disables multi-threaded processing. The Release configuration enables optimizations and multi-threaded processing. You may choose the debug configuration in the CMake GUI when generating the build-scripts. When using multi-configuration tools, such as Visual Studio, the debug configuration is selected inside the tool.

Output files

The libraries and executables are written under the bin/ directory. The intermediate files are written under the build/ directory.

Building TimMatlab

Files

Compiler setup