2023-02-12 01:57:08 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
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:03:31 +01:00
|
|
|
while getopts "bdh" flag; do
|
2023-02-12 01:57:08 +01:00
|
|
|
case "$flag" in
|
|
|
|
d) build_db ;;
|
|
|
|
b) build ;;
|
|
|
|
h) echo "Use -b for build or -d for generating a compile_commands.json" ;;
|
|
|
|
?)
|
|
|
|
echo "script usage: $(basename \$0) [-b] [-d] [-h]" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2023-02-12 12:47:25 +01:00
|
|
|
exit 0
|