diff --git a/spine-c/build.sh b/spine-c/build.sh index 1ee62b779..b27552be6 100755 --- a/spine-c/build.sh +++ b/spine-c/build.sh @@ -3,6 +3,33 @@ set -e cd "$(dirname "$0")" +# Display help information +show_help() { + echo "spine-c build script" + echo "" + echo "Usage: ./build.sh [option]" + echo "" + echo "Options:" + echo " --help, -h Show this help message" + echo " codegen Run code generation to regenerate C bindings from C++ sources" + echo " clean Clean build directory before building" + echo " release Build in release mode (default is debug)" + echo " (no option) Build the project in debug mode (default)" + echo "" + echo "Examples:" + echo " ./build.sh # Build debug version" + echo " ./build.sh release # Build release version" + echo " ./build.sh clean # Clean and rebuild debug" + echo " ./build.sh codegen # Regenerate C bindings" + echo " ./build.sh --help # Show this help" + exit 0 +} + +# Check for help flag +if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then + show_help +fi + # Run codegen if requested if [ "$1" = "codegen" ]; then npx tsx codegen/src/index.ts @@ -14,6 +41,12 @@ if [ "$1" = "clean" ]; then rm -rf build fi +# Determine build type +BUILD_TYPE="debug" +if [ "$1" = "release" ]; then + BUILD_TYPE="release" +fi + # Always build -cmake --preset=debug . -cmake --build --preset=debug \ No newline at end of file +cmake --preset=$BUILD_TYPE . +cmake --build --preset=$BUILD_TYPE \ No newline at end of file