faithfracture / Apple-Boost-BuildScript

Script for building Boost for Apple platforms (iOS, iOS Simulator, tvOS, tvOS Simulator, OS X)
279 stars 111 forks source link

Fix iOS universal build #78

Open kyzmitch opened 2 years ago

kyzmitch commented 2 years ago

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.

kambala-decapitator commented 2 years ago

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

kyzmitch commented 2 years ago

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.

kambala-decapitator commented 2 years ago

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

guillaumealgis commented 2 years ago

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