Provides the following rules for organizing Metal builds:
metal_libraryfor reusable targets, akin tocc_library. Can be depended on bymetal_binaryandmetal_librarytargets. Can include.h,.hppheaders and.metalsources.metal_binaryfor producing a final.metallibfile to be loaded at runtime. Build structure-wise, it is akin tocc_binary, the root of a Metal dependency graph. Can depend onmetal_library. Can include.h,.hppheaders and.metalsources.
# Produces the final executable
cc_binary(
name = "app",
srcs = [
"vertex_types.h",
"main1.cc",
],
# Bundles shaders.metallib into a runfile for the executable
data = [":shaders"],
)
# Produces shaders.metallib
metal_binary(
name = "shaders",
srcs = [
"vertex_function.metal",
"fragment_function.metal",
],
deps = [":vertex_types"],
)
# A Metal library target usable by other Metal targets
metal_library(
name = "vertex_types",
hdrs = ["vertex_types.h"],
)