From 9c01264fd059648dc27053664694cac51b511cb5 Mon Sep 17 00:00:00 2001 From: veclavtalica Date: Thu, 10 Oct 2024 19:43:56 +0300 Subject: [PATCH] readd /bin/twn --- bin/twn | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 bin/twn diff --git a/bin/twn b/bin/twn new file mode 100755 index 0000000..92c390a --- /dev/null +++ b/bin/twn @@ -0,0 +1,43 @@ +#!/bin/env sh +# townengine tooling interface + +set +e + +exe="$(basename $PWD)" +toolpath="$(dirname -- "${BASH_SOURCE[0]}")" +export TWNROOT=$(realpath "$toolpath"/../) +export TWNBUILDDIR=$(realpath "$toolpath"/../.build) + +case "$1" in + build ) "$toolpath"/build.sh "${@:2}" + ;; + + run ) $0 build && ./$exe "${@:2}" + ;; + + gdb ) unset DEBUGINFOD_URLS + $0 build && 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}" + ;; + + 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 + ;; + + * ) echo "Unknown command." + ;; +esac