With the release of @platforms, I can change targets of cc_library easily to arm64 by defining a set of constraints and using select() on those values. However, since Apple rules doesn't support @platforms and instead pass the config to C build configuration through --cpu and --crosstool_top. Being new to bazel, I am confused on how things operate over the boundary. Would be very helpful if someone can answer the following questions for me:
- How does the Apple rules pass configuration to the underlying dependencies such as
cc_library and objc_library? For example, if I want to build an XCFramework targeting x86_64 and arm64 that depends on cc_library target, how does the C target know which target to build and which toolchain to use under the absense of @platforms.
- If I have a
cc_library rule that uses select() on @platforms (eg. emiting TARGET_IOS local defines if the target is @platforms//os:ios) and have a apple_static_xcframework rules depends on it, what would be the result of the select? From my understanding, it would resolve to default condition, right? If that is the case, should I instead make select() on cpu for compatibility with Apple rules?
- What would be the current best way to build Apple multi-arch library? Should I stick to using
--cpu, or --platforms?
- Lastly, will Apple rules adopt
@platforms any time soon? I would be happy to help under some guidance.
With the release of
@platforms, I can change targets ofcc_libraryeasily toarm64by defining a set of constraints and usingselect()on those values. However, since Apple rules doesn't support@platformsand instead pass the config to C build configuration through--cpuand--crosstool_top. Being new to bazel, I am confused on how things operate over the boundary. Would be very helpful if someone can answer the following questions for me:cc_libraryandobjc_library? For example, if I want to build an XCFramework targetingx86_64andarm64that depends oncc_librarytarget, how does the C target know which target to build and which toolchain to use under the absense of@platforms.cc_libraryrule that usesselect()on@platforms(eg. emiting TARGET_IOS local defines if the target is@platforms//os:ios) and have aapple_static_xcframeworkrules depends on it, what would be the result of the select? From my understanding, it would resolve to default condition, right? If that is the case, should I instead makeselect()oncpufor compatibility with Apple rules?--cpu, or--platforms?@platformsany time soon? I would be happy to help under some guidance.