44 lines
627 B
Bash
44 lines
627 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
set -e
|
||
|
|
||
|
run_exe=0
|
||
|
|
||
|
## Ensure first argument is correct
|
||
|
if [ "$1" = "debug" ]; then
|
||
|
debug=1
|
||
|
elif [ "$1" = "release" ]; then
|
||
|
debug=0
|
||
|
else
|
||
|
echo "Run as '$0 debug' or '$0 release'"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
## Ensure second argument is correct
|
||
|
if [ "$2" = "run" ]; then
|
||
|
run_exe=1
|
||
|
fi
|
||
|
|
||
|
## Ensure its run in the right place
|
||
|
if ! [ -f "CMakeLists.txt" ]; then
|
||
|
echo "Run in the project root"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
mkdir -p build
|
||
|
cd build || exit
|
||
|
|
||
|
if [ ${debug} -eq 1 ]; then
|
||
|
cmake -DCMAKE_BUILD_TYPE=debug ..
|
||
|
else
|
||
|
cmake -DCMAKE_BUILD_TYPE=release ..
|
||
|
fi
|
||
|
|
||
|
make
|
||
|
|
||
|
if [ ${run_exe} -eq 1 ]; then
|
||
|
./simworld
|
||
|
fi
|
||
|
|
||
|
cd ..
|