Browse Source

Merge branch 'apple-fixes' of https://github.com/mihe/spine-runtimes into mihe-apple-fixes

Mario Zechner 2 months ago
parent
commit
15b96b3ea8

+ 24 - 0
spine-godot/Info.ios.plist

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>FMWK</string>
+	<key>CFBundleExecutable</key>
+	<string>${BUNDLE_LIBRARY}</string>
+	<key>CFBundleName</key>
+	<string>${BUNDLE_NAME}</string>
+	<key>CFBundleIdentifier</key>
+	<string>${BUNDLE_IDENTIFIER}</string>
+	<key>CFBundleVersion</key>
+	<string>${BUNDLE_VERSION}</string>
+	<key>CFBundleShortVersionString</key>
+	<string>${BUNDLE_VERSION}</string>
+	<key>MinimumOSVersion</key>
+	<string>${MIN_IOS_VERSION}</string>
+	<key>DTPlatformName</key>
+	<string>iphoneos</string>
+</dict>
+</plist>

+ 26 - 0
spine-godot/Info.macos.plist

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundlePackageType</key>
+	<string>FMWK</string>
+	<key>CFBundleExecutable</key>
+	<string>${BUNDLE_LIBRARY}</string>
+	<key>CFBundleName</key>
+	<string>${BUNDLE_NAME}</string>
+	<key>CFBundleIdentifier</key>
+	<string>${BUNDLE_IDENTIFIER}</string>
+	<key>CFBundleVersion</key>
+	<string>${BUNDLE_VERSION}</string>
+	<key>CFBundleShortVersionString</key>
+	<string>${BUNDLE_VERSION}</string>
+	<key>LSMinimumSystemVersion</key>
+	<string>${MIN_MACOS_VERSION}</string>
+	<key>CFBundleSupportedPlatforms</key>
+	<array>
+		<string>MacOSX</string>
+	</array>
+</dict>
+</plist>

+ 37 - 5
spine-godot/SConstruct

@@ -112,12 +112,13 @@ if env["target"] in ["editor", "template_debug"]:
     except AttributeError:
     except AttributeError:
         print("Not including class reference as we're targeting a pre-4.3 baseline.")
         print("Not including class reference as we're targeting a pre-4.3 baseline.")
 
 
-file = "{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"])
+file = "lib{}{}{}".format(libname, env["suffix"], env["SHLIBSUFFIX"])
 filepath = ""
 filepath = ""
 
 
 if env["platform"] == "macos" or env["platform"] == "ios":
 if env["platform"] == "macos" or env["platform"] == "ios":
