townengine/bin/twn

50 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-10-10 16:43:56 +00:00
#!/bin/env sh
# townengine tooling interface
set +e
exe="$(basename $PWD)"
2025-02-15 21:46:15 +00:00
toolpath="$(dirname "$(readlink "${BASH_SOURCE[0]}")")"
2024-10-10 16:43:56 +00:00
export TWNROOT=$(realpath "$toolpath"/../)
case "$1" in
build ) "$toolpath"/twnbuild "${@:2}"
2024-10-10 16:43:56 +00:00
;;
run ) $0 build "${@:2}" && ./$exe
2024-10-10 16:43:56 +00:00
;;
gdb ) unset DEBUGINFOD_URLS
$0 build && gdb --se=libgame.so -ex run --args "$(basename $PWD)" --no-sanity-timer "${@:2}"
2024-10-10 16:43:56 +00:00
;;
init ) cp -r "$TWNROOT/apps/templates/$2" "$3"
2025-02-15 21:13:44 +00:00
ln -s "$TWNROOT/bin/twn" "$3/twn"
;;
2024-10-10 16:43:56 +00:00
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}"
;;
show ) traces=( $exe.*.trace )
trace=${traces[-1]}
if [ "$trace" = "$exe.*.trace" ]; then
trace="$exe.trace"
fi
qapitrace ${trace}
;;
esac
;;
api-gen ) "$toolpath"/gen_api_header.sh
;;
2025-02-03 19:31:53 +00:00
wiki ) xdg-open "file://$TWNROOT/docs/wiki/index.html"
;;
2024-10-10 16:43:56 +00:00
* ) echo "Unknown command."
;;
esac