-
-
Save Tokuriku/96fe6f92e6f2abb87906 to your computer and use it in GitHub Desktop.
Script to put in an Aggregate Target of a Framework in Xcode 6 to create a Universal Framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal | |
# make sure the output directory exists | |
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" | |
# Step 1. Build Device and Simulator versions | |
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
# Step 2. Copy the framework structure (from iphoneos build) to the universal folder | |
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/" | |
# Step 3. Copy Swift modules (from iphonesimulator build) to the copied framework directory | |
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/." "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule" | |
# Step 4. Create universal binary file using lipo and place the combined executable in the copied framework directory | |
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}" | |
# Step 5. Convenience step to copy the framework to the project's directory | |
cp -R "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" "${PROJECT_DIR}" | |
# Step 6. Convenience step to open the project's directory in Finder | |
open "${PROJECT_DIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
I am facing same issue, I have created my framework in objective-c and using same scrip above, but after creating my framework and add to my project unable to run on simulatore this error i am getting
Undefined symbols for architecture x86_64:
"OBJC_CLASS$_SomeClass", referenced from:
objc-class-ref in VCXAppDelegate.o
"OBJC_CLASS$_SomeClass", referenced from:
objc-class-ref in VCXConfrenceViewController.o
ld: symbol(s) not found for architecture x86_64