[godot] More C# build work.

This commit is contained in:
Mario Zechner 2023-07-21 14:42:45 +02:00
parent e59b15cf52
commit b405686823
4 changed files with 52 additions and 29 deletions

1
.gitignore vendored
View File

@ -189,3 +189,4 @@ spine-flutter/ios/Classes/spine-cpp
spine-flutter/macos/Classes/spine-cpp spine-flutter/macos/Classes/spine-cpp
spine-flutter/src/spine-cpp spine-flutter/src/spine-cpp
spine-godot/godot-nuget spine-godot/godot-nuget
spine-godot/godot-spine-csharp

View File

@ -4,8 +4,8 @@ set -e
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
pushd "$dir" > /dev/null pushd "$dir" > /dev/null
if [ ! "$#" -eq 1 ]; then if [ "$#" -lt 1 ]; then
echo "Usage: ./build-templates.sh <platform>" echo "Usage: ./build-templates.sh <platform> <mono:true|false>?"
echo echo
echo "e.g.:" echo "e.g.:"
echo " ./build-templates.sh windows" echo " ./build-templates.sh windows"
@ -14,7 +14,7 @@ if [ ! "$#" -eq 1 ]; then
echo " ./build-templates.sh ios" echo " ./build-templates.sh ios"
echo " ./build-templates.sh android" echo " ./build-templates.sh android"
echo " ./build-templates.sh web" echo " ./build-templates.sh web"
echo echo
exit 1 exit 1
fi fi
@ -24,6 +24,28 @@ if [ ! -d ../godot ]; then
fi fi
platform=${1%/} platform=${1%/}
mono=false
if [[ $# -eq 2 ]]; then
mono=${2%/}
if [ "$platform" != "windows" ] && [ "$platform" != "linux" ] && [ "$platform" != "macos" ]; then
echo "C# is only supported for Windows, Linux, and macOS"
exit 1
fi
echo "Building Godot template with C# support"
else
echo "Building Godot template without C# support"
fi
mono_module=""
mono_extension=""
if [ $mono == "true" ]; then
mono_module="module_mono_enabled=yes"
mono_extension=".mono"
echo "Building Godot with C# support"
else
echo "Building Godot without C# support"
fi
cpus=2 cpus=2
if [ "$OSTYPE" = "msys" ]; then if [ "$OSTYPE" = "msys" ]; then
@ -38,10 +60,10 @@ pushd ../godot
if [ "$platform" = "windows" ]; then if [ "$platform" = "windows" ]; then
# --- Windows --- # --- Windows ---
#generates windows_64_debug.exe and windows_64_release.exe #generates windows_64_debug.exe and windows_64_release.exe
scons platform=windows tools=no target=template_release custom_modules="../spine_godot" --jobs=$cpus scons platform=windows tools=no target=template_release custom_modules="../spine_godot" $mono_module --jobs=$cpus
scons platform=windows tools=no target=template_debug custom_modules="../spine_godot" --jobs=$cpus scons platform=windows tools=no target=template_debug custom_modules="../spine_godot" $mono_module --jobs=$cpus
cp bin/godot.windows.template_release.x86_64.exe bin/windows_release_x86_64.exe cp bin/godot.windows.template_release.x86_64$mono_extension.exe bin/windows_release_x86_64.exe
cp bin/godot.windows.template_debug.x86_64.exe bin/windows_debug_x86_64.exe cp bin/godot.windows.template_debug.x86_64$mono_extension.exe bin/windows_debug_x86_64.exe
elif [ "$platform" = "macos" ]; then elif [ "$platform" = "macos" ]; then
# --- macOS --- # --- macOS ---
@ -51,8 +73,8 @@ elif [ "$platform" = "macos" ]; then
scons platform=macos tools=no target=template_debug arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus scons platform=macos tools=no target=template_debug arch=x86_64 custom_modules="../spine_godot" --jobs=$cpus
scons platform=macos tools=no target=template_release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus scons platform=macos tools=no target=template_release arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
scons platform=macos tools=no target=template_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus scons platform=macos tools=no target=template_debug arch=arm64 custom_modules="../spine_godot" --jobs=$cpus
lipo -create bin/godot.macos.template_release.x86_64 bin/godot.macos.template_release.arm64 -output bin/godot.macos.universal lipo -create "bin/godot.macos.template_release.x86_64$mono_extension" "bin/godot.macos.template_release.arm64$mono_extension" -output bin/godot.macos.universal
lipo -create bin/godot.macos.template_debug.x86_64 bin/godot.macos.template_debug.arm64 -output bin/godot.macos.debug.universal lipo -create "bin/godot.macos.template_debug.x86_64$mono_extension" "bin/godot.macos.template_debug.arm64$mono_extension" -output bin/godot.macos.debug.universal
strip -S -x bin/godot.macos.universal strip -S -x bin/godot.macos.universal
pushd bin pushd bin
@ -60,10 +82,21 @@ elif [ "$platform" = "macos" ]; then
mkdir -p macos_template.app/Contents/MacOS mkdir -p macos_template.app/Contents/MacOS
cp godot.macos.universal macos_template.app/Contents/MacOS/godot_macos_release.universal cp godot.macos.universal macos_template.app/Contents/MacOS/godot_macos_release.universal
cp godot.macos.debug.universal macos_template.app/Contents/MacOS/godot_macos_debug.universal cp godot.macos.debug.universal macos_template.app/Contents/MacOS/godot_macos_debug.universal
chmod +x macos_template.app/Contents/MacOS/godot_macos* chmod +x macos_template.app/Contents/MacOS/godot_macos*
rm -rf macos.zip rm -rf macos.zip
zip -q -9 -r macos.zip macos_template.app zip -q -9 -r macos.zip macos_template.app
popd popd
elif [ "$platform" = "linux" ]; then
# --- Linux ---
# generates linux_x11_64_release, linux_x11_64_debug
scons platform=linuxbsd tools=no target=template_release bits=64 custom_modules="../spine_godot" --jobs=$cpus
scons platform=linuxbsd tools=no target=template_debug bits=64 custom_modules="../spine_godot" --jobs=$cpus
strip bin/godot.linuxbsd.template_release.x86_64$mono_extension
strip bin/godot.linuxbsd.template_debug.x86_64$mono_extension
chmod a+x bin/godot.linuxbsd.template_release.x86_64$mono_extension
chmod a+x bin/godot.linuxbsd.template_debug.x86_64$mono_extension
cp bin/godot.linuxbsd.template_release.x86_64$mono_extension bin/linux_release.x86_64
cp bin/godot.linuxbsd.template_debug.x86_64$mono_extension bin/linux_debug.x86_64
elif [ "$platform" = "ios" ]; then elif [ "$platform" = "ios" ]; then
# --- iOS -- # --- iOS --
# generates ios.zip # generates ios.zip
@ -77,19 +110,19 @@ elif [ "$platform" = "ios" ]; then
lipo -create bin/libgodot.ios.template_release.arm64.simulator.a bin/libgodot.ios.template_release.x86_64.simulator.a -output bin/libgodot.ios.template_release.simulator.a lipo -create bin/libgodot.ios.template_release.arm64.simulator.a bin/libgodot.ios.template_release.x86_64.simulator.a -output bin/libgodot.ios.template_release.simulator.a
lipo -create bin/libgodot.ios.template_debug.arm64.simulator.a bin/libgodot.ios.template_debug.x86_64.simulator.a -output bin/libgodot.ios.template_debug.simulator.a lipo -create bin/libgodot.ios.template_debug.arm64.simulator.a bin/libgodot.ios.template_debug.x86_64.simulator.a -output bin/libgodot.ios.template_debug.simulator.a
strip -S -x bin/libgodot.ios.template_release.arm64.a strip -S -x bin/libgodot.ios.template_release.arm64.a
strip -S -x bin/libgodot.ios.template_release.simulator.a strip -S -x bin/libgodot.ios.template_release.simulator.a
pushd bin pushd bin
cp -r ../misc/dist/ios_xcode . cp -r ../misc/dist/ios_xcode .
cp libgodot.ios.template_release.arm64.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64/libgodot.a cp libgodot.ios.template_release.arm64.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64/libgodot.a
cp libgodot.ios.template_release.simulator.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64_x86_64-simulator/libgodot.a cp libgodot.ios.template_release.simulator.a ios_xcode/libgodot.ios.release.xcframework/ios-arm64_x86_64-simulator/libgodot.a
cp libgodot.ios.template_debug.arm64.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64/libgodot.a cp libgodot.ios.template_debug.arm64.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64/libgodot.a
cp libgodot.ios.template_debug.simulator.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a cp libgodot.ios.template_debug.simulator.a ios_xcode/libgodot.ios.debug.xcframework/ios-arm64_x86_64-simulator/libgodot.a
rm -rf ios.zip rm -rf ios.zip
pushd ios_xcode pushd ios_xcode
zip -q -9 -r ../ios.zip * zip -q -9 -r ../ios.zip *
popd popd
popd popd
elif [ "$platform" = "web" ]; then elif [ "$platform" = "web" ]; then
# --- WEB --- # --- WEB ---
# generates webassembly_debug.zip, webassembly_release.zip # generates webassembly_debug.zip, webassembly_release.zip
@ -109,17 +142,6 @@ elif [ "$platform" = "android" ]; then
chmod a+x gradlew chmod a+x gradlew
./gradlew generateGodotTemplates ./gradlew generateGodotTemplates
popd popd
elif [ "$platform" = "linux" ]; then
# --- Linux ---
# generates linux_x11_64_release, linux_x11_64_debug
scons platform=linuxbsd tools=no target=template_release bits=64 custom_modules="../spine_godot" --jobs=$cpus
scons platform=linuxbsd tools=no target=template_debug bits=64 custom_modules="../spine_godot" --jobs=$cpus
strip bin/godot.linuxbsd.template_release.x86_64
strip bin/godot.linuxbsd.template_debug.x86_64
chmod a+x bin/godot.linuxbsd.template_release.x86_64
chmod a+x bin/godot.linuxbsd.template_debug.x86_64
cp bin/godot.linuxbsd.template_release.x86_64 bin/linux_x11_64_release
cp bin/godot.linuxbsd.template_debug.x86_64 bin/linux_x11_64_debug
else else
echo "Unknown platform: $platform" echo "Unknown platform: $platform"
exit 1 exit 1

View File

@ -15,7 +15,7 @@ mono="false"
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
echo "Usage: $0 [mono:true|false]" echo "Usage: $0 <mono:true|false>"
exit 1 exit 1
else else
if [ "$1" == "true" ] || [ "$1" == "false" ]; then if [ "$1" == "true" ] || [ "$1" == "false" ]; then
@ -83,7 +83,7 @@ if [ "$os" == "macos" ] && [ $dev == "false" ]; then
if [ $mono == "true" ]; then if [ $mono == "true" ]; then
echo "Building C# glue and assemblies." echo "Building C# glue and assemblies."
"./bin/$godot_exe_host" --generate-mono-glue modules/mono/glue "./bin/$godot_exe_host" --generate-mono-glue modules/mono/glue
./modules/mono/build_scripts/build_assemblies.py --godot-output-dir ./bin --push-nupkgs-local ../godot-nuget ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir ./bin --push-nupkgs-local ../godot-spine-csharp
fi fi
pushd bin pushd bin
cp -r ../misc/dist/macos_tools.app . cp -r ../misc/dist/macos_tools.app .

View File

@ -5,7 +5,7 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
pushd "$dir" > /dev/null pushd "$dir" > /dev/null
if [ $# -lt 2 ] || [ $# -gt 3 ]; then if [ $# -lt 2 ] || [ $# -gt 3 ]; then
echo "Usage: ./setup.sh <Godot branch or tag> <dev:true|false> [mono:true|false]?" echo "Usage: ./setup.sh <Godot branch or tag> <dev:true|false> <mono:true|false>?"
echo echo
echo "e.g.:" echo "e.g.:"
echo " ./setup.sh 3.5.2-stable true" echo " ./setup.sh 3.5.2-stable true"