Remove make_build macro
[platform/upstream/gtest.git] / ci / travis.sh
1 #!/usr/bin/env sh
2 set -evx
3
4 . ci/get-nprocessors.sh
5
6 # if possible, ask for the precise number of processors,
7 # otherwise take 2 processors as reasonable default; see
8 # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization
9 if [ -x /usr/bin/getconf ]; then
10     NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
11 else
12     NPROCESSORS=2
13 fi
14 # as of 2017-09-04 Travis CI reports 32 processors, but GCC build
15 # crashes if parallelized too much (maybe memory consumption problem),
16 # so limit to 4 processors for the time being.
17 if [ $NPROCESSORS -gt 4 ] ; then
18         echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
19         NPROCESSORS=4
20 fi
21 # Tell make to use the processors. No preceding '-' required.
22 MAKEFLAGS="j${NPROCESSORS}"
23 export MAKEFLAGS
24
25 env | sort
26
27 # Set default values to OFF for these variables if not specified.
28 : "${NO_EXCEPTION:=OFF}"
29 : "${NO_RTTI:=OFF}"
30 : "${COMPILER_IS_GNUCXX:=OFF}"
31
32 mkdir build || true
33 cd build
34 cmake -Dgtest_build_samples=ON \
35       -Dgtest_build_tests=ON \
36       -Dgmock_build_tests=ON \
37       -Dcxx_no_exception=$NO_EXCEPTION \
38       -Dcxx_no_rtti=$NO_RTTI \
39       -DCMAKE_COMPILER_IS_GNUCXX=$COMPILER_IS_GNUCXX \
40       -DCMAKE_CXX_FLAGS=$CXX_FLAGS \
41       -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
42       ..
43 make
44 CTEST_OUTPUT_ON_FAILURE=1 make test