Skip to content

Question regarding on how Apple rules propagate configuration/targets to cc_library or objc_library #1592

Description

@Winnaries

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:

  1. 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.
  2. 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?
  3. What would be the current best way to build Apple multi-arch library? Should I stick to using --cpu, or --platforms?
  4. Lastly, will Apple rules adopt @platforms any time soon? I would be happy to help under some guidance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions