You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
759 B
Bash
40 lines
759 B
Bash
|
1 year ago
|
#!/bin/sh
|
||
|
|
# This script expects to be run from the parent directory
|
||
|
|
# ex. scripts/config.sh
|
||
|
|
|
||
|
|
#Colors
|
||
|
|
RED='\033[0;31m'
|
||
|
|
GREEN='\033[0;32m'
|
||
|
|
NC='\033[0m'
|
||
|
|
|
||
|
|
options=
|
||
|
|
build_type=-DCMAKE_BUILD_TYPE=Debug
|
||
|
|
|
||
|
|
until [ "$1" = "" ]
|
||
|
|
do
|
||
|
|
|
||
|
|
if [ "$1" = "-r" ]
|
||
|
|
then
|
||
|
|
build_type=-DCMAKE_BUILD_TYPE=Release
|
||
|
|
|
||
|
|
elif [ "$1" = "-c" ]
|
||
|
|
then
|
||
|
|
rm -r build
|
||
|
|
mkdir build
|
||
|
|
else
|
||
|
|
options="$options -D$1=ON"
|
||
|
|
fi
|
||
|
|
|
||
|
|
shift
|
||
|
|
done
|
||
|
|
|
||
|
|
|
||
|
|
echo using options: $options
|
||
|
|
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang $build_type -Wno-dev $options -S . -B build/
|
||
|
|
|
||
|
|
if [ $? -eq 0 ]; then
|
||
|
|
echo "${GREEN}cmake config successful!${NC}"
|
||
|
|
else
|
||
|
|
echo "${RED}cmake config failed. Cleaning partial config.${NC}"
|
||
|
|
fi
|