Bazel rule to embed arbitrary static binary data into an object file, suitable for linking with other cc rules.
Add the following to MODULE.bazel:
bazel_dep(name="rules_cc_embed_binary", version="0.1.0")Then in your BUILD file:
load("@rules_cc_embed_binary//embed_binary:defs.bzl", "cc_embed_binary")
cc_embed_binary(
name = "embedded_data",
src = "my_data.bin",
)
cc_test(
name = "test",
srcs = [..],
deps = [":embedded_data"],
)See the test directory in this repo.