summaryrefslogtreecommitdiff
path: root/ci/build
blob: 4baeded49689670290d8e848462746c6920b91ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
#
# This script is used by .travis.yml and build-in-docker.

set -eu

if [ -n "${VERBOSE:-}" ]; then
    set -x
fi

if [ -n "${SPECIAL:-}" ]; then
    exec "ci/$SPECIAL"
else
    [ -z ${JOBS:+x} ] && JOBS=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
    [ -z ${JOBS:+x} ] && JOBS=2

    mkdir -p ${BUILDDIR:-build}
    cd ${BUILDDIR:-build}
    ${CMAKE_PREFIX:-} cmake ${CMAKE_PARAMS:-} ${CCACHE_LOC:-..}
    ${CMAKE_PREFIX:-} cmake --build . ${BUILDEXTRAFLAGS:-} -- -j$JOBS
    [ "${RUN_TESTS:-1}" -ne "1" ] || ctest --output-on-failure -j$JOBS "$@"
fi