49 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/env sh
 | 
						|
# townengine tooling interface
 | 
						|
 | 
						|
set +e
 | 
						|
 | 
						|
exe="$(basename $PWD)"
 | 
						|
toolpath="$(dirname -- "${BASH_SOURCE[0]}")"
 | 
						|
export TWNROOT=$(realpath "$toolpath"/../)
 | 
						|
 | 
						|
case "$1" in
 | 
						|
    build    ) "$toolpath"/twnbuild "${@:2}"
 | 
						|
               ;;
 | 
						|
 | 
						|
    run      ) $0 build "${@:2}" && ./$exe
 | 
						|
               ;;
 | 
						|
 | 
						|
    gdb      ) unset DEBUGINFOD_URLS
 | 
						|
               $0 build && gdb --se=libgame.so -ex run --args "$(basename $PWD)" "${@:2}"
 | 
						|
               ;;
 | 
						|
 | 
						|
    init     ) cp -r "$TWNROOT/apps/templates/$2" "$3"
 | 
						|
               ;;
 | 
						|
 | 
						|
    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
 | 
						|
               ;;
 | 
						|
 | 
						|
    wiki     ) xdg-open "file://$TWNROOT/docs/wiki/index.html"
 | 
						|
               ;;
 | 
						|
 | 
						|
    *        ) echo "Unknown command."
 | 
						|
               ;;
 | 
						|
esac
 |