forked from luigifreda/slamplay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_thirdparty.sh
executable file
·352 lines (293 loc) · 10.1 KB
/
build_thirdparty.sh
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
#!/usr/bin/env bash
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$(readlink -f $SCRIPT_DIR) # this reads the actual path if a symbolic directory is used
. config.sh # source configuration file and utils
# ====================================================
print_blue '================================================'
print_blue "Building thirdparty"
print_blue '================================================'
version=$(lsb_release -a 2>&1)
# ====================================================
# check if we have external options
EXTERNAL_OPTION=$1
if [[ -n "$EXTERNAL_OPTION" ]]; then
echo "external option: $EXTERNAL_OPTION"
fi
# check the use of local opencv
if [[ -n "$OpenCV_DIR" ]]; then
echo "OpenCV_DIR: $OpenCV_DIR"
EXTERNAL_OPTION="$EXTERNAL_OPTION -DOpenCV_DIR=$OpenCV_DIR"
fi
if [[ $OPENCV_VERSION == 4* ]]; then
#echo " "
EXTERNAL_OPTION="$EXTERNAL_OPTION -DOPENCV_VERSION=4"
fi
# check CUDA options
if [ $USE_CUDA -eq 1 ]; then
echo "USE_CUDA: $USE_CUDA"
EXTERNAL_OPTION="$EXTERNAL_OPTION -DWITH_CUDA=ON"
fi
echo "external option: $EXTERNAL_OPTION"
# ====================================================
# install ubuntu dependancies!
#./install_dependencies.sh
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/pangolin ..."
cd thirdparty
if [ ! -d pangolin ]; then
sudo apt-get install -y libglew-dev
git clone https://github.com/stevenlovegrove/Pangolin.git pangolin
#git fetch --all --tags # to fetch tags
cd pangolin
#git checkout tags/v0.6
git checkout fe57db532ba2a48319f09a4f2106cc5625ee74a9
git apply ../pangolin.patch # applied to commit fe57db532ba2a48319f09a4f2106cc5625ee74a9
cd ..
fi
cd pangolin
make_buid_dir
if [[ ! -f build/src/libpangolin.so && ! -f build/libpango_core.so ]]; then
cd build
PANGOLIN_OPTIONS="-DBUILD_EXAMPLES=OFF"
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $PANGOLIN_OPTIONS $EXTERNAL_OPTION
make -j 8
make install
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/sophus ..."
cd thirdparty
if [ ! -d sophus ]; then
sudo apt-get install gfortran libc++-dev libgoogle-glog-dev libatlas-base-dev libsuitesparse-dev libceres-dev
sudo apt install libfmt-dev
git clone https://github.com/strasdat/Sophus.git sophus
#git fetch --all --tags # to fetch tags
cd sophus
git checkout 61f9a9815f7f5d4d9dcb7f4ad9f4f42ab3563108
git apply ../sophus.patch
cd ..
fi
# build is not required
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/ceres ..."
cd thirdparty
if [ ! -d ceres ]; then
git clone https://ceres-solver.googlesource.com/ceres-solver ceres
#git fetch --all --tags # to fetch tags
cd ceres
git checkout tags/2.1.0 # f68321e7de8929fbcdb95dd42877531e64f72f66
cd ..
fi
cd ceres
make_buid_dir
if [[ ! -f install/lib/libceres.a ]]; then
cd build
CERES_OPTIONS="-DBUILD_EXAMPLES=OFF"
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $CERES_OPTIONS $EXTERNAL_OPTION
make -j 8
make install
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/gtsam ..."
cd thirdparty
if [ ! -d gtsam ]; then
git clone https://github.com/borglab/gtsam.git gtsam
#git fetch --all --tags # to fetch tags
cd gtsam
git checkout tags/4.2a9
cd ..
fi
cd gtsam
make_buid_dir
if [[ ! -f install/lib/libgtsam.so ]]; then
cd build
# NOTE: gtsam has some issues when compiling with march=native option!
# https://groups.google.com/g/gtsam-users/c/jdySXchYVQg
# https://bitbucket.org/gtborg/gtsam/issues/414/compiling-with-march-native-results-in
GTSAM_OPTIONS="-DGTSAM_USE_SYSTEM_EIGEN=On -DGTSAM_BUILD_WITH_MARCH_NATIVE=Off"
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $GTSAM_OPTIONS $EXTERNAL_OPTION
make -j 8
make install
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/g2o ..."
cd thirdparty
if [ ! -d g2o ]; then
sudo apt install -y libqglviewer-dev-qt5 # to build g2o_viewer
git clone https://github.com/RainerKuemmerle/g2o.git g2o
#git fetch --all --tags # to fetch tags
cd g2o
git checkout tags/20230223_git
cd ..
fi
cd g2o
make_buid_dir
if [[ ! -f install/lib/libg2o_core.so ]]; then
cd build
G2O_OPTIONS="-DBUILD_WITH_MARCH_NATIVE=ON -DG2O_BUILD_EXAMPLES=OFF"
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $G2O_OPTIONS $EXTERNAL_OPTION
make -j 8
make install
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/mahi-gui ..."
cd thirdparty
if [ ! -d mahigui ]; then
git clone https://github.com/mahilab/mahi-gui.git mahigui
#git fetch --all --tags # to fetch tags
cd mahigui
git checkout c34f1e22041d5cb88edf76cce6cfe3f44f062581
git apply ../mahigui.patch
cd ..
fi
cd mahigui
make_buid_dir
if [[ ! -f install/lib/libmahi-gui.a ]]; then
cd build
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
make install
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/json ..."
cd thirdparty
if [ ! -d json ]; then
git clone https://github.com/nlohmann/json.git json
#git fetch --all --tags # to fetch tags
cd json
git checkout bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d # release/3.11.2'
cd ..
fi
cd json
make_buid_dir
if [[ ! -d install ]]; then
cd build
JSON_OPTIONS="-DJSON_BuildTests=OFF"
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $JSON_OPTIONS $EXTERNAL_OPTION
make -j 8
make install
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/sesync ..."
cd thirdparty
if [ ! -d sesync ]; then
sudo apt-get install build-essential cmake-gui libeigen3-dev liblapack-dev libblas-dev libsuitesparse-dev
git clone https://github.com/david-m-rosen/SE-Sync sesync
#git fetch --all --tags # to fetch tags
cd sesync
git checkout 9b631b6b82d8aa7d32ab846412ae1c070412b7b6
git submodule init
git submodule update
git apply ../sesync.patch
cd ..
fi
cd sesync/C++
make_buid_dir
if [[ ! -f build/lib/libSESync.so ]]; then
cd build
SESYNC_OPTIONS="-DENABLE_VISUALIZATION=ON"
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../../install" -DCMAKE_BUILD_TYPE=Release $SESYNC_OPTIONS $EXTERNAL_OPTION
make -j 8
#make install # unfortunately, sesync does not have any install target!
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/dbow3 ..."
cd thirdparty
if [ ! -d dbow3 ]; then
git clone https://github.com/rmsalinas/DBow3.git dbow3
#git fetch --all --tags # to fetch tags
cd dbow3
git checkout c5ae539abddcef43ef64fa130555e2d521098369
git apply ../dbow3.patch
cd ..
fi
cd dbow3
make_buid_dir
if [[ ! -d install ]]; then
cd build
DBOW3_OPTIONS="-DUSE_CONTRIB=ON" # If you have installed the OpenCV contrib_modules
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $DBOW3_OPTIONS $EXTERNAL_OPTION
make -j 8
make install
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/obindex2 ..."
cd thirdparty
if [ ! -d obindex2 ]; then
sudo apt-get install -y libboost-system-dev libboost-filesystem-dev
git clone https://github.com/emiliofidalgo/obindex2.git obindex2
cd obindex2
git checkout c79b76b849baf8fcd8246302daabe74059f9ed1c
git apply ../obindex2.patch
cd ..
fi
cd obindex2/lib
make_buid_dir
if [[ ! -d build/libobindex2.a ]]; then
cd build
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/ibow-lcd ..."
cd thirdparty
if [ ! -d ibow-lcd ]; then
sudo apt-get install -y libboost-system-dev libboost-filesystem-dev
git clone https://github.com/emiliofidalgo/ibow-lcd.git ibow-lcd
cd ibow-lcd
git checkout 0804b1eec5db88b3d252c02617b6c95b91ca0a96
git apply ../ibow-lcd.patch
cd ..
fi
cd ibow-lcd
make_buid_dir
if [[ ! -d build/liblcdetector.a ]]; then
cd build
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
fi
cd $SCRIPT_DIR
# ====================================================
print_blue '================================================'
print_blue "Configuring and building thirdparty/rerun ..."
cd thirdparty
if [ ! -d rerun ]; then
sudo apt-get install -y cargo
git clone https://github.com/rerun-io/rerun.git rerun
#git fetch --all --tags # to fetch tags
cd rerun
git checkout 0.14.1
cd ..
fi
cd rerun
make_buid_dir
if [[ ! -d install ]]; then
cd build
cmake .. -DCMAKE_INSTALL_PREFIX="`pwd`/../install" -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
make install
fi
cd $SCRIPT_DIR
# ====================================================
echo '================================================'