aboutsummaryrefslogtreecommitdiff
path: root/tests/travis/build-and-test
blob: 2d47e0755fb309f879ffa1a7473f42f25778961e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
set -e

HOST_SYSTEM=$(uname -s)
CMAKE_ARGS="-DBUILD_TESTS:BOOL=True"

case "$CONFIG" in
full*)
    CMAKE_ARGS="-DBUILD_DOCUMENTATION:BOOL=True -DBUILD_EXAMPLES:BOOL=True -DWITH_GSTREAMER:BOOL=True"
    ;;
esac

case "$CONFIG" in
*debug*)
    CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=Debug -DBUILD_INTERNAL_TESTS:BOOL=True"
    ;;
esac

# build with code coverage
if [ "$CONFIG" = "full-debug" ]; then
    export CXXFLAGS="-fprofile-arcs -ftest-coverage"
fi

# compile
mkdir build
cd build
cmake .. $CMAKE_ARGS

if [ $HOST_SYSTEM = "Darwin" ]; then
    make -k -j$(sysctl -n hw.logicalcpu)
else
    make -k -j$(nproc)
fi

# run tests
make test