.framework 文件:目前有 dynamic 和 static 两种类型;模拟器架构的还包含有x86、模拟器arm64架构(m1/m2芯片模拟器编译的产物),真机架构目前只支持最新的arm64架构,不管老机型。
注意:对于同一套代码生成的三个framework文件,是可以通过xcodebuild命令合并成 .xcframework文件的,拖进工程后可以同时支持模拟器和真机运行。
xcodebuild -create-xcframework -framework /Documents/chorus_detect/iPhoneAndSimu/Onnx/iphoneos/onnxruntime.framework -framework /Documents/chorus_detect/iPhoneAndSimu/Onnx/iphonesimulator/onnxruntime.framework -output /Documents/chorus_detect/iPhoneAndSimu/Onnx/onnxruntime.xcframework
.a 文件:目前只有 static 类型,是静态库文件;模拟器架构的还包含有模拟器x86、模拟器arm64架构(m1/m2芯片模拟器编译的产物),真机架构目前只支持最新的arm64架构,不管老机型。
注意:对于同一套代码生成的三个.a文件,合并过程却与上面的framework不同,x86、arm64架构可以通过lipo命令合并,但是模拟器arm64架构和真机arm64架构的.a文件却不能合并(报错是含相同架构)。
***Debug-iphonesimulator % lipo -create -output /Users/wangdacheng/Library/Developer/Xcode/DerivedData/testProj-aixvbdzqfyqrkthkpwqexdrxlhyo/Build/Products/liblibA.a /Users/wangdacheng/Library/Developer/Xcode/DerivedData/testProj-aixvbdzqfyqrkthkpwqexdrxlhyo/Build/Products/Debug-iphoneos/liblibA.a /Users/wangdacheng/Library/Developer/Xcode/DerivedData/testProj-aixvbdzqfyqrkthkpwqexdrxlhyo/Build/Products/Debug-iphonesimulator/liblibA.a
fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: /Users/wangdacheng/Library/Developer/Xcode/DerivedData/testProj-aixvbdzqfyqrkthkpwqexdrxlhyo/Build/Products/Debug-iphoneos/liblibA.a and /Users/wangdacheng/Library/Developer/Xcode/DerivedData/testProj-aixvbdzqfyqrkthkpwqexdrxlhyo/Build/Products/Debug-iphonesimulator/liblibA.a have the same architectures (arm64) and can't be in the same fat output file
没有什么好的合并方法,自建工程来验证的.a文件合并,也不行。所以最好能让三方库提供方该用framework封装方式,这种方式还能支持动态库类型。(公司内业务也可以改为直接集成源码)
Xcode15 Swift 制作 XCFramework:
https://blog.csdn.net/lyh1083908486/article/details/135447280