[godot] Rework v4 build scripts to support optionally support C#.

This commit is contained in:
Mario Zechner 2023-07-19 17:53:01 +02:00
parent bdb9e130bc
commit e525c77d18
4 changed files with 71 additions and 21 deletions

3
.gitignore vendored
View File

@ -187,4 +187,5 @@ spine-godot/build/compile_commands.json
spine-flutter/ios/Classes/spine-cpp 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

View File

@ -54,6 +54,31 @@
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64", "program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64",
}, },
}, },
{
"type": "cppvsdbg",
"request": "launch",
"name": "debug editor v4 c#",
"program": "godot/bin/godot.windows.editor.dev.x86_64.mono.exe",
"args": [
"-e",
"--path",
"example-v4",
],
"cwd": "${workspaceFolder}",
"preLaunchTask": "build-v4",
"linux": {
"type": "lldb",
"request": "launch",
"name": "debug editor v4",
"program": "${workspaceFolder}/godot/bin/godot.linux.editor.dev.x86_64",
},
"osx": {
"type": "lldb",
"request": "launch",
"name": "debug editor v4",
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64.mono",
},
},
{ {
"type": "cppvsdbg", "type": "cppvsdbg",
"request": "launch", "request": "launch",

View File

@ -35,17 +35,6 @@ if [ -f "../godot/custom.py" ]; then
dev="true" dev="true"
fi fi
cpus=2
if [ "$OSTYPE" = "msys" ]; then
cpus=$NUMBER_OF_PROCESSORS
elif [[ "$OSTYPE" = "darwin"* ]]; then
cpus=$(sysctl -n hw.logicalcpu)
else
cpus=$(grep -c ^processor /proc/cpuinfo)
fi
echo "CPUS: $cpus"
mono_module="" mono_module=""
mono_extension="" mono_extension=""
if [ $mono = "true" ]; then if [ $mono = "true" ]; then
@ -53,28 +42,62 @@ if [ $mono = "true" ]; then
mono_extension=".mono" mono_extension=".mono"
fi fi
dev_extension=""
if [ $dev = "true" ]; then
dev_extension=".dev"
target="$target dev_build=true"
fi
cpus=2
if [ "$OSTYPE" = "msys" ]; then
os="windows"
cpus=$NUMBER_OF_PROCESSORS
target="vsproj=yes livepp=$LIVEPP"
godot_exe="godot.windows.editor$dev_extension.x86_64$mono_extension.exe"
godot_exe_host=$godot_exe
elif [[ "$OSTYPE" = "darwin"* ]]; then
os="macos"
cpus=$(sysctl -n hw.logicalcpu)
godot_exe="godot.macos.editor$dev_extension.x86_64$mono_extension"
godot_exe_arm="godot.macos.editor$dev_extension.arm64$mono_extension"
godot_exe_host=$godot_exe
if [ `uname -m` == "arm64" ]; then
godot_exe_host=$godot_exe_arm
fi
else
os="linux"
cpus=$(grep -c ^processor /proc/cpuinfo)
godot_exe="godot.linux.editor$dev_extension.x86_64$mono_extension"
godot_exe_host=$godot_exe
fi
echo "CPUS: $cpus"
pushd ../godot pushd ../godot
if [ `uname` == 'Darwin' ] && [ $dev = "false" ]; then if [ "$os" = "macos" ] && [ $dev = "false" ]; then
scons $target $mono_module arch=x86_64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus scons $target $mono_module arch=x86_64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
scons $target $mono_module arch=arm64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus scons $target $mono_module arch=arm64 compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
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
fi
pushd bin pushd bin
cp -r ../misc/dist/macos_tools.app . cp -r ../misc/dist/macos_tools.app .
mv macos_tools.app Godot.app mv macos_tools.app Godot.app
mkdir -p Godot.app/Contents/MacOS mkdir -p Godot.app/Contents/MacOS
lipo -create godot.macos.editor.arm64$mono_extension godot.macos.editor.x86_64$mono_extension -output Godot lipo -create $godot_exe_arm $godot_exe -output Godot
strip -S -x Godot strip -S -x Godot
cp Godot Godot.app/Contents/MacOS/Godot cp Godot Godot.app/Contents/MacOS/Godot
chmod +x Godot.app/Contents/MacOS/Godot chmod +x Godot.app/Contents/MacOS/Godot
popd popd
else else
if [ "$OSTYPE" = "msys" ]; then
target="vsproj=yes livepp=$LIVEPP"
fi
if [ "$dev" = "true" ]; then
target="$target dev_build=true"
fi
scons $target $mono_module compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus scons $target $mono_module compiledb=yes custom_modules="../spine_godot" opengl3=yes --jobs=$cpus
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
fi
cp compile_commands.json ../build cp compile_commands.json ../build
if [ -f "bin/godot.linuxbsd.editor.x86_64$mono_extension" ]; then if [ -f "bin/godot.linuxbsd.editor.x86_64$mono_extension" ]; then
strip bin/godot.linuxbsd.editor.x86_64$mono_extension strip bin/godot.linuxbsd.editor.x86_64$mono_extension

View File

@ -42,6 +42,7 @@ if [ $dev = "true" ]; then
cp -r .idea godot cp -r .idea godot
cp build/custom.py godot cp build/custom.py godot
if [ "$mono" = "true" ]; then if [ "$mono" = "true" ]; then
echo "" >> godot/custom.py
echo "module_mono_enabled=\"yes\"" >> godot/custom.py echo "module_mono_enabled=\"yes\"" >> godot/custom.py
fi fi
cp ../formatters/.clang-format . cp ../formatters/.clang-format .