Last active
March 17, 2017 09:04
-
-
Save IamAlchemist/a16856d3e8bacf38a5379d70e91f33fd to your computer and use it in GitHub Desktop.
package static library
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
#!/bin/sh | |
XBUILD="/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild" | |
SHELL_PATH=$(dirname $(pwd -P $0)/${0#\.\/}) | |
PROJECT_ROOT="$SHELL_PATH/../Comic" | |
PROJECT="$PROJECT_ROOT/Comic.xcodeproj" | |
TARGET="comic" | |
KEEP_INCLUDE_DIR="" | |
ARCH="Release" | |
#check input parameters | |
if [ $# -gt 0 ]; then | |
if [ "$1" = "Debug" ]; then | |
ARCH="$1" | |
elif [ "$1" = "Release" ]; then | |
ARCH="$1" | |
else | |
ARCH="Release" | |
fi | |
if [ "$1" = "KeepDir" ]; then | |
KEEP_INCLUDE_DIR=$1 | |
fi | |
if [ "$2" = "KeepDir" ]; then | |
KEEP_INCLUDE_DIR=$2 | |
fi | |
fi | |
PRODUCT="$PWD/Product/$ARCH" | |
mkdir -p "$PRODUCT" | |
$XBUILD -project $PROJECT -target $TARGET OTHER_CFLAGS="-fembed-bitcode" ONLY_ACTIVE_ARCH=NO -sdk iphonesimulator VALID_ARCHS="x86_64 i386" -configuration $ARCH clean build | |
cp $PROJECT_ROOT/build/$ARCH-iphonesimulator/lib$TARGET.a "./lib_i386_x8664.a" | |
# libArmv7.a: | |
$XBUILD -project $PROJECT -target $TARGET -sdk iphoneos -arch armv7 -configuration $ARCH clean build | |
cp $PROJECT_ROOT/build/$ARCH-iphoneos/lib$TARGET.a "./lib_armv7.a" | |
# libArm64.a: | |
$XBUILD -project $PROJECT -target $TARGET -sdk iphoneos -arch arm64 -configuration $ARCH clean build | |
cp $PROJECT_ROOT/build/$ARCH-iphoneos/lib$TARGET.a "./lib_arm64.a" | |
lipo -create "./lib_i386_x8664.a" "./lib_armv7.a" "./lib_arm64.a" -output "./libcomic.a" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment