Skip to content

Instantly share code, notes, and snippets.

@annidy annidy/build.sh
Last active Mar 6, 2018

Embed
What would you like to do?
general build
#通用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
You can’t perform that action at this time.