From a822314951aea22c8c552bde33fb060968da19c6 Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Fri, 4 Oct 2024 18:07:08 +0200 Subject: [PATCH] Add Info.plist files. Improve the gitignore. Use .framework file structures for macOS and iOS for App Store purposes. --- .gitignore | 23 +++++++--------- SConstruct | 13 ++++++++-- demo/bin/example.gdextension | 8 +++--- .../Info.plist | 26 +++++++++++++++++++ .../Resources/Info.plist | 26 +++++++++++++++++++ 5 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 demo/bin/macos/EXTENSION-NAME.macos.template_debug.universal.framework/Info.plist create mode 100644 demo/bin/macos/EXTENSION-NAME.macos.template_release.universal.framework/Resources/Info.plist diff --git a/.gitignore b/.gitignore index de83b56..68973eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,15 @@ # Godot 4+ specific ignores .godot/ -# Ignore library files but not the gdextension file -demo/bin/* -!demo/bin/android -demo/bin/android/* -!demo/bin/android/.gitkeep -!demo/bin/linux -demo/bin/linux/* -!demo/bin/linux/.gitkeep -!demo/bin/macos -demo/bin/macos/* -!demo/bin/macos/.gitkeep -!demo/bin/windows -demo/bin/windows/* -!demo/bin/windows/.gitkeep +# Ignore built binaries +/demo/bin/**/* +!/demo/bin/**/ +!/demo/bin/**/*.gitkeep +!/demo/bin/**/*.plist +/bin/**/* +!/bin/**/ +!/bin/**/*.gitkeep +!/bin/**/*.plist !demo/bin/*.gdextension .sconsign*.dblite diff --git a/SConstruct b/SConstruct index 3f3edce..916dc8b 100644 --- a/SConstruct +++ b/SConstruct @@ -80,8 +80,17 @@ lib_filename = "{}{}{}{}".format(env.subst("$SHLIBPREFIX"), libname, env["suffix lib_filepath = "" if env["platform"] == "macos" or env["platform"] == "ios": - # For signing, the dylibs need to be in a folder, along with the plist files. - lib_filepath = "{}-{}.framework/".format(libname, env["platform"]) + # By default, the above code generates .dylib files on macOS and iOS. + # The App Store rejects entries containing .dylib files, requiring a .framework structure instead. + # Details about the .framework structure are described Framework Programming Guide: + # https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html#//apple_ref/doc/uid/20002253-BAJEJJAB + framework_name = "{}{}".format(libname, env["suffix"]) + lib_filename = framework_name + lib_filepath = "{}.framework/".format(framework_name) + + # Prevents the binary from getting a prefix / suffix automatically + env["SHLIBPREFIX"] = "" + env["SHLIBSUFFIX"] = "" libraryfile = "bin/{}/{}{}".format(env["platform"], lib_filepath, lib_filename) library = env.SharedLibrary( diff --git a/demo/bin/example.gdextension b/demo/bin/example.gdextension index a0a02c2..18ed2d3 100644 --- a/demo/bin/example.gdextension +++ b/demo/bin/example.gdextension @@ -5,10 +5,10 @@ compatibility_minimum = "4.1" [libraries] -macos.debug = "res://bin/macos/EXTENSION-NAME-macos.framework/libEXTENSION-NAME.macos.template_debug.universal.dylib" -macos.release = "res://bin/macos/EXTENSION-NAME-macos.framework/libEXTENSION-NAME.macos.template_release.universal.dylib" -ios.debug = "res://bin/ios/ios.framework/libEXTENSION-NAME.ios.template_debug.universal.dylib" -ios.release = "res://bin/ios/ios.framework/libEXTENSION-NAME.ios.template_release.universal.dylib" +macos.debug = "res://bin/macos/EXTENSION-NAME.framework" +macos.release = "res://bin/macos/EXTENSION-NAME.framework" +ios.debug = "res://bin/ios/EXTENSION-NAME.framework" +ios.release = "res://bin/ios/EXTENSION-NAME.framework" windows.debug.x86_32 = "res://bin/windows/EXTENSION-NAME.windows.template_debug.x86_32.dll" windows.release.x86_32 = "res://bin/windows/EXTENSION-NAME.windows.template_release.x86_32.dll" windows.debug.x86_64 = "res://bin/windows/libEXTENSION-NAME.windows.template_debug.x86_64.dll" diff --git a/demo/bin/macos/EXTENSION-NAME.macos.template_debug.universal.framework/Info.plist b/demo/bin/macos/EXTENSION-NAME.macos.template_debug.universal.framework/Info.plist new file mode 100644 index 0000000..4cc7fb0 --- /dev/null +++ b/demo/bin/macos/EXTENSION-NAME.macos.template_debug.universal.framework/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleExecutable + EXTENSION-NAME.macos.template_debug.universal + CFBundleIdentifier + org.godotengine.EXTENSION-NAME.macos.template_debug.universal + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + EXTENSION-NAME.macos.template_debug.universal + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 1.0.0 + LSMinimumSystemVersion + 10.12 + + \ No newline at end of file diff --git a/demo/bin/macos/EXTENSION-NAME.macos.template_release.universal.framework/Resources/Info.plist b/demo/bin/macos/EXTENSION-NAME.macos.template_release.universal.framework/Resources/Info.plist new file mode 100644 index 0000000..af7e3c9 --- /dev/null +++ b/demo/bin/macos/EXTENSION-NAME.macos.template_release.universal.framework/Resources/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleExecutable + EXTENSION-NAME.macos.template_release.universal + CFBundleIdentifier + org.godotengine.EXTENSION-NAME.macos.template_release.universal + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + EXTENSION-NAME.macos.template_release.universal + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 1.0.0 + LSMinimumSystemVersion + 10.12 + + \ No newline at end of file