Skip to content

Commit f9d2de1

Browse files
Di Xu (SWE)facebook-github-bot
authored andcommitted
Create a buck genrule for schema_generated.h
Summary: Create a buck genrule for schema_generated.h - Genrule example: https://www.internalfb.com/code/fbsource/[6e2ed7840cb2]/fbcode/executorch/schema/targets.bzl?lines=20-41 This is needed to add dependency of qualcomm/schema_generated.h into the ET-QNN for Meta Wearable app bypass-github-export-checks bypass-github-pytorch-ci-checks bypass-github-executorch-ci-checks Reviewed By: kirklandsign Differential Revision: D60456032 fbshipit-source-id: fbf30b3b3468aca5f287f0ab159701e553dc5db7
1 parent 5890a9c commit f9d2de1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

backends/qualcomm/targets.bzl

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2+
3+
4+
def generate_schema_header(rule_name, srcs, headers, default_header):
5+
"""Generate header file given flatbuffer schema
6+
"""
7+
runtime.genrule(
8+
name = rule_name,
9+
srcs = srcs,
10+
# We're only generating a single file, so it seems like we could use
11+
# `out`, but `flatc` takes a directory as a parameter, not a single
12+
# file. Use `outs` so that `${OUT}` is expanded as the containing
13+
# directory instead of the file itself.
14+
outs = {header: [header] for header in headers},
15+
default_outs = [default_header],
16+
cmd = " ".join([
17+
"$(exe {})".format(runtime.external_dep_location("flatc")),
18+
"--cpp",
19+
"--cpp-std c++11",
20+
"--gen-mutable",
21+
"--scoped-enums",
22+
"-o ${OUT}",
23+
"${SRCS}",
24+
# Let our infra know that the file was generated.
25+
" ".join(["&& echo // @" + "generated >> ${OUT}/" + header for header in headers]),
26+
]),
27+
visibility = [], # Private
28+
)

0 commit comments

Comments
 (0)