2023-02-12 01:57:08 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-02-12 14:08:20 +01:00
|
|
|
function clean() {
|
|
|
|
cd gdextension || return 1
|
|
|
|
scons --clean
|
|
|
|
}
|
|
|
|
|
2023-02-12 01:57:08 +01:00
|
|
|
function build() {
|
2023-02-12 12:47:25 +01:00
|
|
|
cd gdextension || return 1
|
|
|
|
scons
|
|
|
|
cd ..
|
2023-02-12 01:57:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function build_db() {
|
2023-02-12 12:47:25 +01:00
|
|
|
cd gdextension || return 1
|
2023-02-12 01:57:08 +01:00
|
|
|
scons --clean
|
2023-02-12 12:47:25 +01:00
|
|
|
bear -- scons
|
|
|
|
|
|
|
|
if [ ! -d ../build ]; then
|
|
|
|
mkdir ../build
|
|
|
|
touch ../build/.gdignore
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f ../build/compile_commands.json ]; then
|
|
|
|
rm ../build/compile_commands.json
|
|
|
|
fi
|
|
|
|
|
|
|
|
cp compile_commands.json ../build/
|
|
|
|
|
|
|
|
cd ..
|
2023-02-12 01:57:08 +01:00
|
|
|
}
|
|
|
|
|
2023-02-12 14:08:20 +01:00
|
|
|
while getopts "bdch" flag; do
|
2023-02-12 01:57:08 +01:00
|
|
|
case "$flag" in
|
|
|
|
d) build_db ;;
|
|
|
|
b) build ;;
|
2023-02-12 14:08:20 +01:00
|
|
|
c) clean ;;
|
|
|
|
h) echo "Use -b for build , -d for generating a compile_commands.json or -c for cleaning" ;;
|
2023-02-12 01:57:08 +01:00
|
|
|
?)
|
2023-02-12 14:08:20 +01:00
|
|
|
echo "script usage: $(basename \$0) [-b] [-d] [-c] [-h]" >&2
|
2023-02-12 01:57:08 +01:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2023-02-12 12:47:25 +01:00
|
|
|
exit 0
|