blob: 3db4ca092f81d8e5898de868726a005256b603b5 [file] [log] [blame]
def cc_static_flatbuffer(name, target, function, visibility = None):
"""Creates a cc_library which encodes a file as a Span.
args:
target, The file to encode.
function, The inline function, with full namespaces, to create.
"""
native.genrule(
name = name + "_gen",
tools = ["@org_frc971//aos:flatbuffers_static"],
srcs = [target],
outs = [name + ".h"],
cmd = "$(location @org_frc971//aos:flatbuffers_static) $(SRCS) $(OUTS) '" + function + "'",
)
native.cc_library(
name = name,
hdrs = [name + ".h"],
deps = [
"@com_google_absl//absl/types:span",
],
visibility = visibility,
)