looper/build.sh

32 lines
609 B
Bash
Raw Normal View History

2024-08-08 13:12:37 -07:00
#!/bin/bash
export OLD_DIR="$(pwd)"
cmd_err() {
CUR_DIR="$(pwd)"
code=$1
echo "Error: Command exited with non-zero status ($code)" >&2
echo "Directory: $CUR_DIR"
echo "Command: $2" >&2
cd $OLD_DIR
exit $code
}
on_err() {
echo "Script error."
cmd_err "$?" "$BASH_COMMAND"
}
run_command() {
trap ERR
echo "$@" >&2
"$@"
code=$?
if [ $code -ne 0 ]; then
cmd_err "$code" "$*"
fi
trap on_err ERR
}
trap on_err ERR
mkdir -p build
cd build
run_command cmake .. -DDISABLE_GTK_UI=ON -DCMAKE_BUILD_TYPE=Debug
run_command cmake --build . "$@"
cd ..