[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/src/spine-cpp
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 )"
pushd "$dir" > /dev/null
if [ ! "$#" -eq 1 ]; then
echo "Usage: ./build-templates.sh <platform>"
if [ "$#" -lt 1 ]; then
echo "Usage: ./build-templates.sh <platform> <mono:true|false>?"
echo
echo "e.g.:"
echo " ./build-templates.sh windows"
@ -24,6 +24,28 @@ if [ ! -d ../godot ]; then
fi
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
if [ "$OSTYPE" = "msys" ]; then
@ -38,10 +60,10 @@ pushd ../godot
if [ "$platform" = "windows" ]; then
# --- Windows ---
#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_debug custom_modules="../spine_godot" --jobs=$cpus
cp bin/godot.windows.template_release.x86_64.exe bin/windows_release_x86_64.exe
cp bin/godot.windows.template_debug.x86_64.exe bin/windows_debug_x86_64.exe
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" $mono_module --jobs=$cpus
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$mono_extension.exe bin/windows_debug_x86_64.exe
elif [ "$platform" = "macos" ]; then
# --- 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_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
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_debug.x86_64 bin/godot.macos.template_debug.arm64 -output bin/godot.macos.debug.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$mono_extension" "bin/godot.macos.template_debug.arm64$mono_extension" -output bin/godot.macos.debug.universal
strip -S -x bin/godot.macos.universal
pushd bin
@ -64,6 +86,17 @@ elif [ "$platform" = "macos" ]; then
rm -rf macos.zip
zip -q -9 -r macos.zip macos_template.app
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
# --- iOS --
# generates ios.zip
@ -109,17 +142,6 @@ elif [ "$platform" = "android" ]; then
chmod a+x gradlew
./gradlew generateGodotTemplates
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
echo "Unknown platform: $platform"
exit 1

View File

@ -15,7 +15,7 @@ mono="false"
if [ $# -gt 0 ]; then
if [ $# -gt 1 ]; then
echo "Usage: $0 [mono:true|false]"
echo "Usage: $0 <mono:true|false>"
exit 1
else
if [ "$1" == "true" ] || [ "$1" == "false" ]; then
@ -83,7 +83,7 @@ if [ "$os" == "macos" ] && [ $dev == "false" ]; then
if [ $mono == "true" ]; then
echo "Building C# glue and assemblies."
"./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
pushd bin
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
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 "e.g.:"
echo " ./setup.sh 3.5.2-stable true"