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

Side by Side Diff: third_party/protobuf/proto_library.gni

Issue 2202233002: Path evaluation to protobuf plugin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows cross-compile in future Created 4 years, 4 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 | « components/tracing/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 protocol buffer. 5 # Compile a protocol buffer.
6 # 6 #
7 # Protobuf parameters: 7 # Protobuf parameters:
8 # 8 #
9 # proto_out_dir (optional) 9 # proto_out_dir (optional)
10 # Specifies the path suffix that output files are generated under. This 10 # Specifies the path suffix that output files are generated under. This
(...skipping 14 matching lines...) Expand all
25 # cc_generator_options (optional) 25 # cc_generator_options (optional)
26 # List of extra flags passed to the protocol compiler. If you need to 26 # List of extra flags passed to the protocol compiler. If you need to
27 # add an EXPORT macro to a protobuf's C++ header, set the 27 # add an EXPORT macro to a protobuf's C++ header, set the
28 # 'cc_generator_options' variable with the value: 28 # 'cc_generator_options' variable with the value:
29 # 'dllexport_decl=FOO_EXPORT:' (note trailing colon). 29 # 'dllexport_decl=FOO_EXPORT:' (note trailing colon).
30 # 30 #
31 # It is likely you also need to #include a file for the above EXPORT 31 # It is likely you also need to #include a file for the above EXPORT
32 # macro to work (see cc_include) and set 32 # macro to work (see cc_include) and set
33 # component_build_force_source_set = true. 33 # component_build_force_source_set = true.
34 # 34 #
35 # generator_plugin (optional) 35 # generator_plugin_label (optional)
36 # Name of plugin executable which generates custom cc stubs. 36 # GN label for plugin executable which generates custom cc stubs.
37 # Plugin itself should be dependency of the invoker.
38 # 37 #
39 # generator_plugin_suffix (required if generator_plugin set) 38 # generator_plugin_suffix (required if generator_plugin_label set)
40 # Suffix (before extension) for generated .cc and .h files. 39 # Suffix (before extension) for generated .cc and .h files.
41 # 40 #
42 # generator_plugin_options (optional) 41 # generator_plugin_options (optional)
43 # Extra flags passed to the plugin. See cc_generator_options. 42 # Extra flags passed to the plugin. See cc_generator_options.
44 # 43 #
45 # cc_include (optional) 44 # cc_include (optional)
46 # String listing an extra include that should be passed. 45 # String listing an extra include that should be passed.
47 # Example: cc_include = "foo/bar.h" 46 # Example: cc_include = "foo/bar.h"
48 # 47 #
49 # deps (optional) 48 # deps (optional)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 outputs += [ 158 outputs += [
160 "$out_dir/{{source_name_part}}.pb.cc", 159 "$out_dir/{{source_name_part}}.pb.cc",
161 "$out_dir/{{source_name_part}}.pb.h", 160 "$out_dir/{{source_name_part}}.pb.h",
162 ] 161 ]
163 args += [ 162 args += [
164 "--cpp_out", 163 "--cpp_out",
165 "$cc_generator_options$rel_out_dir", # Separated by colon. 164 "$cc_generator_options$rel_out_dir", # Separated by colon.
166 ] 165 ]
167 } 166 }
168 167
169 if (defined(invoker.generator_plugin)) { 168 if (defined(invoker.generator_plugin_label)) {
170 generator_plugin = invoker.generator_plugin 169 generator_plugin_label = invoker.generator_plugin_label
171 generator_plugin_suffix = invoker.generator_plugin_suffix 170 generator_plugin_suffix = invoker.generator_plugin_suffix
172 if (defined(invoker.generator_plugin_options)) { 171 if (defined(invoker.generator_plugin_options)) {
173 generator_plugin_options = invoker.generator_plugin_options 172 generator_plugin_options = invoker.generator_plugin_options
174 } else { 173 } else {
175 generator_plugin_options = "" 174 generator_plugin_options = ""
176 } 175 }
177 outputs += [ 176 outputs += [
178 "$out_dir/{{source_name_part}}$generator_plugin_suffix.cc", 177 "$out_dir/{{source_name_part}}$generator_plugin_suffix.cc",
179 "$out_dir/{{source_name_part}}$generator_plugin_suffix.h", 178 "$out_dir/{{source_name_part}}$generator_plugin_suffix.h",
180 ] 179 ]
180
181 # Straightforward way to get the name of executable doesn't work because
182 # root_out_dir and root_build_dir may differ in cross-compilation and
183 # also Windows executables have .exe at the end.
184
185 plugin_host_label = generator_plugin_label + "($host_toolchain)"
186 plugin_path = get_label_info(plugin_host_label, "root_out_dir") + "/" +
187 get_label_info(plugin_host_label, "name")
188 if (host_os == "win") {
189 plugin_path += ".exe"
190 }
191
192 # Need "./" for script to find plugin binary (working dir is not on PATH).
181 args += [ 193 args += [
182 "--plugin", 194 "--plugin",
183 "protoc-gen-plugin=./$generator_plugin", 195 "protoc-gen-plugin=./" + rebase_path(plugin_path, root_build_dir),
184 "--plugin_out", 196 "--plugin_out",
185 "$generator_plugin_options$rel_out_dir", # Separated by colon. 197 "$generator_plugin_options$rel_out_dir", # Separated by colon.
186 ] 198 ]
187 } 199 }
188 200
189 deps = [ 201 deps = [
190 protoc_label, 202 protoc_label,
191 ] 203 ]
204 if (defined(plugin_host_label)) {
205 deps += [ plugin_host_label ]
206 }
192 207
193 # The deps may have steps that have to run before running protobuf. 208 # The deps may have steps that have to run before running protobuf.
194 if (defined(invoker.deps)) { 209 if (defined(invoker.deps)) {
195 deps += invoker.deps 210 deps += invoker.deps
196 } 211 }
197 } 212 }
198 213
199 if (defined(invoker.component_build_force_source_set) && 214 if (defined(invoker.component_build_force_source_set) &&
200 invoker.component_build_force_source_set && 215 invoker.component_build_force_source_set &&
201 is_component_build) { 216 is_component_build) {
(...skipping 28 matching lines...) Expand all
230 ":$action_name", 245 ":$action_name",
231 ] 246 ]
232 247
233 # This will link any libraries in the deps (the use of invoker.deps in the 248 # This will link any libraries in the deps (the use of invoker.deps in the
234 # action won't link it). 249 # action won't link it).
235 if (defined(invoker.deps)) { 250 if (defined(invoker.deps)) {
236 deps += invoker.deps 251 deps += invoker.deps
237 } 252 }
238 } 253 }
239 } 254 }
OLDNEW
« no previous file with comments | « components/tracing/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698