summaryrefslogtreecommitdiff
path: root/ci/build
blob: 3fe7e899ac65dcebf18a396ceb718cad3069bc61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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 . ${EXTRA_CMAKE_BUILD_FLAGS:-} -- -j$JOBS
    if [ "${RUN_TESTS:-1}" -eq 1 ]; then
        CC=${TEST_CC:-${CC}} ctest --output-on-failure -j$JOBS "$@"
    fi
fi