build.sh 739 Bytes
Newer Older
Michal Kravcenko's avatar
Michal Kravcenko committed
1
#!/bin/sh
2

Martin Mrovec's avatar
Martin Mrovec committed
3 4 5 6 7
#------------#------------------------------------------------------------
# Parameters #
#------------#

# Build type (Release/Debug)
8
BUILD_TYPE=
Martin Beseda's avatar
Martin Beseda committed
9 10

# C++ compiler
11
CXX_COMPILER=
Martin Mrovec's avatar
Martin Mrovec committed
12

13 14 15 16
if [ -z "$BUILD_TYPE" ] || [ -z "$CXX_COMPILER" ]; then
    (>&2 echo "Set, please, both BUILD_TYPE and CXX_COMPILER variables in the 'build.sh' script.")
    exit 2
fi
17 18

$(pwd)/clean.sh
Michal Kravcenko's avatar
Michal Kravcenko committed
19
cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_COMPILER=${CXX_COMPILER} .
20
cmake --build . --config ${BUILD_TYPE} -- -j${N_CORES} && (tput setaf 2; echo "Build complete."; echo "For examples have a look at the folder build/bin/examples."; tput sgr 0; ) || (tput setaf 1; echo "Build finished with errors!"; tput sgr 0; exit 1;)