Skip to content

Commit

Permalink
Merge pull request #16 from nitrag/swift-5.3
Browse files Browse the repository at this point in the history
Switch to XCFramework
  • Loading branch information
nitrag authored Sep 22, 2020
2 parents c244075 + a7bb20a commit 9d96954
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 23 deletions.
6 changes: 4 additions & 2 deletions Icomoon.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,14 @@
8FFB56341C2D7BFB00D2BE62 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = Icomoon/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
Expand All @@ -297,13 +298,14 @@
8FFB56351C2D7BFB00D2BE62 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
ENABLE_BITCODE = YES;
INFOPLIST_FILE = Icomoon/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
Expand Down
7 changes: 7 additions & 0 deletions Icomoon.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Icomoon.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
8 changes: 8 additions & 0 deletions Icomoon.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>PreviewsEnabled</key>
<false/>
</dict>
</plist>
38 changes: 17 additions & 21 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ 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"
MAIN_DIR="$(pwd)"
RESULT_FRAMEWORK="$(pwd)/${FRAMEWORK_NAME}.xcframework"


######################
Expand All @@ -30,8 +30,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}"

Expand Down Expand Up @@ -60,30 +58,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 "$MAIN_DIR"

0 comments on commit 9d96954

Please sign in to comment.