summaryrefslogtreecommitdiff
path: root/build_extra/flatbuffers/rust/rust_flatbuffer.gni
blob: 3d01562beb4f695f10cc2aa75139be69a6bb8883 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import("//build_extra/rust/rust.gni")

# TODO(ry) "flatbuffer.gni" should be "flatbuffers.gni" we should be consistent
# in our pluralization.
import("//build_extra/flatbuffers/flatbuffer.gni")

template("rust_flatbuffer") {
  compiled_action_foreach(target_name) {
    tool = "$flatbuffers_build_location:flatc"

    sources = invoker.sources
    deps = []
    out_dir = target_gen_dir

    outputs = [
      "$out_dir/{{source_name_part}}_generated.rs",
    ]

    args = [
      "--rust",
      "-o",
      rebase_path(out_dir, root_build_dir),
      "-I",
      rebase_path("//", root_build_dir),
    ]
    args += [ "{{source}}" ]

    # The deps may have steps that have to run before running flatc.
    if (defined(invoker.deps)) {
      deps += invoker.deps
    }
  }
}