-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuilding.txt
142 lines (95 loc) · 3.81 KB
/
building.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Building TIM
============
[[Parent]]: tim.txt
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][Dependencies] page.
[Dependencies]: [[Ref]]: dependencies.txt
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
[CMake]: https://cmake.org/download/
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:
* Open the Visual Studio project `build/Tim.sln`.
* Build solution (F7).
#### 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:
* Debug
* Release
* RelWithDebInfo
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.
Output files
------------
The libraries and executables are written under the `bin/` directory.
The intermediate files are written under the `build/` directory.
Building TimMatlab
------------------
* Open Matlab.
* Open the directory which contains the built libraries and executables (e.g. `tim/bin/msvc64-release`).
* Open subdirectory `matlab`.
* Execute `build_tim` in Matlab console. This produces `tim_matlab.mexw64` (on Windows) or similar (on Linux or Mac).