blob: 2dda68fdacea7745cfbb8499b8d061aa1f585730 [file] [log] [blame]
Billy Donahuebbb54ef2015-08-31 02:19:39 -04001#!/usr/bin/env sh
Billy Donahue520d30c2015-08-31 09:54:37 -04002set -evx
Herbert Thielend96a0382017-09-04 18:19:06 +02003
Carlos O'Ryan75b85d52017-12-24 10:34:56 -05004. ci/get-nprocessors.sh
5
Herbert Thielend96a0382017-09-04 18:19:06 +02006# 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
9if [ -x /usr/bin/getconf ]; then
Herbert Thielenfe973122017-09-04 18:56:52 +020010 NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
Herbert Thielend96a0382017-09-04 18:19:06 +020011else
Herbert Thielenfe973122017-09-04 18:56:52 +020012 NPROCESSORS=2
Herbert Thielend96a0382017-09-04 18:19:06 +020013fi
Herbert Thielenfe973122017-09-04 18:56:52 +020014# 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.
17if [ $NPROCESSORS -gt 4 ] ; then
18 echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4."
19 NPROCESSORS=4
20fi
21# Tell make to use the processors. No preceding '-' required.
22MAKEFLAGS="j${NPROCESSORS}"
Herbert Thielend96a0382017-09-04 18:19:06 +020023export MAKEFLAGS
24
Billy Donahuebbb54ef2015-08-31 02:19:39 -040025env | sort
26
Billy Donahuefbb0b962015-09-01 02:24:48 -040027mkdir build || true
Herbert Thielend33861d2017-08-29 17:41:26 +020028cd build
Billy Donahue6fc49052015-09-01 02:41:55 -040029cmake -Dgtest_build_samples=ON \
Billy Donahue6fc49052015-09-01 02:41:55 -040030 -Dgtest_build_tests=ON \
31 -Dgmock_build_tests=ON \
deki517b3bd2015-09-07 18:23:25 -040032 -DCMAKE_CXX_FLAGS=$CXX_FLAGS \
Herbert Thielencc246ec2017-08-30 11:59:36 +020033 -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
Herbert Thielend33861d2017-08-29 17:41:26 +020034 ..
Billy Donahuefefba422015-08-31 10:29:11 -040035make
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030036CTEST_OUTPUT_ON_FAILURE=1 make test