-
-
Save siqin/1aee16b3be1370256f67 to your computer and use it in GitHub Desktop.
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
SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a" && | |
DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" && | |
UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal" && | |
UNIVERSAL_LIBRARY_PATH="${UNIVERSAL_LIBRARY_DIR}/${PRODUCT_NAME}" && | |
FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${PRODUCT_NAME}.framework" && | |
# Create framework directory structure. | |
rm -rf "${FRAMEWORK}" && | |
mkdir -p "${UNIVERSAL_LIBRARY_DIR}" && | |
mkdir -p "${FRAMEWORK}/Versions/A/Headers" && | |
mkdir -p "${FRAMEWORK}/Versions/A/Resources" && | |
# Generate universal binary for the device and simulator. | |
lipo "${SIMULATOR_LIBRARY_PATH}" "${DEVICE_LIBRARY_PATH}" -create -output "${UNIVERSAL_LIBRARY_PATH}" && | |
# Move files to appropriate locations in framework paths. | |
cp "${UNIVERSAL_LIBRARY_PATH}" "${FRAMEWORK}/Versions/A" && | |
ln -s "A" "${FRAMEWORK}/Versions/Current" && | |
ln -s "Versions/Current/Headers" "${FRAMEWORK}/Headers" && | |
ln -s "Versions/Current/Resources" "${FRAMEWORK}/Resources" && | |
ln -s "Versions/Current/${PRODUCT_NAME}" "${FRAMEWORK}/${PRODUCT_NAME}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator
xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphoneos -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos