forked from PointCloudLibrary/pcl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.sh
executable file
·333 lines (308 loc) · 8.72 KB
/
.travis.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
#!/bin/sh
PCL_DIR=`pwd`
BUILD_DIR=$PCL_DIR/build
DOC_DIR=$BUILD_DIR/doc/doxygen/html
TUTORIALS_DIR=$BUILD_DIR/doc/tutorials/html
ADVANCED_DIR=$BUILD_DIR/doc/advanced/html
CMAKE_C_FLAGS="-Wall -Wextra -Wabi -O2"
CMAKE_CXX_FLAGS="-Wall -Wextra -Wabi -O2"
DOWNLOAD_DIR=$HOME/download
export FLANN_ROOT=$HOME/flann
export VTK_DIR=$HOME/vtk
export QHULL_ROOT=$HOME/qhull
export DOXYGEN_DIR=$HOME/doxygen
function build ()
{
case $CC in
clang ) build_clang;;
gcc ) build_gcc;;
esac
}
function build_clang ()
{
# A complete build
# Configure
mkdir $BUILD_DIR && cd $BUILD_DIR
cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \
-DPCL_ONLY_CORE_POINT_TYPES=ON \
-DBUILD_global_tests=OFF \
$PCL_DIR
# Build
make -j2
}
function build_gcc ()
{
# A reduced build, only pcl_common
# Configure
mkdir $BUILD_DIR && cd $BUILD_DIR
cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \
-DPCL_ONLY_CORE_POINT_TYPES=ON \
-DBUILD_2d=OFF \
-DBUILD_features=OFF \
-DBUILD_filters=OFF \
-DBUILD_geometry=OFF \
-DBUILD_global_tests=OFF \
-DBUILD_io=OFF \
-DBUILD_kdtree=OFF \
-DBUILD_keypoints=OFF \
-DBUILD_ml=OFF \
-DBUILD_octree=OFF \
-DBUILD_outofcore=OFF \
-DBUILD_people=OFF \
-DBUILD_recognition=OFF \
-DBUILD_registration=OFF \
-DBUILD_sample_consensus=OFF \
-DBUILD_search=OFF \
-DBUILD_segmentation=OFF \
-DBUILD_stereo=OFF \
-DBUILD_surface=OFF \
-DBUILD_tools=OFF \
-DBUILD_tracking=OFF \
-DBUILD_visualization=OFF \
$PCL_DIR
# Build
make -j2
}
function test ()
{
# Configure
mkdir $BUILD_DIR && cd $BUILD_DIR
cmake -DCMAKE_C_FLAGS=$CMAKE_C_FLAGS \
-DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS \
-DPCL_ONLY_CORE_POINT_TYPES=ON \
-DBUILD_global_tests=ON \
-DPCL_NO_PRECOMPILE=ON \
$PCL_DIR
# Build and run tests
make tests
}
function doc ()
{
# Do not generate documentation for pull requests
if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then exit; fi
# Add installed doxygen to path and install sphinx
export PATH=$DOXYGEN_DIR/bin:$PATH
pip install --user sphinx pyparsing==2.1.9 sphinxcontrib-doxylink
# Configure
mkdir $BUILD_DIR && cd $BUILD_DIR
cmake -DDOXYGEN_USE_SHORT_NAMES=OFF \
-DSPHINX_HTML_FILE_SUFFIX=php \
-DWITH_DOCS=ON \
-DWITH_TUTORIALS=ON \
$PCL_DIR
git config --global user.email "[email protected]"
git config --global user.name "PointCloudLibrary (via TravisCI)"
if [ -z "$id_rsa_{1..23}" ]; then echo 'No $id_rsa_{1..23} found !' ; exit 1; fi
echo -n $id_rsa_{1..23} >> ~/.ssh/travis_rsa_64
base64 --decode --ignore-garbage ~/.ssh/travis_rsa_64 > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
cd $DOC_DIR
git clone [email protected]:PointCloudLibrary/documentation.git .
# Generate documentation and tutorials
cd $BUILD_DIR
make doc tutorials advanced
# Upload to GitHub if generation succeeded
if [[ $? == 0 ]]; then
# Copy generated tutorials to the doc directory
cp -r $TUTORIALS_DIR/* $DOC_DIR/tutorials
cp -r $ADVANCED_DIR/* $DOC_DIR/advanced
# Commit and push
cd $DOC_DIR
git add --all
git commit --amend -m "Documentation for commit $TRAVIS_COMMIT" -q
git push --force
else
exit 2
fi
}
function install_flann()
{
local pkg_ver=1.8.4
local pkg_file="flann-${pkg_ver}-src"
local pkg_url="http://people.cs.ubc.ca/~mariusm/uploads/FLANN/${pkg_file}.zip"
local pkg_md5sum="a0ecd46be2ee11a68d2a7d9c6b4ce701"
local FLANN_DIR=$HOME/flann
local config=$FLANN_DIR/include/flann/config.h
echo "Installing FLANN ${pkg_ver}"
if [[ -d $FLANN_DIR ]]; then
if [[ -e ${config} ]]; then
local version=`grep -Po "(?<=FLANN_VERSION_ \").*(?=\")" ${config}`
if [[ "$version" = "$pkg_ver" ]]; then
local modified=`stat -c %y ${config} | cut -d ' ' -f1`
echo " > Found cached installation of FLANN"
echo " > Version ${pkg_ver}, built on ${modified}"
return 0
fi
fi
fi
download ${pkg_url} ${pkg_md5sum}
if [[ $? -ne 0 ]]; then
return $?
fi
unzip -qq pkg
cd ${pkg_file}
mkdir build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$FLANN_DIR \
-DBUILD_MATLAB_BINDINGS=OFF \
-DBUILD_PYTHON_BINDINGS=OFF \
-DBUILD_CUDA_LIB=OFF \
-DBUILD_C_BINDINGS=OFF \
-DUSE_OPENMP=OFF
make -j2 && make install && touch ${config}
return $?
}
function install_vtk()
{
local pkg_ver=5.10.1
local pkg_file="vtk-${pkg_ver}"
local pkg_url="http://www.vtk.org/files/release/${pkg_ver:0:4}/${pkg_file}.tar.gz"
local pkg_md5sum="264b0052e65bd6571a84727113508789"
local VTK_DIR=$HOME/vtk
local config=$VTK_DIR/include/vtk-${pkg_ver:0:4}/vtkConfigure.h
echo "Installing VTK ${pkg_ver}"
if [[ -d $VTK_DIR ]]; then
if [[ -e ${config} ]]; then
local version=`grep -Po "(?<=VTK_VERSION \").*(?=\")" ${config}`
if [[ "$version" = "$pkg_ver" ]]; then
local modified=`stat -c %y ${config} | cut -d ' ' -f1`
echo " > Found cached installation of VTK"
echo " > Version ${pkg_ver}, built on ${modified}"
return 0
fi
fi
fi
download ${pkg_url} ${pkg_md5sum}
if [[ $? -ne 0 ]]; then
return $?
fi
tar xzf pkg
cd "VTK${pkg_ver}"
mkdir build && cd build
cmake .. \
-Wno-dev \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=$VTK_DIR \
-DBUILD_DOCUMENTATION=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF \
-DVTK_USE_BOOST=ON \
-DVTK_USE_CHARTS=ON \
-DVTK_USE_VIEWS=ON \
-DVTK_USE_RENDERING=ON \
-DVTK_USE_CHEMISTRY=OFF \
-DVTK_USE_HYBRID=OFF \
-DVTK_USE_PARALLEL=OFF \
-DVTK_USE_PATENTED=OFF \
-DVTK_USE_INFOVIS=ON \
-DVTK_USE_GL2PS=OFF \
-DVTK_USE_MYSQL=OFF \
-DVTK_USE_FFMPEG_ENCODER=OFF \
-DVTK_USE_TEXT_ANALYSIS=OFF \
-DVTK_WRAP_JAVA=OFF \
-DVTK_WRAP_PYTHON=OFF \
-DVTK_WRAP_TCL=OFF \
-DVTK_USE_QT=OFF \
-DVTK_USE_GUISUPPORT=OFF \
-DVTK_USE_SYSTEM_ZLIB=ON \
-DCMAKE_CXX_FLAGS="-D__STDC_CONSTANT_MACROS"
make -j2 && make install && touch ${config}
return $?
}
function install_qhull()
{
local pkg_ver=2012.1
local pkg_file="qhull-${pkg_ver}"
local pkg_url="http://www.qhull.org/download/${pkg_file}-src.tgz"
local pkg_md5sum="d0f978c0d8dfb2e919caefa56ea2953c"
local QHULL_DIR=$HOME/qhull
local announce=$QHULL_DIR/share/doc/qhull/Announce.txt
echo "Installing QHull ${pkg_ver}"
if [[ -d $QHULL_DIR ]]; then
if [[ -e ${announce} ]]; then
local version=`grep -Po "(?<=Qhull )[0-9.]*(?= )" ${announce}`
if [[ "$version" = "$pkg_ver" ]]; then
local modified=`stat -c %y ${announce} | cut -d ' ' -f1`
echo " > Found cached installation of QHull"
echo " > Version ${pkg_ver}, built on ${modified}"
return 0
fi
fi
fi
download ${pkg_url} ${pkg_md5sum}
if [[ $? -ne 0 ]]; then
return $?
fi
tar xzf pkg
cd ${pkg_file}
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS=-fPIC \
-DCMAKE_C_FLAGS=-fPIC \
-DCMAKE_INSTALL_PREFIX=$QHULL_DIR
make -j2 && make install && touch ${announce}
return $?
}
function install_doxygen()
{
local pkg_ver=1.8.9.1
local pkg_file="doxygen-${pkg_ver}"
local pkg_url="http://ftp.stack.nl/pub/users/dimitri/${pkg_file}.src.tar.gz"
local pkg_md5sum="3d1a5c26bef358c10a3894f356a69fbc"
local DOXYGEN_EXE=$DOXYGEN_DIR/bin/doxygen
echo "Installing Doxygen ${pkg_ver}"
if [[ -d $DOXYGEN_DIR ]]; then
if [[ -e $DOXYGEN_EXE ]]; then
local version=`$DOXYGEN_EXE --version`
if [[ "$version" = "$pkg_ver" ]]; then
local modified=`stat -c %y $DOXYGEN_EXE | cut -d ' ' -f1`
echo " > Found cached installation of Doxygen"
echo " > Version ${pkg_ver}, built on ${modified}"
return 0
fi
fi
fi
download ${pkg_url} ${pkg_md5sum}
if [[ $? -ne 0 ]]; then
return $?
fi
tar xzf pkg
cd ${pkg_file}
./configure --prefix $DOXYGEN_DIR
make -j2 && make install
return $?
}
function install_dependencies()
{
install_flann
install_vtk
install_qhull
install_doxygen
}
function download()
{
mkdir -p $DOWNLOAD_DIR && cd $DOWNLOAD_DIR && rm -rf *
wget --output-document=pkg $1
if [[ $? -ne 0 ]]; then
return $?
fi
if [[ $# -ge 2 ]]; then
echo "$2 pkg" > "md5"
md5sum -c "md5" --quiet --status
if [[ $? -ne 0 ]]; then
echo "MD5 mismatch"
return 1
fi
fi
return 0
}
case $1 in
install ) install_dependencies;;
build ) build;;
test ) test;;
doc ) doc;;
esac