在打静态库的时候用到了
lipo
命令,所以总结一下。.framework
与.a
静态库都是一样的操作使用。
- 查看静态库支持的CPU架构
1.lipo -info xx/xx/TestFramework.framework(framework所在的路径)
输出结果如下:
Architectures in the fat file: /Users/xxx/Desktop/TestFramework.framework/TestFramework are: armv7 arm64
2.lipo -detailed_info xx/xx/TestFramework.framework (framework所在的路径)
输出结果如下:
Fat header in: /Users/xxx/Desktop/TestFramework.framework/TestFramework
fat_magic 0xcafebabe
nfat_arch 2
architecture armv7
cputype CPU_TYPE_ARM
cpusubtype CPU_SUBTYPE_ARM_V7
capabilities 0x0
offset 16384
size 69232
align 2^14 (16384)
architecture arm64
cputype CPU_TYPE_ARM64
cpusubtype CPU_SUBTYPE_ARM64_ALL
capabilities 0x0
offset 98304
size 69280
align 2^14 (16384)
- 合并产出一个新的静态库
lipo -create 静态库1存储的路径 静态库2存放路径 ... -output 合并后存放的路径
输出结果如下:
lipo -create xxx/TestFramework1.framework xxx/TestFramework2.framework -output TestFramework3.framework
- 静态库拆分
命令 lipo 静态库源文件路径 -thin CPU架构名称 -output 拆分后文件存放路径
架构的名称就是常见的armv7/arm64等
lipo TestFramework.framework -thin armv7 -output TestFramework2.framework
- 提取单个平台
lipo -extract armv7 TestFramework1.framework -output TestFramework2.framework
- 替换指定CPU
lipo TestFramework1.framework -replace armv7 TestFramework2.framework -output TestFramework3.framework
- 移除指定CPU
lipo -remove armv7 TestFramework1.framework -output TestFramework2.framework