Skip to content

Instantly share code, notes, and snippets.

@cconway25
Created August 11, 2014 15:06
Show Gist options
  • Select an option

  • Save cconway25/7ff167c6f98da33c5352 to your computer and use it in GitHub Desktop.

Select an option

Save cconway25/7ff167c6f98da33c5352 to your computer and use it in GitHub Desktop.
This run script will build the iphoneos and iphonesimulator schemes and then combine them into a single framework using the lipo tool.
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 -arch x86_64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
# Step 2. Copy the framework structure to the universal folder
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"
# Step 3. 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}"
@skywinder

Copy link
Copy Markdown

It seems, that it not works with xcworkspace. And unfortunately there is no way to get Scheme name from Xcode Build Settings. If someone found solution - please - let me know!

@holiday

holiday commented Jan 14, 2016

Copy link
Copy Markdown

Thanks for this! Finally got both iphoneos and simulator working fine!

@newMobileStar

Copy link
Copy Markdown

Thanks for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment