This page describes how to build the TIM libraries.
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.
The steps to build TIM are as follows:
cd ~
mkdir code
cd code
git clone https://github.com/kaba2/tim
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
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.
cmake -S . -DCMAKE_BUILD_TYPE=Release -B build
The build options are:
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.
When CMake has generated you the build-scripts, you probably already know how to proceed. Here are some specific examples.
To build TIM using Visual Studio:
build/Tim.sln
.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.
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
ASSERT
s and PENSURE
s, 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.
The libraries and executables are written under the bin/
directory.
The intermediate files are written under the build/
directory.
tim/bin/msvc64-release
).matlab
.build_tim
in Matlab console. This produces tim_matlab.mexw64
(on Windows) or similar (on Linux or Mac).