1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") 2 3def define_common_targets(): 4 runtime.genrule( 5 name = "gen_xnnpack_schema", 6 srcs = [ 7 "runtime_schema.fbs", 8 ], 9 # We're only generating a single file, so it seems like we could use 10 # `out`, but `flatc` takes a directory as a parameter, not a single 11 # file. Use `outs` so that `${OUT}` is expanded as the containing 12 # directory instead of the file itself. 13 outs = { 14 "schema_generated.h": ["runtime_schema_generated.h"], 15 }, 16 cmd = " ".join([ 17 "$(exe {})".format(runtime.external_dep_location("flatc")), 18 "--cpp", 19 "--cpp-std c++11", 20 "--scoped-enums", 21 "-o ${OUT}", 22 "${SRCS}", 23 ]), 24 default_outs = ["."], 25 ) 26 27 runtime.cxx_library( 28 name = "xnnpack_flatbuffer_header", 29 srcs = [], 30 visibility = [ 31 "//executorch/backends/xnnpack/...", 32 ], 33 exported_headers = { 34 "schema_generated.h": ":gen_xnnpack_schema[schema_generated.h]", 35 }, 36 exported_external_deps = ["flatbuffers-api"], 37 ) 38