Each update SDK needs to be duplicated on the real machine, build in the emulator, and then merge the static library; to liberate both hands, try to write a script, one step to complete the above work. One, script file
#!/bin/bash #要build的target名 target_name=xxx #编译模式 release, Debug build_model=release #获取工程当前所在路径 project_path=$ (PWD) # Compile file path Buildpath=${project_path}/build #导出sdk地址 Exportsdkpath=~/desktop/${target_name}-sdk/${build_model} if [! d $ Exportsdkpath];
Then Mkdir-p $exportSdkPath; Fi #真机sdk路径 iphoneos_path=${buildpath}/${build_model}-iphoneos/lib${target_name}.a #模拟器sdk路径 simulator_path=${ BUILDPATH}/${BUILD_MODEL}-IPHONESIMULATOR/LIB${TARGET_NAME}.A #合并后sdk路径 merge_path=${exportsdkpath}/lib${target_ NAME}.A #build之前clean一下 xcodebuild-target ${target_name} clean #模拟器build xcodebuild-target ${target_name}-configurati On ${build_model}-sdk iphonesimulator #真机build xcodebuild-target ${target_name}-configuration ${build_model}-sdk IPhO
NEOs #复制头文件到目标文件夹 cp-r ${buildpath}/${build_model}-iphoneos/include/${target_name} ${exportsdkpath} #合并模拟器和真机. A package Lipo-create ${iphoneos_path} ${simulator_path}-output ${merge_path} #压缩合并后的文件 #压缩后的文件名 package_date= ' Date ' +%y-%m-%d %x ' SDK_zip_name=lib${target_name}_${build_model}_${package_date}.zip #跳转到sdk的输出路径 CD ${exportsdkpath} #压缩sdk输出路径下的所有文件 Zip-r ~/desktop/${target_name}-sdk/${sdk_zip_name}./* #打开合并后的sdk所在路径 Open ${exportsdkpath} #删除build文件 if [-D ${BUILDP ATH}]; Then RM-RF ${buildpath} fi
Ii. Methods of Use
1. Open terminal use VI, VIM command to create script file xxx.sh
2. Copy the above script content to xxx.sh
3. Import xxx.sh file into the SDK engineering root directory
4. Modify the corresponding project name Target_name, and compiling mode Build_model
5. Open the terminal CD to the SDK engineering root directory
6. Terminal execution SH xxx.sh
Turn from:
http://blog.csdn.net/zxw_xzr/article/details/79217516