forked from luigifreda/plvs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_thirdparty.sh
executable file
·269 lines (222 loc) · 8.21 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
#!/usr/bin/env bash
. config.sh # source configuration file and utils
# ====================================================
print_blue '================================================'
print_blue "Building Thirdparty"
print_blue '================================================'
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) # get script dir (this should be the main folder directory of PLVS)
SCRIPT_DIR=$(readlink -f $SCRIPT_DIR) # this reads the actual path if a symbolic directory is used
cd $SCRIPT_DIR # this brings us in the actual used folder (not the possibly symbolic one)
#echo "current dir: $SCRIPT_DIR"
UBUNTU_VERSION=$(lsb_release -a 2>&1) # to get ubuntu version
# ====================================================
# check if we have external options
EXTERNAL_OPTION=$1
if [[ -n "$EXTERNAL_OPTION" ]]; then
echo "external option: $EXTERNAL_OPTION"
fi
# check if we set a C++ standard
if [[ -n "$CPP_STANDARD_VERSION" ]]; then
echo "CPP_STANDARD_VERSION: $CPP_STANDARD_VERSION"
EXTERNAL_OPTION="$EXTERNAL_OPTION -DCPP_STANDARD_VERSION=$CPP_STANDARD_VERSION"
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
# check CUDA options
if [ $USE_CUDA -eq 1 ]; then
echo "USE_CUDA: $USE_CUDA"
EXTERNAL_OPTION="$EXTERNAL_OPTION -DWITH_CUDA=ON"
fi
if [[ $OPENCV_VERSION == 4* ]]; then
EXTERNAL_OPTION="$EXTERNAL_OPTION -DOPENCV_VERSION=4"
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 --recursive https://github.com/stevenlovegrove/Pangolin.git
#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
#cmake .. -DCMAKE_BUILD_TYPE=Release -DAVFORMAT_INCLUDE_DIR="" -DCPP11_NO_BOOST=ON $EXTERNAL_OPTION
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/DBoW2 ..."
cd Thirdparty/DBoW2
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
cd $SCRIPT_DIR
print_blue '================================================'
print_blue "Configuring and building Thirdparty/g2o ..."
cd Thirdparty/g2o
if [ ! -d build ]; then
sudo apt-get install -y libsuitesparse-dev libeigen3-dev
fi
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
cd $SCRIPT_DIR
./install_local_g2o_new.sh $EXTERNAL_OPTION
print_blue '================================================'
print_blue "Configuring and building Thirdparty/volumetric_mapping ... "
cd Thirdparty/volumetric_mapping
if [ ! -d build ]; then
sudo apt-get install -y libgoogle-glog-dev
fi
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
cd $SCRIPT_DIR
print_blue '================================================'
print_blue "Configuring and building Thirdparty/open_chisel ... "
cd Thirdparty/open_chisel
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
cd $SCRIPT_DIR
print_blue '================================================'
print_blue "Configuring and building Thirdparty/chisel_server ... "
cd Thirdparty/chisel_server
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
cd $SCRIPT_DIR
print_blue '================================================'
print_blue "Configuring and building Thirdparty/fastfusion ... "
HAVE_SSE4=$(gcc -march=native -dM -E - </dev/null | grep SSE4 || :)
HAVE_AVX=$(gcc -march=native -dM -E - </dev/null | grep AVX || : )
if [[ -n "$HAVE_SSE4" ]] || [[ -n "$HAVE_AVX" ]] ; then
echo "Configuring and building Thirdparty/fastfusion ... "
cd Thirdparty/fastfusion
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
fi
cd $SCRIPT_DIR
print_blue '================================================'
print_blue "Configuring and building Thirdparty/voxblox ... "
cd Thirdparty/voxblox
if [ ! -d build ]; then
sudo apt-get install -y libprotobuf-dev protobuf-compiler
fi
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
# HACK (to be fixed inside cmake) copy the protobuffer files in the include folder
if [ ! -f Thirdparty/voxblox/include/Block.pb.h ] && [ ! -f Thirdparty/voxblox/include/Layer.pb.h ] ; then
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
fi
cd $SCRIPT_DIR
print_blue '================================================'
print_blue "Configuring and building Thirdparty/voxblox_sever ... "
cd Thirdparty/voxblox_server
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
cd $SCRIPT_DIR
print_blue '================================================'
if [[ -n "$HAVE_SSE3" ]]; then
echo "Configuring and building Thirdparty/libelas-gpu ... "
cd Thirdparty/libelas-gpu
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
fi
cd $SCRIPT_DIR
print_blue '================================================'
if [ $CUDA_FOUND -eq 1 ]; then
echo "Configuring and building Thirdparty/stereo_libsgm... "
cd Thirdparty/libsgm
if [ ! -d build ]; then
if [[ $UBUNTU_VERSION == *"18.04"* ]] ; then
sudo apt-get install -y libglfw3-dev
fi
if [[ $UBUNTU_VERSION == *"20.04"* ]] ; then
sudo apt-get install -y libglfw3-dev
sudo apt-get install -y libxxf86vm-dev
fi
fi
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
fi
cd $SCRIPT_DIR
print_blue '================================================'
print_blue "Configuring and building Thirdparty/line_descriptor ... "
cd Thirdparty/line_descriptor
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION
make -j 8
cd $SCRIPT_DIR
print_blue '================================================'
print_blue "Checking pip and evo package for odometry evaluation... "
DO_INSTALL_PIP=$(check_package python3-pip)
if [ $DO_INSTALL_PIP -eq 1 ] ; then
echo "installing pip"
sudo apt-get install -y python3-pip
fi
# original package from https://github.com/MichaelGrupp/evo
# https://github.com/MichaelGrupp/evo/wiki/evo_traj
DO_INSTALL_EVO=$(check_pip_package evo)
if [ $DO_INSTALL_EVO -eq 1 ] ; then
echo "installing evo package"
pip install matplotlib --upgrade
pip install pandas --upgrade
pip install evo --upgrade --no-binary evo --user
fi
if [ $USE_OAK -eq 1 ]; then
print_blue '================================================'
print_blue "Configuring and building Thirdparty/depthai-core ... "
BUILD_EXAMPLES=ON # enable/disable building the examples
cd Thirdparty
if [ ! -d depthai-core ]; then
sudo apt install -y libspdlog-dev libbz2-dev liblzma-dev
git clone --recursive https://github.com/luxonis/depthai-core.git depthai-core
cd depthai-core
git checkout 6b5093dd3d51bdb19c019b47af4e6a226051ab99
git apply ../depthai-core.patch # applied to commit 6b5093dd3d51bdb19c019b47af4e6a226051ab99
cd ..
fi
if [ ! -f depthai-core/build/libdepthai-core.a ]; then
cd depthai-core
make_buid_dir
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release $EXTERNAL_OPTION -DDEPTHAI_BUILD_EXAMPLES=$BUILD_EXAMPLES -DCMAKE_POSITION_INDEPENDENT_CODE=ON #-DCMAKE_POSITION_INDEPENDENT_CODE=ON #-DCONFIG_MODE=ON #-DCMAKE_CXX_FLAGS+=-fPIC
make -j 8
cd $SCRIPT_DIR
fi
fi