-    filepath = "{}.framework/".format(env["platform"])
-    file = "{}.{}.{}".format(libname, env["platform"], env["target"])
+    filepath = "lib{}.{}.{}.framework/".format(libname, env["platform"], env["target"])
+    file = "lib{}.{}.{}".format(libname, env["platform"], env["target"])
+    env.Append(LINKFLAGS=["-Wl,-install_name,@rpath/{}{}".format(filepath, file)])
 
 
 libraryfile = "bin/{}/{}{}".format(env["platform"], filepath, file)
 libraryfile = "bin/{}/{}{}".format(env["platform"], filepath, file)
 library = env.SharedLibrary(
 library = env.SharedLibrary(
@@ -125,9 +126,40 @@ library = env.SharedLibrary(
     source=sources,
     source=sources,
 )
 )
 
 
-copy = env.InstallAs("{}/bin/{}/{}lib{}".format(projectdir, env["platform"], filepath, file), library)
-
+if env["platform"] == "macos" or env["platform"] == "ios":
+    plist_subst = {
+        "${BUNDLE_LIBRARY}": file,
+        "${BUNDLE_NAME}": "spine-godot",
+        "${BUNDLE_IDENTIFIER}": "com.esotericsoftware.spine.spine-godot",
+        "${BUNDLE_VERSION}": "4.2.0", # TODO: Get the proper version from somewhere. Note that this must be three integers.
+        "${MIN_MACOS_VERSION}": "10.12",
+        "${MIN_IOS_VERSION}": "12.0"
+    }
+
+    if env["platform"] == "macos":
+        plist_file = "bin/macos/{}Resources/Info.plist".format(filepath)
+        plist = env.Substfile(
+            target=plist_file,
+            source="Info.macos.plist",
+            SUBST_DICT=plist_subst
+        )
+    elif env["platform"] == "ios":
+        plist_file = "bin/ios/{}Info.plist".format(filepath)
+        plist = env.Substfile(
+            target=plist_file,
+            source="Info.ios.plist",
+            SUBST_DICT=plist_subst
+        )
+
+    env.Depends(library, plist)
+
+copy = env.InstallAs("{}/{}".format(projectdir, libraryfile), library)
 default_args = [library, copy]
 default_args = [library, copy]
+
+if env["platform"] == "macos" or env["platform"] == "ios":
+    copy_plist = env.InstallAs("{}/{}".format(projectdir, plist_file), plist_file)
+    default_args.append(copy_plist)
+
 if localEnv.get("compiledb", False):
 if localEnv.get("compiledb", False):
     default_args += [compilation_db]
     default_args += [compilation_db]
 Default(*default_args)
 Default(*default_args)

+ 2 - 83
spine-godot/build/build-extension.sh

@@ -57,87 +57,7 @@ echo "CPUS: $cpus"
 
 
 pushd ..
 pushd ..
 
 
-if [ "$raw_platform" == "ios" ]; then
-    BINDIR="example-v4-extension/bin/ios"
-    mkdir -p $BINDIR
-
-    # Step 1: Build simulator binaries
-    echo "Building for iOS simulator..."
-    scons -j $cpus $options $platform target=template_debug arch=universal ios_simulator=yes
-    mv $BINDIR/ios.framework/libspine_godot.ios.template_debug $BINDIR/libspine_godot.ios.template_debug.simulator.a
-
-    scons -j $cpus $options $platform target=template_release arch=universal ios_simulator=yes
-    mv $BINDIR/ios.framework/libspine_godot.ios.template_release $BINDIR/libspine_godot.ios.template_release.simulator.a
-
-    # Step 2: Build device binaries
-    echo "Building for iOS device..."
-    scons -j $cpus $options $platform target=template_debug arch=arm64 ios_simulator=no
-    mv $BINDIR/ios.framework/libspine_godot.ios.template_debug $BINDIR/libspine_godot.ios.template_debug.a
-
-    scons -j $cpus $options $platform target=template_release arch=arm64 ios_simulator=no
-    mv $BINDIR/ios.framework/libspine_godot.ios.template_release $BINDIR/libspine_godot.ios.template_release.a
-
-    # Step 3: Create xcframeworks
-    echo "Creating xcframeworks..."
-
-    xcodebuild -create-xcframework \
-        -library $BINDIR/libspine_godot.ios.template_debug.a \
-        -library $BINDIR/libspine_godot.ios.template_debug.simulator.a \
-        -output $BINDIR/libspine_godot.ios.template_debug.xcframework
-
-    xcodebuild -create-xcframework \
-        -library $BINDIR/libspine_godot.ios.template_release.a \
-        -library $BINDIR/libspine_godot.ios.template_release.simulator.a \
-        -output $BINDIR/libspine_godot.ios.template_release.xcframework
-
-    # Cleanup intermediate files
-    rm -f $BINDIR/*.a
-    rm -rf $BINDIR/ios.framework
-
-elif [ "$raw_platform" == "macos" ]; then
-    BINDIR="example-v4-extension/bin/macos/macos.framework"
-    TMPDIR="example-v4-extension/bin/macos/tmp"
-    mkdir -p $BINDIR $TMPDIR
-
-    # Build x86_64 binaries
-    echo "Building for macOS x86_64..."
-    scons -j $cpus $options $platform target=editor arch=x86_64
-    mv $BINDIR/libspine_godot.macos.editor $TMPDIR/libspine_godot.macos.editor.x86_64
-    scons -j $cpus $options $platform target=template_debug arch=x86_64
-    mv $BINDIR/libspine_godot.macos.template_debug $TMPDIR/libspine_godot.macos.template_debug.x86_64
-    scons -j $cpus $options $platform target=template_release arch=x86_64
-    mv $BINDIR/libspine_godot.macos.template_release $TMPDIR/libspine_godot.macos.template_release.x86_64
-
-    # Build arm64 binaries
-    echo "Building for macOS arm64..."
-    scons -j $cpus $options $platform target=editor arch=arm64
-    mv $BINDIR/libspine_godot.macos.editor $TMPDIR/libspine_godot.macos.editor.arm64
-    scons -j $cpus $options $platform target=template_debug arch=arm64
-    mv $BINDIR/libspine_godot.macos.template_debug $TMPDIR/libspine_godot.macos.template_debug.arm64
-    scons -j $cpus $options $platform target=template_release arch=arm64
-    mv $BINDIR/libspine_godot.macos.template_release $TMPDIR/libspine_godot.macos.template_release.arm64
-
-    # Create universal binaries
-    echo "Creating universal binaries..."
-    lipo -create \
-        $TMPDIR/libspine_godot.macos.editor.x86_64 \
-        $TMPDIR/libspine_godot.macos.editor.arm64 \
-        -output $BINDIR/libspine_godot.macos.editor
-
-    lipo -create \
-        $TMPDIR/libspine_godot.macos.template_debug.x86_64 \
-        $TMPDIR/libspine_godot.macos.template_debug.arm64 \
-        -output $BINDIR/libspine_godot.macos.template_debug
-
-    lipo -create \
-        $TMPDIR/libspine_godot.macos.template_release.x86_64 \
-        $TMPDIR/libspine_godot.macos.template_release.arm64 \
-        -output $BINDIR/libspine_godot.macos.template_release
-
-    # Cleanup intermediate files
-    rm -rf $TMPDIR
-
-elif [ "$raw_platform" == "web" ]; then
+if [ "$raw_platform" == "web" ]; then
     BINDIR="example-v4-extension/bin/web"
     BINDIR="example-v4-extension/bin/web"
     mkdir -p $BINDIR
     mkdir -p $BINDIR
 
 
@@ -150,10 +70,9 @@ elif [ "$raw_platform" == "web" ]; then
     echo "Building web without threads..."
     echo "Building web without threads..."
     scons -j $cpus $options $platform target=template_debug threads=no
     scons -j $cpus $options $platform target=template_debug threads=no
     scons -j $cpus $options $platform target=template_release threads=no
     scons -j $cpus $options $platform target=template_release threads=no
-
 else
 else
     # Normal build process for other platforms
     # Normal build process for other platforms
-    if [ "$raw_platform" != "android" ] && [ "$raw_platform" != "web" ]; then
+    if [ "$raw_platform" != "android" ] && [ "$raw_platform" != "ios" ] && [ "$raw_platform" != "web" ]; then
         scons -j $cpus $options $platform target=editor
         scons -j $cpus $options $platform target=editor
     fi
     fi
     scons -j $cpus $options $platform target=template_debug
     scons -j $cpus $options $platform target=template_debug

+ 25 - 25
spine-godot/spine_godot_extension.gdextension

@@ -5,36 +5,36 @@ compatibility_minimum = "4.1"
 
 
 [libraries]
 [libraries]
 
 
-macos.editor = "res://bin/macos/macos.framework/libspine_godot.macos.editor"
-macos.debug = "res://bin/macos/macos.framework/libspine_godot.macos.template_debug"
-macos.release = "res://bin/macos/macos.framework/libspine_godot.macos.template_release"
+macos.editor = "macos/libspine_godot.macos.editor.framework"
+macos.debug = "macos/libspine_godot.macos.template_debug.framework"
+macos.release = "macos/libspine_godot.macos.template_release.framework"
 
 
-ios.debug = "res://bin/ios/ios.framework/libspine_godot.ios.template_debug.xcframework"
-ios.release = "res://bin/ios/ios.framework/libspine_godot.ios.template_release.xcframework"
+ios.debug = "ios/libspine_godot.ios.template_debug.framework"
+ios.release = "ios/libspine_godot.ios.template_release.framework"
 
 
-windows.editor.x86_64 = "res://bin/windows/libspine_godot.windows.editor.x86_64.dll"
-windows.debug.x86_64 = "res://bin/windows/libspine_godot.windows.template_debug.x86_64.dll"
-windows.release.x86_64 = "res://bin/windows/libspine_godot.windows.template_release.x86_64.dll"
+windows.editor.x86_64 = "windows/libspine_godot.windows.editor.x86_64.dll"
+windows.debug.x86_64 = "windows/libspine_godot.windows.template_debug.x86_64.dll"
+windows.release.x86_64 = "windows/libspine_godot.windows.template_release.x86_64.dll"
 
 
-linux.editor.x86_64 = "res://bin/linux/libspine_godot.linux.editor.x86_64.so"
-linux.debug.x86_64 = "res://bin/linux/libspine_godot.linux.template_debug.x86_64.so"
-linux.release.x86_64 = "res://bin/linux/libspine_godot.linux.template_release.x86_64.so"
+linux.editor.x86_64 = "linux/libspine_godot.linux.editor.x86_64.so"
+linux.debug.x86_64 = "linux/libspine_godot.linux.template_debug.x86_64.so"
+linux.release.x86_64 = "linux/libspine_godot.linux.template_release.x86_64.so"
 
 
-linux.editor.arm64 = "res://bin/linux/libspine_godot.linux.editor.arm64.so"
-linux.debug.arm64 = "res://bin/linux/libspine_godot.linux.template_debug.arm64.so"
-linux.release.arm64 = "res://bin/linux/libspine_godot.linux.template_release.arm64.so"
+linux.editor.arm64 = "linux/libspine_godot.linux.editor.arm64.so"
+linux.debug.arm64 = "linux/libspine_godot.linux.template_debug.arm64.so"
+linux.release.arm64 = "linux/libspine_godot.linux.template_release.arm64.so"
 
 
-linux.editor.rv64 = "res://bin/linux/libspine_godot.linux.editor.rv64.so"
-linux.debug.rv64 = "res://bin/linux/libspine_godot.linux.template_debug.rv64.so"
-linux.release.rv64 = "res://bin/linux/libspine_godot.linux.template_release.rv64.so"
+linux.editor.rv64 = "linux/libspine_godot.linux.editor.rv64.so"
+linux.debug.rv64 = "linux/libspine_godot.linux.template_debug.rv64.so"
+linux.release.rv64 = "linux/libspine_godot.linux.template_release.rv64.so"
 
 
-android.debug.x86_64 = "res://bin/android/libspine_godot.android.template_debug.x86_64.so"
-android.release.x86_64 = "res://bin/android/libspine_godot.android.template_release.x86_64.so"
+android.debug.x86_64 = "android/libspine_godot.android.template_debug.x86_64.so"
+android.release.x86_64 = "android/libspine_godot.android.template_release.x86_64.so"
 
 
-android.debug.arm64 = "res://bin/android/libspine_godot.android.template_debug.arm64.so"
-android.release.arm64 = "res://bin/android/libspine_godot.android.template_release.arm64.so"
+android.debug.arm64 = "android/libspine_godot.android.template_debug.arm64.so"
+android.release.arm64 = "android/libspine_godot.android.template_release.arm64.so"
 
 
-web.debug.threads.wasm32 = "res://bin/web/libgdexample.web.template_debug.wasm32.wasm"
-web.release.threads.wasm32 = "res://bin/web/libgdexample.web.template_release.wasm32.wasm"
-web.debug.wasm32 = "res://bin/web/libgdexample.web.template_debug.wasm32.nothreads.wasm"
-web.release.wasm32 = "res://bin/web/libgdexample.web.template_release.wasm32.nothreads.wasm"
+web.debug.threads.wasm32 = "web/libgdexample.web.template_debug.wasm32.wasm"
+web.release.threads.wasm32 = "web/libgdexample.web.template_release.wasm32.wasm"
+web.debug.wasm32 = "web/libgdexample.web.template_debug.wasm32.nothreads.wasm"
+web.release.wasm32 = "web/libgdexample.web.template_release.wasm32.nothreads.wasm"