From 3cfb0aeac1153e6399eb60bb320225629d6765ea Mon Sep 17 00:00:00 2001 From: Alekos Filini Date: Fri, 21 Jun 2024 15:21:00 +0200 Subject: [PATCH] SDK build improvements for iOS --- sdk/libportal-ios/build-local-swift.sh | 21 +++++++++++++----- .../portalFFI.xcframework/Info.plist | 22 +++++++++++++------ .../Headers/portalFFI-umbrella.h | 4 ---- .../Modules/module.modulemap | 6 ----- .../Headers/portalFFI-umbrella.h | 4 ---- .../Modules/module.modulemap | 6 ----- 6 files changed, 30 insertions(+), 33 deletions(-) delete mode 100644 sdk/libportal-ios/portalFFI.xcframework/ios-arm64/portalFFI.framework/Headers/portalFFI-umbrella.h delete mode 100644 sdk/libportal-ios/portalFFI.xcframework/ios-arm64/portalFFI.framework/Modules/module.modulemap delete mode 100644 sdk/libportal-ios/portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/Headers/portalFFI-umbrella.h delete mode 100644 sdk/libportal-ios/portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/Modules/module.modulemap diff --git a/sdk/libportal-ios/build-local-swift.sh b/sdk/libportal-ios/build-local-swift.sh index e924e66..0eb527a 100755 --- a/sdk/libportal-ios/build-local-swift.sh +++ b/sdk/libportal-ios/build-local-swift.sh @@ -28,13 +28,22 @@ lipo ../target/aarch64-apple-ios-sim/release/libportal.a ../target/x86_64-apple- popd +rm -rf ./portalFFI.xcframework +rm -rf ../../target/include + +mkdir -pv ../../target/include +cp Sources/LibPortal/portalFFI.h ../../target/include/ +cp Sources/LibPortal/portalFFI.modulemap ../../target/include/module.modulemap + +# create new xcframework directory from bdk-ffi static libs and headers +xcodebuild -create-xcframework \ + -library "../../target/aarch64-apple-ios/release/libportal.a" \ + -headers "../../target/include" \ + -library "../../target/lipo-ios-sim/release/libportal.a" \ + -headers "../../target/include" \ + -output "./portalFFI.xcframework" + mv Sources/LibPortal/portal.swift Sources/LibPortal/LibPortal.swift -cp Sources/LibPortal/portalFFI.h portalFFI.xcframework/ios-arm64/portalFFI.framework/Headers -cp Sources/LibPortal/portalFFI.h portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/Headers -cp ../../target/aarch64-apple-ios/release/libportal.a portalFFI.xcframework/ios-arm64/portalFFI.framework/portalFFI -cp ../../target/lipo-ios-sim/release/libportal.a portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/portalFFI -rm Sources/LibPortal/portalFFI.h -rm Sources/LibPortal/portalFFI.modulemap PACKAGE=${PACKAGE-'0'} if [ "$PACKAGE" -eq '1' ]; then diff --git a/sdk/libportal-ios/portalFFI.xcframework/Info.plist b/sdk/libportal-ios/portalFFI.xcframework/Info.plist index c537b1e..0427aae 100644 --- a/sdk/libportal-ios/portalFFI.xcframework/Info.plist +++ b/sdk/libportal-ios/portalFFI.xcframework/Info.plist @@ -5,31 +5,39 @@ AvailableLibraries + BinaryPath + libportal.a + HeadersPath + Headers LibraryIdentifier - ios-arm64_x86_64-simulator + ios-arm64 LibraryPath - portalFFI.framework + libportal.a SupportedArchitectures arm64 - x86_64 SupportedPlatform ios - SupportedPlatformVariant - simulator + BinaryPath + libportal.a + HeadersPath + Headers LibraryIdentifier - ios-arm64 + ios-arm64_x86_64-simulator LibraryPath - portalFFI.framework + libportal.a SupportedArchitectures arm64 + x86_64 SupportedPlatform ios + SupportedPlatformVariant + simulator CFBundlePackageType diff --git a/sdk/libportal-ios/portalFFI.xcframework/ios-arm64/portalFFI.framework/Headers/portalFFI-umbrella.h b/sdk/libportal-ios/portalFFI.xcframework/ios-arm64/portalFFI.framework/Headers/portalFFI-umbrella.h deleted file mode 100644 index 16a3444..0000000 --- a/sdk/libportal-ios/portalFFI.xcframework/ios-arm64/portalFFI.framework/Headers/portalFFI-umbrella.h +++ /dev/null @@ -1,4 +0,0 @@ -// This is the "umbrella header" for our combined Rust code library. -// It needs to import all of the individual headers. - -#import "portalFFI.h" diff --git a/sdk/libportal-ios/portalFFI.xcframework/ios-arm64/portalFFI.framework/Modules/module.modulemap b/sdk/libportal-ios/portalFFI.xcframework/ios-arm64/portalFFI.framework/Modules/module.modulemap deleted file mode 100644 index 74dd76b..0000000 --- a/sdk/libportal-ios/portalFFI.xcframework/ios-arm64/portalFFI.framework/Modules/module.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module portalFFI { - umbrella header "portalFFI-umbrella.h" - - export * - module * { export * } -} diff --git a/sdk/libportal-ios/portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/Headers/portalFFI-umbrella.h b/sdk/libportal-ios/portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/Headers/portalFFI-umbrella.h deleted file mode 100644 index 16a3444..0000000 --- a/sdk/libportal-ios/portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/Headers/portalFFI-umbrella.h +++ /dev/null @@ -1,4 +0,0 @@ -// This is the "umbrella header" for our combined Rust code library. -// It needs to import all of the individual headers. - -#import "portalFFI.h" diff --git a/sdk/libportal-ios/portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/Modules/module.modulemap b/sdk/libportal-ios/portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/Modules/module.modulemap deleted file mode 100644 index 74dd76b..0000000 --- a/sdk/libportal-ios/portalFFI.xcframework/ios-arm64_x86_64-simulator/portalFFI.framework/Modules/module.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module portalFFI { - umbrella header "portalFFI-umbrella.h" - - export * - module * { export * } -}