IOS静态库封装(四)
来源:互联网 发布:thinking in java在线 编辑:程序博客网 时间:2024/06/04 17:41
六、整合模拟器版本和真机版本。
添加Target:aggregate
增加依赖项:
增加脚本文件:
更改脚本命和脚本内容:
脚本命:MultiPlatform Build
脚本内容:
set -e# If we're already inside this script then dieif [ -n "$RW_MULTIPLATFORM_BUILD_IN_PROGRESS" ]; thenexit 0fiexport RW_MULTIPLATFORM_BUILD_IN_PROGRESS=1RW_FRAMEWORK_NAME=${PROJECT_NAME}RW_INPUT_STATIC_LIB="lib${PROJECT_NAME}.a"RW_FRAMEWORK_LOCATION="${BUILT_PRODUCTS_DIR}/${RW_FRAMEWORK_NAME}.framework"function build_static_library { # Will rebuild the static library as specified # build_static_library sdk xcrun xcodebuild -project "${PROJECT_FILE_PATH}" \ -target "${TARGET_NAME}" \ -configuration "${CONFIGURATION}" \ -sdk "${1}" \ ONLY_ACTIVE_ARCH=NO \ BUILD_DIR="${BUILD_DIR}" \ OBJROOT="${OBJROOT}" \ BUILD_ROOT="${BUILD_ROOT}" \ SYMROOT="${SYMROOT}" $ACTION}function make_fat_library { # Will smash 2 static libs together # make_fat_library in1 in2 out xcrun lipo -create "${1}" "${2}" -output "${3}"}# 1 - Extract the platform (iphoneos/iphonesimulator) from the SDK nameif [[ "$SDK_NAME" =~ ([A-Za-z]+) ]]; thenRW_SDK_PLATFORM=${BASH_REMATCH[1]}elseecho "Could not find platform name from SDK_NAME: $SDK_NAME"exit 1fi# 2 - Extract the version from the SDKif [[ "$SDK_NAME" =~ ([0-9]+.*$) ]]; thenRW_SDK_VERSION=${BASH_REMATCH[1]}elseecho "Could not find sdk version from SDK_NAME: $SDK_NAME"exit 1fi# 3 - Determine the other platformif [ "$RW_SDK_PLATFORM" == "iphoneos" ]; thenRW_OTHER_PLATFORM=iphonesimulatorelseRW_OTHER_PLATFORM=iphoneosfi# 4 - Find the build directoryif [[ "$BUILT_PRODUCTS_DIR" =~ (.*)$RW_SDK_PLATFORM$ ]]; thenRW_OTHER_BUILT_PRODUCTS_DIR="${BASH_REMATCH[1]}${RW_OTHER_PLATFORM}"elseecho "Could not find other platform build directory."exit 1fi# Build the other platform.build_static_library "${RW_OTHER_PLATFORM}${RW_SDK_VERSION}"# If we're currently building for iphonesimulator, then need to rebuild# to ensure that we get both i386 and x86_64if [ "$RW_SDK_PLATFORM" == "iphonesimulator" ]; thenbuild_static_library "${SDK_NAME}"fi# Join the 2 static libs into 1 and push into the .frameworkmake_fat_library "${BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}" \"${RW_OTHER_BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}" \"${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}"# Ensure that the framework is present in both platform's build directoriescp -a "${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}" \"${RW_OTHER_BUILT_PRODUCTS_DIR}/${RW_FRAMEWORK_NAME}.framework/Versions/A/${RW_FRAMEWORK_NAME}"# Copy the framework to the user's desktopditto "${RW_FRAMEWORK_LOCATION}" "${HOME}/Desktop/${RW_FRAMEWORK_NAME}.framework"
选中我们的Target:Framework,再次编译CMD+B,会发现桌面上已经出现我们需要得静态库文件:MyFirstStaticLib.framework
将此文件放入任意工程即可使用。
博主脸皮甚厚,若有说错或者描述不清的地方,请回复留言,多多指教!
转载请注明出处:http://blog.csdn.net/dengbin9009/article/details/36178067
0 0
- IOS静态库封装(四)
- iOS 静态库封装
- IOS静态库封装(一)
- IOS静态库封装(二)
- IOS静态库封装(三)
- iOS静态库相关-封装lib
- IOS静态库相关-封装lib
- iOS 使用静态库封装sdk
- iOS静态库相关-封装lib
- iOS静态库相关-封装lib
- iOS静态库相关-封装lib
- .iOS静态库相关-封装lib
- iOS研发之静态库的封装
- iOS封装静态库,也就是.a文件
- iOS .framework静态库的封装
- iOS开发之静态库(四)—— 静态框架framework制作
- iOS开发之静态库(三)—— 图片、界面xib等资源文件封装到.a静态库
- iOS开发之静态库(五)—— 图片、界面xib等资源文件封装到静态框架framework
- 下标—Swift学习笔记(十五)
- 编程,其实30岁才开始
- js 拉框选中多个元素
- 每日一得--oracle 11g卸载
- 实现最大数的输出
- IOS静态库封装(四)
- linux shell 处理用户输入
- Makefile的二次展开
- SVN三种合并类型
- mysql常用
- 枚举类型的组合
- tnsnames.ora配制文件
- Hadoop2中的日志
- 线段树算法 ---- 扫描线之面积并