2019-04-25 12:29:28 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-09-30 17:06:14 +00:00
|
|
|
set -e
|
2016-12-17 04:19:55 +00:00
|
|
|
|
2019-08-24 13:00:04 +00:00
|
|
|
#ccache -s # uncomment to display CCache statistics
|
2018-02-12 15:42:27 +00:00
|
|
|
mkdir -p /server/build_docker
|
|
|
|
cd /server/build_docker
|
2020-09-30 17:06:14 +00:00
|
|
|
cmake -G Ninja /server "-DCMAKE_C_COMPILER=$(command -v gcc-9)" "-DCMAKE_CXX_COMPILER=$(command -v g++-9)"
|
2018-09-22 16:13:13 +00:00
|
|
|
|
|
|
|
# Set the number of build jobs to the half of number of virtual CPU cores (rounded up).
|
|
|
|
# By default, ninja use all virtual CPU cores, that leads to very high memory consumption without much improvement in build time.
|
|
|
|
# Note that modern x86_64 CPUs use two-way hyper-threading (as of 2018).
|
|
|
|
# Without this option my laptop with 16 GiB RAM failed to execute build due to full system freeze.
|
|
|
|
NUM_JOBS=$(( ($(nproc || grep -c ^processor /proc/cpuinfo) + 1) / 2 ))
|
|
|
|
|
|
|
|
ninja -j $NUM_JOBS && env TEST_OPT="--skip long compile $TEST_OPT" ctest -V -j $NUM_JOBS
|