diff --git a/ios.yml b/ios.yml index 9b6591fd..0f8c0189 100644 --- a/ios.yml +++ b/ios.yml @@ -20,6 +20,7 @@ - autoreconf -i - "cp ../../ios/autotools-ios-helper.sh ./autotools-ios-helper.sh" - "./autotools-ios-helper.sh -iphoneuniversal" + - "./autotools-ios-helper.sh -maccatalyst" :artifacts: :includes: - include/** diff --git a/ios/Lightway/Lightway.xcodeproj/project.pbxproj b/ios/Lightway/Lightway.xcodeproj/project.pbxproj index 2d5fef21..6b171d68 100644 --- a/ios/Lightway/Lightway.xcodeproj/project.pbxproj +++ b/ios/Lightway/Lightway.xcodeproj/project.pbxproj @@ -483,7 +483,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; + SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; @@ -520,7 +520,7 @@ PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; + SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,3"; diff --git a/ios/Lightway/build-xcframework.sh b/ios/Lightway/build-xcframework.sh index a8d14970..369ccca0 100755 --- a/ios/Lightway/build-xcframework.sh +++ b/ios/Lightway/build-xcframework.sh @@ -6,17 +6,27 @@ xcodebuild archive \ -scheme Lightway \ -archivePath "./Build/ios.xcarchive" \ -sdk iphoneos \ - SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO PLATFORM=universal + SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \ + SUPPORTS_MACCATALYST=NO # iOS Sim xcodebuild archive \ -scheme Lightway \ -archivePath "./Build/ios_sim.xcarchive" \ -sdk iphonesimulator \ - SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO PLATFORM=universal + SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \ + SUPPORTS_MACCATALYST=NO + +# Mac Catalyst +xcodebuild archive \ + -scheme Lightway \ + -archivePath "./Build/maccatalyst.xcarchive" \ + -destination 'platform=macOS,variant=Mac Catalyst' \ + SKIP_INSTALL=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO # Package XC Framework xcodebuild -create-xcframework \ -framework "./Build/ios.xcarchive/Products/Library/Frameworks/Lightway.framework" \ -framework "./Build/ios_sim.xcarchive/Products/Library/Frameworks/Lightway.framework" \ + -framework "./Build/maccatalyst.xcarchive/Products/Library/Frameworks/Lightway.framework" \ -output "./Build/Lightway.xcframework" diff --git a/ios/autotools-ios-helper.sh b/ios/autotools-ios-helper.sh index 290fb502..4e5eeec2 100755 --- a/ios/autotools-ios-helper.sh +++ b/ios/autotools-ios-helper.sh @@ -134,6 +134,43 @@ build_tvos_universal_binary() { "${PREFIX}/${CONFIG}-appletvos/lib/${LIB_NAME}" \ "${PREFIX}/${CONFIG}-appletvsimulator/lib/${LIB_NAME}" } + +build_maccatalyst_arm64() { + export SDK="macosx" + export PLATFORM="maccatalyst-arm64" + export EFFECTIVE_PLATFORM_NAME="-maccatalyst-arm64" + export ARCH_OPTS="--enable-armasm --enable-sp-asm" + export ARCH_FLAGS="-arch arm64" + export HOST_FLAGS="${ARCH_FLAGS} -target arm64-apple-ios13.1-macabi -isysroot $(xcrun --sdk ${SDK} --show-sdk-path) -iframework $(xcrun --sdk ${SDK} --show-sdk-path)/System/iOSSupport/System/Library/Frameworks" + export CHOST="arm64-apple-darwin" + build +} + +build_maccatalyst_x86_64() { + export SDK="macosx" + export PLATFORM="maccatalyst-x86_64" + export EFFECTIVE_PLATFORM_NAME="-maccatalyst-x86_64" + export ARCH_OPTS="" + export ARCH_FLAGS="-arch x86_64" + export HOST_FLAGS="${ARCH_FLAGS} -target x86_64-apple-ios13.1-macabi -isysroot $(xcrun --sdk ${SDK} --show-sdk-path) -iframework $(xcrun --sdk ${SDK} --show-sdk-path)/System/iOSSupport/System/Library/Frameworks" + export CHOST="x86_64-apple-darwin" + build +} + +build_maccatalyst_universal_binary() { + # Create catalyst universal binary + LIB_NAME="libwolfssl.a" + mkdir -p "${PREFIX}/${CONFIG}-maccatalyst/lib" + lipo -create -output "${PREFIX}/${CONFIG}-maccatalyst/lib/${LIB_NAME}" \ + "${PREFIX}/${CONFIG}-maccatalyst-arm64/lib/${LIB_NAME}" \ + "${PREFIX}/${CONFIG}-maccatalyst-x86_64/lib/${LIB_NAME}" +} + +build_maccatalyst() { + build_maccatalyst_arm64 + build_maccatalyst_x86_64 + build_maccatalyst_universal_binary +} # Locations PREFIX=${PREFIX:-"$(pwd)/../builds/wolfssl_ios"} CONFIG=${CONFIG:-"Release"} @@ -169,6 +206,9 @@ case "${TARGET}" in build_tvsimulator build_tvos_universal_binary ;; +-maccatalyst) + build_maccatalyst + ;; -all) build_iphoneos build_iphonesimulator