-
Notifications
You must be signed in to change notification settings - Fork 350
/
install_thirdparty.sh
executable file
·281 lines (215 loc) · 8.57 KB
/
install_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
#!/usr/bin/env bash
#set -e
# NOTE: If you get build errors related to python interpreter check under Linux then run the following command:
# export WITH_PYTHON_INTERP_CHECK=ON
# ====================================================
# import the utils
. bash_utils.sh
# ====================================================
print_blue '================================================'
print_blue "Building Thirdparty"
print_blue '================================================'
#echo ROOT_DIR: $ROOT_DIR
cd $ROOT_DIR # from bash_utils.sh
STARTING_DIR=`pwd` # this should be the main folder directory of the repo
# ====================================================
# check if want to use conda or venv
if [ -z $USING_CONDA_PYSLAM ]; then
if [[ -z "${USE_PYSLAM_ENV}" ]]; then
USE_PYSLAM_ENV=0
fi
if [ $USE_PYSLAM_ENV -eq 1 ]; then
. pyenv-activate.sh
fi
else
echo "Using conda pyslam..."
. pyenv-conda-activate.sh
fi
# ====================================================
# check if we have external options
EXTERNAL_OPTIONS=$@
if [[ -n "$EXTERNAL_OPTIONS" ]]; then
echo "external option: $EXTERNAL_OPTIONS"
fi
# check if we want to add a python interpreter check
if [[ -n "$WITH_PYTHON_INTERP_CHECK" ]]; then
echo "WITH_PYTHON_INTERP_CHECK: $WITH_PYTHON_INTERP_CHECK "
EXTERNAL_OPTIONS="$EXTERNAL_OPTIONS -DWITH_PYTHON_INTERP_CHECK=$WITH_PYTHON_INTERP_CHECK"
fi
OpenCV_DIR="$ROOT_DIR/thirdparty/opencv/install/lib/cmake/opencv4"
if [[ -d "$OpenCV_DIR" ]]; then
EXTERNAL_OPTIONS="$EXTERNAL_OPTIONS -DOpenCV_DIR=$OpenCV_DIR"
fi
echo "EXTERNAL_OPTIONS: $EXTERNAL_OPTIONS"
# ====================================================
CURRENT_USED_PYENV=$(get_virtualenv_name)
print_blue "currently used pyenv: $CURRENT_USED_PYENV"
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/orbslam2_features ..."
cd thirdparty/orbslam2_features
. build.sh $EXTERNAL_OPTIONS
cd $STARTING_DIR
print_blue '================================================'
print_blue "Configuring and building thirdparty/Pangolin ..."
make_dir thirdparty
INSTALL_PANGOLIN_ORIGINAL=0
cd thirdparty
if [ $INSTALL_PANGOLIN_ORIGINAL -eq 1 ] ; then
# N.B.: pay attention this will generate a module 'pypangolin' ( it does not have the methods dcam.SetBounds(...) and pangolin.DrawPoints(points, colors) )
if [ ! -d pangolin ]; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -y libglew-dev
fi
git clone https://github.com/stevenlovegrove/Pangolin.git pangolin
cd pangolin
git submodule init && git submodule update
cd ..
fi
cd pangolin
make_dir build
if [ ! -f build/src/libpangolin.so ]; then
cd build
cmake ../ -DAVFORMAT_INCLUDE_DIR="" -DCPP11_NO_BOOST=ON $EXTERNAL_OPTIONS
make -j8
cd build/src
ln -s pypangolin.*-linux-gnu.so pangolin.linux-gnu.so
fi
else
# N.B.: pay attention this will generate a module 'pangolin'
if [ ! -d pangolin ]; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -y libglew-dev
# git clone https://github.com/uoip/pangolin.git
# cd pangolin
# PANGOLIN_UOIP_REVISION=3ac794a
# git checkout $PANGOLIN_UOIP_REVISION
# cd ..
# # copy local changes
# rsync ./pangolin_changes/python_CMakeLists.txt ./pangolin/python/CMakeLists.txt
git clone --recursive https://gitlab.com/luigifreda/pypangolin.git pangolin
fi
if [[ "$OSTYPE" == "darwin"* ]]; then
git clone --recursive https://gitlab.com/luigifreda/pypangolin.git pangolin
fi
cd pangolin
git apply ../pangolin.patch
cd ..
fi
cd pangolin
if [ ! -f pangolin.cpython-*.so ]; then
make_dir build
cd build
cmake .. -DBUILD_PANGOLIN_LIBREALSENSE=OFF -DBUILD_PANGOLIN_LIBREALSENSE2=OFF \
-DBUILD_PANGOLIN_OPENNI=OFF -DBUILD_PANGOLIN_OPENNI2=OFF \
-DBUILD_PANGOLIN_FFMPEG=OFF -DBUILD_PANGOLIN_LIBOPENEXR=OFF $EXTERNAL_OPTIONS # disable realsense
make -j8
cd ..
#python setup.py install
fi
fi
cd $STARTING_DIR
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/g2o ..."
cd thirdparty
if [ ! -d g2opy ]; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -y libsuitesparse-dev libeigen3-dev
fi
git clone https://github.com/uoip/g2opy.git
cd g2opy
G2OPY_REVISION=5587024
git checkout $G2OPY_REVISION
git apply ../g2opy.patch
cd ..
fi
cd g2opy
if [ ! -f lib/g2o.cpython-*.so ]; then
make_buid_dir
cd build
cmake .. $EXTERNAL_OPTIONS
make -j8
cd ..
#python3 setup.py install --user
fi
cd $STARTING_DIR
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/pydbow3 ..."
cd thirdparty/pydbow3
./build.sh $EXTERNAL_OPTIONS
cd $STARTING_DIR
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/pydbow2 ..."
cd thirdparty/pydbow2
./build.sh $EXTERNAL_OPTIONS
cd $STARTING_DIR
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/pyibow ..."
cd thirdparty/pyibow
./build.sh $EXTERNAL_OPTIONS
cd $STARTING_DIR
if [[ "$OSTYPE" == "darwin"* ]]; then
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/open3d ..."
# NOTE: Under mac I got segmentation faults when trying to use open3d python bindings
# This happends when trying to load the open3d dynamic library.
./install_open3d_python.sh
cd $STARTING_DIR
fi
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/ml_depth_pro ..."
cd thirdparty
if [ ! -d ml_depth_pro ]; then
git clone https://github.com/apple/ml-depth-pro.git ml_depth_pro
cd ml_depth_pro
#git checkout b2cd0d51daa95e49277a9f642f7fd736b7f9e91d # use this commit if you hit any problems
git apply ../ml_depth_pro.patch
source get_pretrained_models.sh # Files will be downloaded to `ml_depth_pro/checkpoints` directory.
fi
cd $STARTING_DIR
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/depth_anything_v2 ..."
cd thirdparty
if [ ! -d depth_anything_v2 ]; then
git clone https://github.com/DepthAnything/Depth-Anything-V2.git depth_anything_v2
cd depth_anything_v2
#git checkout 31dc97708961675ce6b3a8d8ffa729170a4aa273 # use this commit if you hit any problems
git apply ../depth_anything_v2.patch
./download_metric_models.py
fi
cd $STARTING_DIR
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/raft_stereo ..."
cd thirdparty
if [ ! -d raft_stereo ]; then
git clone https://github.com/princeton-vl/RAFT-Stereo.git raft_stereo
cd raft_stereo
#git checkout 6068c1a26f84f8132de10f60b2bc0ce61568e085 # use this commit if you hit any problems
git apply ../raft_stereo.patch
./download_models.sh
fi
cd $STARTING_DIR
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/crestereo ..."
cd thirdparty
if [ ! -d crestereo ]; then
git clone https://github.com/megvii-research/CREStereo.git crestereo
cd crestereo
#git checkout ad3a1613bdedd88b93247e5f002cb7c80799762d # use this commit if you hit any problems
git apply ../crestereo.patch
./download_models.py
fi
cd $STARTING_DIR
print_blue "=================================================================="
print_blue "Configuring and building thirdparty/crestereo_pytorch ..."
cd thirdparty
if [ ! -d crestereo_pytorch ]; then
git clone https://github.com/ibaiGorordo/CREStereo-Pytorch.git crestereo_pytorch
cd crestereo_pytorch
#git checkout b6c7a9fe8dc2e9e56ba7b96f4677312309282d15 # use this commit if you hit any problems
git apply ../crestereo_pytorch.patch
./download_models.py
fi
cd $STARTING_DIR
echo "...done with thirdparty"
# NOTE: If you get build errors related to python interpreter check under Linux then run the following command:
# export WITH_PYTHON_INTERP_CHECK=ON