Skip to content

Commit

Permalink
[MacOS] Use framekwork to package GDExtension
Browse files Browse the repository at this point in the history
This allows it to be code-signed as a bundle so gatekeeper won't
complain when loaded by the editor.
  • Loading branch information
Faless committed Dec 20, 2023
1 parent d768508 commit 7a4e27e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
14 changes: 13 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,19 @@ env.Depends(sources, ssl + rtc)

# Make the shared library
result_name = "libwebrtc_native{}{}".format(env["suffix"], env["SHLIBSUFFIX"])
library = env.SharedLibrary(target=os.path.join(result_path, "lib", result_name), source=sources)
if env["godot_version"] != "3" and env["platform"] == "macos":
framework_path = os.path.join(
result_path, "lib", "libwebrtc_native.macos.{}.{}.framework".format(env["target"], env["arch"])
)
library_file = env.SharedLibrary(target=os.path.join(framework_path, result_name), source=sources)
plist_file = env.Substfile(
os.path.join(framework_path, "Resources", "Info.plist"),
"misc/dist/macos/Info.plist",
SUBST_DICT={"{LIBRARY_NAME}": result_name, "{DISPLAY_NAME}": "libwebrtc_native" + env["suffix"]},
)
library = [library_file, plist_file]
else:
library = env.SharedLibrary(target=os.path.join(result_path, "lib", result_name), source=sources)
Default(library)

# GDNativeLibrary
Expand Down
28 changes: 28 additions & 0 deletions misc/dist/macos/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>{LIBRARY_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.godotengine.webrtc-native</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleDisplayName</key>
<string>{DISPLAY_NAME}</string>
<key>CFBundleName</key>
<string>webrtc_native</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>LSMinimumSystemVersion</key>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion misc/scripts/package_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DESTDIR="${DESTINATION}/${VERSION}/${TYPE}"

mkdir -p ${DESTDIR}/lib

find "${ARTIFACTS}" -wholename "*/${VERSION}/${TYPE}/lib/*" | xargs cp -t "${DESTDIR}/lib/"
find "${ARTIFACTS}" -maxdepth 5 -wholename "*/${VERSION}/${TYPE}/lib/*" | xargs cp -r -t "${DESTDIR}/lib/"
find "${ARTIFACTS}" -wholename "*/LICENSE*" | xargs cp -t "${DESTDIR}/"

if [ $VERSION = "gdnative" ]; then
Expand Down
4 changes: 2 additions & 2 deletions misc/webrtc.gdextension
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ linux.debug.x86_64 = "lib/libwebrtc_native.linux.template_debug.x86_64.so"
linux.debug.x86_32 = "lib/libwebrtc_native.linux.template_debug.x86_32.so"
linux.debug.arm64 = "lib/libwebrtc_native.linux.template_debug.arm64.so"
linux.debug.arm32 = "lib/libwebrtc_native.linux.template_debug.arm32.so"
macos.debug = "lib/libwebrtc_native.macos.template_debug.universal.dylib"
macos.debug = "lib/libwebrtc_native.macos.template_debug.universal.framework"
windows.debug.x86_64 = "lib/libwebrtc_native.windows.template_debug.x86_64.dll"
windows.debug.x86_32 = "lib/libwebrtc_native.windows.template_debug.x86_32.dll"
android.debug.arm64 = "lib/libwebrtc_native.android.template_debug.arm64.so"
Expand All @@ -21,7 +21,7 @@ linux.release.x86_64 = "lib/libwebrtc_native.linux.template_release.x86_64.so"
linux.release.x86_32 = "lib/libwebrtc_native.linux.template_release.x86_32.so"
linux.release.arm64 = "lib/libwebrtc_native.linux.template_release.arm64.so"
linux.release.arm32 = "lib/libwebrtc_native.linux.template_release.arm32.so"
macos.release = "lib/libwebrtc_native.macos.template_release.universal.dylib"
macos.release = "lib/libwebrtc_native.macos.template_release.universal.framework"
windows.release.x86_64 = "lib/libwebrtc_native.windows.template_release.x86_64.dll"
windows.release.x86_32 = "lib/libwebrtc_native.windows.template_release.x86_32.dll"
android.release.arm64 = "lib/libwebrtc_native.android.template_release.arm64.so"
Expand Down

0 comments on commit 7a4e27e

Please sign in to comment.