| 1 | #!/bin/bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | pushd $PWD > /dev/null |
| 5 | cd $(dirname $0)/.. |
| 6 | SRC_DIR=$PWD |
| 7 | popd > /dev/null |
| 8 | |
| 9 | . $SRC_DIR/ci/lib/common.sh |
| 10 | |
| 11 | BUILD_DIR=$SRC_DIR/build |
| 12 | INSTALL_DIR=$SRC_DIR/inst |
| 13 | |
| 14 | BUILD_TYPE=Release |
| 15 | |
| 16 | BUILD_CMD="cmake --build . --config $BUILD_TYPE" |
| 17 | |
| 18 | echo_title Checking coding style |
| 19 | if has_command clang-format ; then |
| 20 | $SRC_DIR/ci/check-codingstyle |
| 21 | else |
| 22 | echo "Skipped, clang-format is not installed" |
| 23 | fi |
| 24 | |
| 25 | echo_title Configuring |
| 26 | mkdir $BUILD_DIR |
| 27 | cd $BUILD_DIR |
| 28 | cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR $SRC_DIR |
| 29 | |
| 30 | # Disabled for now |
| 31 | # echo_title Updating translations |
| 32 | # $BUILD_CMD --target lupdate |
| 33 | |
| 34 | echo_title Building |
| 35 | $BUILD_CMD --parallel $NPROC |
| 36 | |
| 37 | echo_title Running tests |
| 38 | test_cmd="$BUILD_CMD --target check" |
| 39 | if is_linux && [ -z "${DISPLAY:-}" ] ; then |
| 40 | xvfb-run $SRC_DIR/ci/headless-test-helper $test_cmd |
| 41 | else |
| 42 | $test_cmd |
| 43 | fi |
| 44 | |
| 45 | echo_title Installing |
| 46 | $BUILD_CMD --target install |
| 47 | |
| 48 | echo_title "Creating binary packages" |
| 49 | $BUILD_CMD --target package |
| 50 | |
| 51 | if is_linux ; then |
| 52 | # No need to build the source package everywhere, arbitrarily decide to |
| 53 | # build it on Linux |
| 54 | echo_title "Creating source package" |
| 55 | $BUILD_CMD --target package_source |
| 56 | fi |