mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[c] Improved build.sh
- release builds - --help flag
This commit is contained in:
parent
8503ae00d3
commit
d5947d45a1
@ -3,6 +3,33 @@ set -e
|
|||||||
|
|
||||||
cd "$(dirname "$0")"
|
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
|
# Run codegen if requested
|
||||||
if [ "$1" = "codegen" ]; then
|
if [ "$1" = "codegen" ]; then
|
||||||
npx tsx codegen/src/index.ts
|
npx tsx codegen/src/index.ts
|
||||||
@ -14,6 +41,12 @@ if [ "$1" = "clean" ]; then
|
|||||||
rm -rf build
|
rm -rf build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Determine build type
|
||||||
|
BUILD_TYPE="debug"
|
||||||
|
if [ "$1" = "release" ]; then
|
||||||
|
BUILD_TYPE="release"
|
||||||
|
fi
|
||||||
|
|
||||||
# Always build
|
# Always build
|
||||||
cmake --preset=debug .
|
cmake --preset=$BUILD_TYPE .
|
||||||
cmake --build --preset=debug
|
cmake --build --preset=$BUILD_TYPE
|
||||||
Loading…
x
Reference in New Issue
Block a user