OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 # Compile a flatbuffer. | 5 # Compile a flatbuffer. |
6 # | 6 # |
7 # flatc_out_dir (optional) | 7 # flatc_out_dir (optional) |
8 # Specifies the path suffix that output files are generated under. This | 8 # Specifies the path suffix that output files are generated under. This |
9 # path will be appended to root_gen_dir. | 9 # path will be appended to root_gen_dir. |
10 # | 10 # |
11 # Targets that depend on the flatbuffer target will be able to include | 11 # Targets that depend on the proto target will be able to include the |
12 # the resulting FlatBuffers header with an include like: | 12 # resulting flatbuffers header with an include like: |
13 # #include "dir/for/my_flatbuffer/buffer_generated.h" | 13 # #include "dir/for/my_flatbuffer/buffer_generated.h" |
14 # If undefined, this defaults to matchign the input directory for each | 14 # If undefined, this defaults to matchign the input directory for each |
15 # .fbs file (you should almost always use the default mode). | 15 # .fbs file (you should almost always use the default mode). |
16 # | 16 # |
17 # flatc_include_dirs (optional) | |
18 # Specifies the directories which FlatBuffers compiler uses to find | |
19 # included .fbs files in. | |
20 # | |
21 # The directories will be tried in the order given, and if all fail (or, | |
22 # as by default, none are specified) it will try to load relative to the | |
23 # directory of the schema file being parsed. | |
24 # | |
25 # TODO(pkalinnikov): Add repository root to this list, to allow including | |
26 # by absolute path. | |
27 # | |
28 # deps (optional) | 17 # deps (optional) |
29 # Additional dependencies. | 18 # Additional dependencies. |
30 # | 19 # |
31 # Parameters for compiling the generated code: | 20 # Parameters for compiling the generated code: |
32 # | 21 # |
33 # defines (optional) | 22 # defines (optional) |
34 # Defines to supply to the source set that compiles the generated source | 23 # Defines to supply to the source set that compiles the generated source |
35 # code. | 24 # code. |
36 # | 25 # |
37 # extra_configs (optional) | 26 # extra_configs (optional) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (defined(invoker.flatc_out_dir)) { | 61 if (defined(invoker.flatc_out_dir)) { |
73 out_dir = "$root_gen_dir/" + invoker.flatc_out_dir | 62 out_dir = "$root_gen_dir/" + invoker.flatc_out_dir |
74 } else { | 63 } else { |
75 out_dir = "{{source_gen_dir}}" | 64 out_dir = "{{source_gen_dir}}" |
76 } | 65 } |
77 | 66 |
78 outputs = [ | 67 outputs = [ |
79 "$out_dir/{{source_name_part}}_generated.h", | 68 "$out_dir/{{source_name_part}}_generated.h", |
80 ] | 69 ] |
81 | 70 |
82 args = [ "-c" ] | 71 args = [ |
83 | 72 "-c", |
84 if (defined(invoker.flatc_include_dirs)) { | |
85 foreach(include_dir, invoker.flatc_include_dirs) { | |
86 args += [ | |
87 "-I", | |
88 rebase_path(include_dir, "$root_build_dir"), | |
89 ] | |
90 } | |
91 } | |
92 | |
93 args += [ | |
94 "-o", | 73 "-o", |
95 "$out_dir", | 74 "$out_dir", |
96 "{{source}}", | 75 "{{source}}", |
97 ] | 76 ] |
98 | 77 |
99 # The deps may have steps that have to run before running flatc. | 78 # The deps may have steps that have to run before running flatc. |
100 if (defined(invoker.deps)) { | 79 if (defined(invoker.deps)) { |
101 deps += invoker.deps | 80 deps += invoker.deps |
102 } | 81 } |
103 } | 82 } |
(...skipping 11 matching lines...) Expand all Loading... |
115 configs += invoker.extra_configs | 94 configs += invoker.extra_configs |
116 } | 95 } |
117 | 96 |
118 if (defined(invoker.testonly)) { | 97 if (defined(invoker.testonly)) { |
119 testonly = invoker.testonly | 98 testonly = invoker.testonly |
120 } | 99 } |
121 | 100 |
122 public_configs = [ "//third_party/flatbuffers:flatbuffers_config" ] | 101 public_configs = [ "//third_party/flatbuffers:flatbuffers_config" ] |
123 | 102 |
124 public_deps = [ | 103 public_deps = [ |
125 # The generated headers reference headers within FlatBuffers, so | 104 # The generated headers reference headers within flatbuffers, so |
126 # dependencies must be able to find those headers too. | 105 # dependencies must be able to find those headers too. |
127 "//third_party/flatbuffers", | 106 "//third_party/flatbuffers", |
128 ] | 107 ] |
129 deps = [ | 108 deps = [ |
130 ":$action_name", | 109 ":$action_name", |
131 ] | 110 ] |
132 | 111 |
133 # This will link any libraries in the deps (the use of invoker.deps in the | 112 # This will link any libraries in the deps (the use of invoker.deps in the |
134 # action won't link it). | 113 # action won't link it). |
135 if (defined(invoker.deps)) { | 114 if (defined(invoker.deps)) { |
136 deps += invoker.deps | 115 deps += invoker.deps |
137 } | 116 } |
138 } | 117 } |
139 } | 118 } |
OLD | NEW |