Xcode:スクリプトによる静的ライブラリのパッケージング
1899 ワード
スクリプト#スクリプト#
呼び出し:
#!/bin/sh
#
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# build target
TARGET_NAME_Base=${PROJECT_NAME}
if [[ $1 ]]
then
TARGET_NAME_Base=$1
fi
#Release
CONFIGURATION="Release"
#
UNIVERSAL_OUTPUT_FOLDER="$HOME/Desktop/${CONFIGURATION}/"
# , framework
mkdir -p "${UNIVERSAL_OUTPUT_FOLDER}"
rm -rf "${UNIVERSAL_OUTPUT_FOLDER}/${TARGET_NAME_Base}.framework"
# Framework TARGET_NAME
xcodebuild -target "${TARGET_NAME_Base}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${TARGET_NAME_Base}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
# framework Debug
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${TARGET_NAME_Base}.framework" "${UNIVERSAL_OUTPUT_FOLDER}"
### framework, framework Debug
lipo -create "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${TARGET_NAME_Base}.framework/${TARGET_NAME_Base}" "${UNIVERSAL_OUTPUT_FOLDER}${TARGET_NAME_Base}.framework/${TARGET_NAME_Base}" -output "${UNIVERSAL_OUTPUT_FOLDER}/${TARGET_NAME_Base}.framework/${TARGET_NAME_Base}"
#
dir_path="${UNIVERSAL_OUTPUT_FOLDER}/${TARGET_NAME_Base}.framework/"
for file in ls $dir_path
do
if [[ ${file} =~ ".xcconfig" ]]
then
rm -f "${dir_path}/${file}"
fi
done
if [ -d "${SRCROOT}/build" ]
then
rm -rf "${SRCROOT}/build"
fi
rm -rf "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator" "${BUILD_DIR}/${CONFIGURATION}-iphoneos"
open "${UNIVERSAL_OUTPUT_FOLDER}"
呼び出し:
TestSDK
が静的ライブラリのパッケージ名です../${PROJECT_NAME}/shell.sh TestSDK