/
travis_main.sh
executable file
·114 lines (93 loc) · 2.66 KB
/
travis_main.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
#!/bin/bash
set -e # Make sure any error makes the script to return an error code
MRPT_DIR=`pwd`
BUILD_DIR=build
CMAKE_C_FLAGS="-Wall -Wextra -Wabi -O2"
CMAKE_CXX_FLAGS="-Wall -Wextra -Wabi -O2"
EXTRA_CMAKE_ARGS="-DDISABLE_PCL=ON" # PCL causes link errors (?!)
function prepare_install()
{
apt-get install build-essential software-properties-common gcc g++ clang pkg-config cmake python-pip -y
apt-get install git-core -y
apt-get install ccache -y
if [ "$TASK" == "lint" ]; then
pip install -r travis/python_reqs.txt
fi
if [ "$DEPS" != "minimal" ]; then
apt-get install libftdi-dev zlib1g-dev libusb-1.0-0-dev libdc1394-22-dev -y
apt-get install libjpeg-dev libopencv-dev libgtest-dev libeigen3-dev -y
apt-get install libsuitesparse-dev libopenni2-dev libudev-dev -y
apt-get install libboost-python-dev libpython-dev python-numpy -y
# We must use a custom PPA to solve errors in PCL official pkgs
add-apt-repository ppa:jolting/backport-mrpt
apt-get update -qq
apt-get install libpcl-dev -y
if [ "$DEPS" != "headless" ]; then
apt-get install libwxgtk3.0-dev -y
apt-get install freeglut3-dev -y
apt-get install libavformat-dev libswscale-dev -y
apt-get install libassimp-dev -y
apt-get install qtbase5-dev libqt5opengl5-dev -y
fi
fi
}
function prepare_build_dir()
{
# Make sure we dont have spurious files:
cd $MRPT_DIR
git clean -fd || true
rm -fr $BUILD_DIR || true
mkdir -p $BUILD_DIR
cd $BUILD_DIR
}
function build ()
{
prepare_build_dir
# gcc is too slow and we have a time limit in Travis CI: exclude examples when building with gcc
if [ "$CC" == "gcc" ]; then
BUILD_EXAMPLES=FALSE
else
BUILD_EXAMPLES=TRUE
fi
if [ "$DEPS" == "minimal" ]; then
DISABLE_PYTHON_BINDINGS=ON
else
DISABLE_PYTHON_BINDINGS=OFF
fi
VERBOSE=1 cmake $MRPT_DIR \
-DBUILD_EXAMPLES=$BUILD_EXAMPLES \
-DBUILD_APPLICATIONS=TRUE \
-DBUILD_TESTING=FALSE \
-DDISABLE_PYTHON_BINDINGS=$DISABLE_PYTHON_BINDINGS \
$EXTRA_CMAKE_ARGS
make -j3
cd $MRPT_DIR
}
command_exists () {
type "$1" &> /dev/null ;
}
function test ()
{
# gcc is too slow and we have a time limit in Travis CI:
if [ "$CC" == "gcc" ] && [ "$TRAVIS_OS_NAME" == "osx" ]; then
return
fi
prepare_build_dir
cmake $MRPT_DIR \
-DBUILD_APPLICATIONS=FALSE \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
$EXTRA_CMAKE_ARGS
# Remove gdb use for coverage test reports.
# Use `test_gdb` to show stack traces of failing unit tests.
# if command_exists gdb ; then
# make test_gdb
# else
make test
# fi
cd $MRPT_DIR
}
prepare_install
case $TASK in
build ) build;;
test ) test;;
esac