forked from MRPT/mrpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis_main.sh
executable file
·104 lines (82 loc) · 1.95 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
#!/bin/bash
set -e # Make sure any error makes the script to return an error code
if [ "$CC" == "gcc" ]; then
export CC=gcc-7
export CXX=g++-7
fi
if [ "$CC" == "clang" ]; then
export CC=clang-6.0
export CXX=clang++-6.0
fi
ORIG_MRPT_DIR=`pwd`
MRPT_DIR=/mrpt
BUILD_DIR=/build
CMAKE_C_FLAGS="-Wall -Wextra -Wabi=11"
CMAKE_CXX_FLAGS="-Wall -Wextra -Wabi=11"
EXTRA_CMAKE_ARGS=""
function install_lint_reqs()
{
pip3 install -r travis/python_reqs.txt
}
# arguments: extra CMAKE flags to append to common ones
function do_generate_makefile()
{
# prepare_build_dir
# Make sure we dont have spurious files:
cd $ORIG_MRPT_DIR
git clean -fd || true
rsync -av --exclude=.git $ORIG_MRPT_DIR /
cd $MRPT_DIR
rm -fr $BUILD_DIR || true
mkdir -p $BUILD_DIR
cd $BUILD_DIR
if [ "$DEPS" == "minimal" ]; then
DOWNLOAD_EIGEN_FLAG="-DEIGEN_USE_EMBEDDED_VERSION=ON"
else
DOWNLOAD_EIGEN_FLAG=""
fi
# configure cmake:
VERBOSE=1 cmake $MRPT_DIR \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
$EXTRA_CMAKE_ARGS $DOWNLOAD_EIGEN_FLAG $@
}
function build ()
{
if [ "$DEPS" == "minimal" ]; then
DISABLE_PYTHON_BINDINGS=ON
else
DISABLE_PYTHON_BINDINGS=OFF
fi
# regenerate makefiles only on stage 1
if [ "$STAGE" == "1" ]; then
do_generate_makefile \
-DBUILD_EXAMPLES=On \
-DBUILD_TESTING=On \
-DENABLE_COVERAGE=On \
-DDISABLE_PYTHON_BINDINGS=$DISABLE_PYTHON_BINDINGS
fi
cd $BUILD_DIR
make -j2 $BUILD_TARGET
cd $MRPT_DIR
}
command_exists () {
type "$1" &> /dev/null ;
}
function test ()
{
cd $BUILD_DIR
# gcc is too slow and we have a time limit in Travis CI:
if [ "$CC" == "gcc" ] && [ "$TRAVIS_OS_NAME" == "osx" ]; then
return
fi
make -j2 tests_build_all
make CTEST_OUTPUT_ON_FAILURE=1 -j2 test
make -j2 gcov
cd $MRPT_DIR
bash <(curl -s https://codecov.io/bash) -X gcov -y .codecov.yml -s $BUILD_DIR
}
case $TASK in
build ) build;;
test ) test;;
lint ) install_lint_reqs;;
esac