forked from apache/brpc
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build_in_travis_ci.sh
59 lines (54 loc) · 1.36 KB
/
build_in_travis_ci.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
if [ -z "$PURPOSE" ]; then
echo "PURPOSE must be set"
exit 1
fi
if [ -z "$CXX" ]; then
echo "CXX must be set"
exit 1
fi
if [ -z "$CC" ]; then
echo "CC must be set"
exit 1
fi
runcmd(){
eval $@
[[ $? != 0 ]] && {
exit 1
}
return 0
}
echo "build combination: PURPOSE=$PURPOSE CXX=$CXX CC=$CC"
EXTRA_BUILD_OPTS=""
if [ "$USE_MESALINK" = "yes" ]; then
EXTRA_BUILD_OPTS="$EXTRA_BUILD_OPTS --with-mesalink"
fi
# The default env in travis-ci is Ubuntu.
if ! sh config_brpc.sh --headers=/usr/include --libs=/usr/lib --nodebugsymbols --cxx=$CXX --cc=$CC $EXTRA_BUILD_OPTS; then
echo "Fail to configure brpc"
exit 1
fi
if [ "$PURPOSE" = "compile" ]; then
make -j4 && sh tools/make_all_examples
elif [ "$PURPOSE" = "unittest" ]; then
# pass the unittest from default Makefile to accelerate build process
:
else
echo "Unknown purpose=\"$PURPOSE\""
fi
echo "start building by cmake"
rm -rf bld && mkdir bld && cd bld
if [ "$PURPOSE" = "compile" ]; then
if ! cmake ..; then
echo "Fail to generate Makefile by cmake"
exit 1
fi
make -j4
elif [ "$PURPOSE" = "unittest" ]; then
if ! cmake -DBUILD_UNIT_TESTS=ON ..; then
echo "Fail to generate Makefile by cmake"
exit 1
fi
make -j4 && cd test && sh ./run_tests.sh && cd ../
else
echo "Unknown purpose=\"$PURPOSE\""
fi