Last active
December 15, 2015 13:42
-
-
Save pxlshpr/0f59a1782fc24dd5a375 to your computer and use it in GitHub Desktop.
Xcode Run Script – Create universal binary file for 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
#CONFIG=${CONFIGURATION} | |
CONFIG=Release | |
# Step 1. Make sure the output directory exists | |
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIG}-universal | |
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" | |
# Step 2. Build Device and Simulator versions | |
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIG} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIG} -sdk iphonesimulator -arch x86_64 -arch i386 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build | |
# Step 3. Copy the framework structure to the universal folder. Subsequently opy the files of the swiftmodule (in Modules directory) of -iphonesimulator to the swiftmodule of universal framework directory. | |
cp -R "${BUILD_DIR}/${CONFIG}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/" | |
cp -R "${BUILD_DIR}/${CONFIG}-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}/${CONFIG}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIG}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}" | |
# This next bit will copy the framework to a convenient location, so that we can be sure it is always up-to-date | |
FRAMEWORK_PATH="${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" | |
FRAMEWORKS_PATH="/Users/ahmed/Frameworks" | |
mkdir -p ${FRAMEWORKS_PATH} | |
cp -pr ${FRAMEWORK_PATH} ${FRAMEWORKS_PATH} | |
#open ${FRAMEWORKS_PATH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment