Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: third_party/flatbuffers/flatbuffer.gni

Issue 1907603005: Add a dependency for FlatBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments on license Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/flatbuffers/README.chromium ('k') | third_party/flatbuffers/flatbuffers.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 # Compile a flatbuffer.
6 #
7 # flatc_out_dir (optional)
8 # Specifies the path suffix that output files are generated under. This
9 # path will be appended to root_gen_dir.
10 #
11 # Targets that depend on the proto target will be able to include the
12 # resulting flatbuffers header with an include like:
13 # #include "dir/for/my_flatbuffer/buffer_generated.h"
14 # If undefined, this defaults to matchign the input directory for each
15 # .fbs file (you should almost always use the default mode).
16 #
17 # deps (optional)
18 # Additional dependencies.
19 #
20 # Parameters for compiling the generated code:
21 #
22 # defines (optional)
23 # Defines to supply to the source set that compiles the generated source
24 # code.
25 #
26 # extra_configs (optional)
27 # A list of config labels that will be appended to the configs applying
28 # to the source set.
29 #
30 # testonly (optional)
31 # Boolean to indicate whether the generated source sets should be labeled
32 # as testonly.
33 #
34 # Example:
35 # flatbuffer("mylib") {
36 # sources = [
37 # "foo.fbs",
38 # ]
39 # }
40
41 import("//build/compiled_action.gni")
42
43 template("flatbuffer") {
44 assert(defined(invoker.sources), "Need sources for flatbuffers_library")
45
46 # Don't apply OS-specific sources filtering to the assignments later on.
47 # Platform files should have gotten filtered out in the sources assignment
48 # when this template was invoked. If they weren't, it was on purpose and
49 # this template shouldn't re-apply the filter.
50 set_sources_assignment_filter([])
51
52 action_name = "${target_name}_gen"
53 source_set_name = target_name
54 compiled_action_foreach(action_name) {
55 visibility = [ ":$source_set_name" ]
56
57 tool = "//third_party/flatbuffers:flatc"
58
59 sources = invoker.sources
60
61 if (defined(invoker.flatc_out_dir)) {
62 out_dir = "$root_gen_dir/" + invoker.flatc_out_dir
63 } else {
64 out_dir = "{{source_gen_dir}}"
65 }
66
67 outputs = [
68 "$out_dir/{{source_name_part}}_generated.h",
69 ]
70
71 args = [
72 "-c",
73 "-o",
74 "$out_dir",
75 "{{source}}",
76 ]
77
78 # The deps may have steps that have to run before running flatc.
79 if (defined(invoker.deps)) {
80 deps += invoker.deps
81 }
82 }
83
84 source_set(target_name) {
85 forward_variables_from(invoker,
86 [
87 "visibility",
88 "defines",
89 ])
90
91 sources = get_target_outputs(":$action_name")
92
93 if (defined(invoker.extra_configs)) {
94 configs += invoker.extra_configs
95 }
96
97 if (defined(invoker.testonly)) {
98 testonly = invoker.testonly
99 }
100
101 public_configs = [ "//third_party/flatbuffers:flatbuffers_config" ]
102
103 public_deps = [
104 # The generated headers reference headers within flatbuffers, so
105 # dependencies must be able to find those headers too.
106 "//third_party/flatbuffers",
107 ]
108 deps = [
109 ":$action_name",
110 ]
111
112 # This will link any libraries in the deps (the use of invoker.deps in the
113 # action won't link it).
114 if (defined(invoker.deps)) {
115 deps += invoker.deps
116 }
117 }
118 }
OLDNEW
« no previous file with comments | « third_party/flatbuffers/README.chromium ('k') | third_party/flatbuffers/flatbuffers.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698