Last active
March 6, 2018 02:24
-
-
Save annidy/e2b64af5231e2b4540a53ba477b45b9b to your computer and use it in GitHub Desktop.
general build
This file contains hidden or 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
#通用iOS工程静态库编译脚本 | |
BUILD_PROJ=$1 | |
BUILD_TARGET=$2 | |
BUILD_OUTPUT=$3 | |
BUILD_CONFIGURATION=$4 | |
BUILD_BIN=xcodebuild | |
#获取SDK编译版本 | |
BUILD_SDK_VERSION=$(${BUILD_BIN} -showsdks | grep iphoneos | sort -r | head -n 1 | grep -o '.\{4\}$') | |
if [[ ${BUILD_SDK_VERSION} = "" ]]; then | |
echo "Error: No iPhone SDK ..." | |
exit 1 | |
fi | |
BUILD_SDK_IPHONEOS="iphoneos${BUILD_SDK_VERSION}" | |
BUILD_SDK_IPHONESIMULATOR="iphonesimulator${BUILD_SDK_VERSION}" | |
if [[ -z "${BUILD_CONFIGURATION}" ]]; then | |
BUILD_CONFIGURATION="Release" | |
fi | |
buildSDK() { | |
${BUILD_BIN} -project ${BUILD_PROJ} -target ${BUILD_TARGET} -configuration ${BUILD_CONFIGURATION} -sdk ${BUILD_SDK_IPHONEOS} | |
${BUILD_BIN} -project ${BUILD_PROJ} -target ${BUILD_TARGET} -configuration ${BUILD_CONFIGURATION} -sdk ${BUILD_SDK_IPHONESIMULATOR} | |
cp -rf "build/${BUILD_CONFIGURATION}-iphoneos/${BUILD_OUTPUT}" . | |
lipo -create "build/${BUILD_CONFIGURATION}-iphoneos/${BUILD_OUTPUT}" "build/${BUILD_CONFIGURATION}-iphonesimulator/${BUILD_OUTPUT}" -output ${BUILD_OUTPUT} | |
} | |
buildSDK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment