2024-09-25 16:51:39 +00:00
|
|
|
#!/bin/env sh
|
|
|
|
# townengine tooling interface
|
|
|
|
|
|
|
|
set +e
|
|
|
|
|
|
|
|
toolpath="$(dirname -- "${BASH_SOURCE[0]}")"
|
|
|
|
export TWNROOT=$(realpath "$toolpath"/../)
|
|
|
|
export TWNBUILDDIR=$(realpath "$toolpath"/../.build)
|
|
|
|
|
2024-10-07 11:16:53 +00:00
|
|
|
exe="$(basename $PWD)"
|
|
|
|
|
2024-09-25 16:51:39 +00:00
|
|
|
case "$1" in
|
2024-10-07 11:16:53 +00:00
|
|
|
build ) "$toolpath"/build.sh "${@:2}"
|
|
|
|
;;
|
|
|
|
|
2024-10-07 13:58:55 +00:00
|
|
|
run ) ./$exe "${@:2}"
|
|
|
|
;;
|
|
|
|
|
2024-10-07 11:16:53 +00:00
|
|
|
gdb ) unset DEBUGINFOD_URLS
|
|
|
|
gdb -ex run --args "$(basename $PWD)" "${@:2}"
|
|
|
|
;;
|
|
|
|
|
|
|
|
apitrace ) case "$2" in
|
|
|
|
take ) export ASAN_OPTIONS=verify_asan_link_order=0
|
|
|
|
export LD_PRELOAD="/usr/lib/libubsan.so /usr/lib/apitrace/wrappers/glxtrace.so $LD_PRELOAD"
|
|
|
|
./$exe "${@:3}"
|
|
|
|
;;
|
|
|
|
|
2024-10-07 16:18:38 +00:00
|
|
|
show ) traces=( $exe.*.trace )
|
2024-10-07 11:16:53 +00:00
|
|
|
trace=${traces[-1]}
|
|
|
|
if [ "$trace" = "$exe.*.trace" ]; then
|
|
|
|
trace="$exe.trace"
|
|
|
|
fi
|
|
|
|
qapitrace ${trace}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
2024-10-07 15:06:10 +00:00
|
|
|
api-gen ) "$toolpath"/gen_api_header.sh
|
|
|
|
;;
|
|
|
|
|
2024-10-07 11:16:53 +00:00
|
|
|
* ) echo "Unknown command."
|
|
|
|
;;
|
2024-09-25 16:51:39 +00:00
|
|
|
esac
|