bazelbuild / rules_apple

Bazel rules to build apps for Apple platforms.
Apache License 2.0
512 stars 269 forks source link

Add apple_metal_library rule #2421

Closed aaronsky closed 8 months ago

aaronsky commented 8 months ago

Resolves #2025.

This rule should be used in situations where the default resource processing behavior is insufficient, such as when custom copts are required. It is an adaptation of the metal_library rule found in rules_apple_line, with changes made to more closely resemble apple_intent_library.

Here's an example:

apple_metal_library(
    name = "metal_lib",
    copts = ["-w"],
    hdrs = ["shared.h"],
    srcs = ["shader1.metal", "shader2.metal"],
)

objc_library(
    name = "my_lib",
    ...
    data = [":metal_lib"],
)

This PR should be additive to how Metal is supported as data today, and should not introduce any breaking changes.

aaronsky commented 8 months ago

these test failures don't seem related to my changes

aaronsky commented 8 months ago

@brentleyjones is there anything else I should do before this can be merged?