2016-06-28 21:53:08 +02:00
|
|
|
#!/bin/bash
|
2016-07-13 16:20:15 +02:00
|
|
|
|
|
|
|
# for executing in non travis environment
|
2016-11-20 22:57:19 +01:00
|
|
|
[ -z "$TRAVIS_OS_NAME" ] && TRAVIS_OS_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
2016-07-13 16:20:15 +02:00
|
|
|
|
2016-11-20 22:57:19 +01:00
|
|
|
PLATFORM=x86
|
|
|
|
BUILD_TYPE=Debug
|
2016-07-13 16:20:15 +02:00
|
|
|
|
2016-08-28 15:10:43 +02:00
|
|
|
# Detect number of processor cores
|
2016-11-20 22:57:19 +01:00
|
|
|
# default is 4 jobs
|
|
|
|
if [[ "$TRAVIS_OS_NAME" == 'osx' || "$TRAVIS_OS_NAME" == 'darwin' ]]
|
|
|
|
then
|
|
|
|
JOBS=$(sysctl -n hw.ncpu)
|
|
|
|
PLATFORM=osx
|
|
|
|
elif [[ "$TRAVIS_OS_NAME" == 'linux' ]]
|
|
|
|
then
|
|
|
|
JOBS=$(nproc)
|
2016-06-28 21:53:08 +02:00
|
|
|
fi
|
|
|
|
|
2016-08-30 23:10:10 +02:00
|
|
|
# compile prepare
|
2016-08-28 15:10:43 +02:00
|
|
|
mkdir build || exit 1
|
|
|
|
cd build
|
|
|
|
|
2016-08-30 23:10:10 +02:00
|
|
|
# Compile hyperion for tags
|
2016-11-20 22:57:19 +01:00
|
|
|
[ -n "${TRAVIS_TAG:-}" ] && BUILD_TYPE=Release
|
|
|
|
|
|
|
|
# Compile hyperion for cron - take default settings
|
2016-08-28 15:10:43 +02:00
|
|
|
|
2016-11-20 22:57:19 +01:00
|
|
|
# Compile for PR (no tag and no cron)
|
|
|
|
[ "${TRAVIS_EVENT_TYPE:-}" != 'cron' -a -z "${TRAVIS_TAG:-}" ] && PLATFORM=${PLATFORM}-dev
|
|
|
|
|
|
|
|
cmake -DPLATFORM=$PLATFORM -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/usr .. || exit 2
|
|
|
|
|
|
|
|
echo "compile jobs: ${JOBS:=4}"
|
|
|
|
make -j ${JOBS} || exit 3
|
|
|
|
|
|
|
|
# Build the package on Linux
|
|
|
|
if [[ $TRAVIS_OS_NAME == 'linux' ]]
|
|
|
|
then
|
|
|
|
make -j ${JOBS} package || exit 4
|
2016-06-28 21:53:08 +02:00
|
|
|
fi
|
2016-07-13 16:20:15 +02:00
|
|
|
|