From d39637233d0f2957f2e8ac7723428204e2b8e48e Mon Sep 17 00:00:00 2001 From: Ryan Gartin Date: Fri, 18 Sep 2020 17:51:19 -0400 Subject: [PATCH] Switch to using XCFramework as required by Xcode 12/Swift 5.3 --- Icomoon.xcodeproj/project.pbxproj | 2 + Icomoon.xcworkspace/contents.xcworkspacedata | 7 ++++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++ .../xcshareddata/WorkspaceSettings.xcsettings | 8 ++++ run.sh | 37 ++++++++----------- 5 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 Icomoon.xcworkspace/contents.xcworkspacedata create mode 100644 Icomoon.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Icomoon.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/Icomoon.xcodeproj/project.pbxproj b/Icomoon.xcodeproj/project.pbxproj index 2e7cf71..00397df 100644 --- a/Icomoon.xcodeproj/project.pbxproj +++ b/Icomoon.xcodeproj/project.pbxproj @@ -271,6 +271,7 @@ 8FFB56341C2D7BFB00D2BE62 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; @@ -295,6 +296,7 @@ 8FFB56351C2D7BFB00D2BE62 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + BUILD_LIBRARY_FOR_DISTRIBUTION = YES; CLANG_ENABLE_MODULES = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; diff --git a/Icomoon.xcworkspace/contents.xcworkspacedata b/Icomoon.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..37f010b --- /dev/null +++ b/Icomoon.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Icomoon.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Icomoon.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Icomoon.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Icomoon.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Icomoon.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/Icomoon.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/run.sh b/run.sh index b156248..ae34ef9 100755 --- a/run.sh +++ b/run.sh @@ -15,11 +15,10 @@ set -e LIB_DIR="/usr/local/lib/icomoon-swift" BUILD_DIR="/tmp/icomoon-build" FRAMEWORK_NAME="Icomoon" -SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/iphonesimulator/${FRAMEWORK_NAME}.framework" -DEVICE_LIBRARY_PATH="${BUILD_DIR}/iphoneos/${FRAMEWORK_NAME}.framework" -UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/iphoneuniversal" -FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${FRAMEWORK_NAME}.framework" -RESULT_FRAMEWORK="$(pwd)/${FRAMEWORK_NAME}.framework" +SIMULATOR_ARCHIVE="$BUILD_DIR/$FRAMEWORK_NAME.framework-iphoneos.xcarchive" +DEVICE_ARCHIVE="$BUILD_DIR/$FRAMEWORK_NAME.framework-iphonesimulator.xcarchive" +CATALYST_ARCHIVE="$BUILD_DIR/$FRAMEWORK_NAME.framework-catalyst.xcarchive" +RESULT_FRAMEWORK="$(pwd)/${FRAMEWORK_NAME}.xcframework" ###################### @@ -30,8 +29,6 @@ rm -rf "${RESULT_FRAMEWORK}" rm -rf "${BUILD_DIR}" mkdir -p "${BUILD_DIR}" -mkdir "${UNIVERSAL_LIBRARY_DIR}" -mkdir "${FRAMEWORK}" cp -r "${LIB_DIR}/." "${BUILD_DIR}" @@ -60,30 +57,28 @@ cp "$TTF_FONT" "${FRAMEWORK_NAME}/font.ttf" # Build Frameworks ###################### -xcodebuild -sdk iphonesimulator -configuration "Release" clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/iphonesimulator ENABLE_BITCODE=YES +# Device slice. +xcodebuild archive -workspace "$FRAMEWORK_NAME.xcworkspace" -scheme "$FRAMEWORK_NAME" -configuration Release -destination 'generic/platform=iOS' -archivePath "$SIMULATOR_ARCHIVE" SKIP_INSTALL=NO -xcodebuild -sdk iphoneos -configuration "Release" clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/iphoneos ENABLE_BITCODE=YES +# Simulator slice. +xcodebuild archive -workspace "$FRAMEWORK_NAME.xcworkspace" -scheme "$FRAMEWORK_NAME" -configuration Release -destination 'generic/platform=iOS Simulator' -archivePath "$DEVICE_ARCHIVE" SKIP_INSTALL=NO + +# Mac Catalyst slice. +xcodebuild archive -workspace "$FRAMEWORK_NAME.xcworkspace" -scheme "$FRAMEWORK_NAME" -configuration Release -destination 'platform=macOS,arch=x86_64,variant=Mac Catalyst' -archivePath "$CATALYST_ARCHIVE" SKIP_INSTALL=NO ###################### # Copy files Framework ##################### -cp -r "${DEVICE_LIBRARY_PATH}/." "${FRAMEWORK}" -cp -r "${SIMULATOR_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/." "${FRAMEWORK}/Modules/${FRAMEWORK_NAME}.swiftmodule" - - -###################### -# Make fat universal binary -###################### - -lipo "${SIMULATOR_LIBRARY_PATH}/${FRAMEWORK_NAME}" "${DEVICE_LIBRARY_PATH}/${FRAMEWORK_NAME}" -create -output "${FRAMEWORK}/${FRAMEWORK_NAME}" +#cp -r "${DEVICE_LIBRARY_PATH}/." "${FRAMEWORK}" +#cp -r "${SIMULATOR_LIBRARY_PATH}/Modules/${FRAMEWORK_NAME}.swiftmodule/." "${FRAMEWORK}/Modules/${FRAMEWORK_NAME}.swiftmodule" ###################### -# Copy the result to current dir and open in finder +# Make XCFramework ###################### -cp -r "${FRAMEWORK}" "${RESULT_FRAMEWORK}" +xcodebuild -create-xcframework -framework "$SIMULATOR_ARCHIVE/Products/Library/Frameworks/$FRAMEWORK_NAME.framework" -framework "$DEVICE_ARCHIVE/Products/Library/Frameworks/$FRAMEWORK_NAME.framework" -framework "$CATALYST_ARCHIVE/Products/Library/Frameworks/$FRAMEWORK_NAME.framework" -output "$RESULT_FRAMEWORK" -open "${RESULT_FRAMEWORK}" +open .