Apple-Boost-BuildScript icon indicating copy to clipboard operation
Apple-Boost-BuildScript copied to clipboard

Fix iOS universal build

Open kyzmitch opened this issue 2 years ago • 4 comments

Fix build of FAT binary for iOS platform when there is e.g. arm64 version of static library is present for both iOS device and simulator.

kyzmitch avatar Aug 24 '22 14:08 kyzmitch

I don't find this right. Instead, you should not pass --universal to obtain xcframework.

Alternatively, you can pass --no-framework to obtain separate builds and then lipo them separately for device and for simulator. But for that you'd also have to comment out the scrunchAllLibsTogetherInOneLibPerPlatform call at https://github.com/faithfracture/Apple-Boost-BuildScript/blob/master/boost.sh#L1806

kambala-decapitator avatar Aug 25 '22 05:08 kambala-decapitator

Sorry, I didn't tell that my goal is to have static library only for use in c++ code in iOS app (no need to have Obj-c++ bindings). I'm passing --no-framework in addition to --universal and the app produces FAT static libraries with this change.

Could you clarify what did you mean by using lipo separately. I thought that --universal option could do this work already.

kyzmitch avatar Aug 25 '22 06:08 kyzmitch

my goal is to have static library only for use in c++ code in iOS app

you can also pack it in xcframework, it's not limited to objc

Could you clarify what did you mean by using lipo separately

I mean make separate libs for device and simulator: this will allow to have arm64 in both. Something like this: https://github.com/kambala-decapitator/vcmi-ios-depends/blob/main/deps/scripting/luajit.sh#L44-L47

kambala-decapitator avatar Aug 25 '22 06:08 kambala-decapitator

I tend to agree with @kambala-decapitator , a xcframework seems like the "cleanest" output. @kyzmitch is this not an option for you ?

guillaumealgis avatar Sep 03 '22 12:09 guillaumealgis