Skip to content

Instantly share code, notes, and snippets.

@neilco
Created November 21, 2013 10:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilco/7579740 to your computer and use it in GitHub Desktop.
Save neilco/7579740 to your computer and use it in GitHub Desktop.
Universal library build script
LIB_TARGET_NAME="${PRODUCT_NAME}"
if [ "${ACTION}" = "clean" ]
then
echo "Cleaning Libraries..."
cd "${PROJECT_DIR}"
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphoneos clean
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphonesimulator clean
fi
if [ "${ACTION}" = "build" ]
then
echo "Building Libraries"
cd "${PROJECT_DIR}"
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphoneos
xcodebuild -target "$LIB_TARGET_NAME" -configuration ${CONFIGURATION} -sdk iphonesimulator
# Check that this is what your static libraries are called
ARM_FILES="${PROJECT_DIR}/build/${CONFIGURATION}-iphoneos/lib${LIB_TARGET_NAME}.a"
I386_FILES="${PROJECT_DIR}/build/${CONFIGURATION}-iphonesimulator/lib${LIB_TARGET_NAME}.a"
mkdir -p "${PROJECT_DIR}/build/Universal"
echo "Creating library..."
lipo -create "$ARM_FILES" "$I386_FILES" -o "${PROJECT_DIR}/build/Universal/lib${PRODUCT_NAME}.a"
cp -R "${PROJECT_DIR}/build/${CONFIGURATION}-iphonesimulator/include/" "${PROJECT_DIR}/build/Universal/include/"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment