diff --git a/.gitignore b/.gitignore index 3ddffea7b9..eedd7120ec 100644 --- a/.gitignore +++ b/.gitignore @@ -187,4 +187,5 @@ spine-godot/build/compile_commands.json spine-flutter/ios/Classes/spine-cpp spine-flutter/macos/Classes/spine-cpp -spine-flutter/src/spine-cpp \ No newline at end of file +spine-flutter/src/spine-cpp +spine-godot/godot-nuget diff --git a/spine-godot/.vscode/launch.json b/spine-godot/.vscode/launch.json index 20f2e0b0df..f89c19e2ab 100644 --- a/spine-godot/.vscode/launch.json +++ b/spine-godot/.vscode/launch.json @@ -54,6 +54,31 @@ "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", "request": "launch", diff --git a/spine-godot/build/build-v4.sh b/spine-godot/build/build-v4.sh index a39230f32f..8d7e30eb46 100755 --- a/spine-godot/build/build-v4.sh +++ b/spine-godot/build/build-v4.sh @@ -35,46 +35,69 @@ if [ -f "../godot/custom.py" ]; then dev="true" fi +mono_module="" +mono_extension="" +if [ $mono = "true" ]; then + mono_module="module_mono_enabled=yes" + mono_extension=".mono" +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" -mono_module="" -mono_extension="" -if [ $mono = "true" ]; then - mono_module="module_mono_enabled=yes" - mono_extension=".mono" -fi - 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=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 cp -r ../misc/dist/macos_tools.app . mv macos_tools.app Godot.app 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 cp Godot Godot.app/Contents/MacOS/Godot chmod +x Godot.app/Contents/MacOS/Godot popd 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 + 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 if [ -f "bin/godot.linuxbsd.editor.x86_64$mono_extension" ]; then strip bin/godot.linuxbsd.editor.x86_64$mono_extension diff --git a/spine-godot/build/setup.sh b/spine-godot/build/setup.sh index 07be7f1140..8b04c11971 100755 --- a/spine-godot/build/setup.sh +++ b/spine-godot/build/setup.sh @@ -42,6 +42,7 @@ if [ $dev = "true" ]; then cp -r .idea godot cp build/custom.py godot if [ "$mono" = "true" ]; then + echo "" >> godot/custom.py echo "module_mono_enabled=\"yes\"" >> godot/custom.py fi cp ../formatters/.clang-format .