Chromium Code Reviews| Index: third_party/protobuf/proto_library.gni |
| diff --git a/third_party/protobuf/proto_library.gni b/third_party/protobuf/proto_library.gni |
| index a3b0b762332bd62fccd4494354ded74f91ab009c..db75e1b1b3e3e3602c8ec9ac06025adbb0727b19 100644 |
| --- a/third_party/protobuf/proto_library.gni |
| +++ b/third_party/protobuf/proto_library.gni |
| @@ -32,11 +32,10 @@ |
| # macro to work (see cc_include) and set |
| # component_build_force_source_set = true. |
| # |
| -# generator_plugin (optional) |
| -# Name of plugin executable which generates custom cc stubs. |
| -# Plugin itself should be dependency of the invoker. |
| +# generator_plugin_label (optional) |
| +# GN label for plugin executable which generates custom cc stubs. |
| # |
| -# generator_plugin_suffix (required if generator_plugin set) |
| +# generator_plugin_suffix (required if generator_plugin_label set) |
| # Suffix (before extension) for generated .cc and .h files. |
| # |
| # generator_plugin_options (optional) |
| @@ -166,8 +165,8 @@ template("proto_library") { |
| ] |
| } |
| - if (defined(invoker.generator_plugin)) { |
| - generator_plugin = invoker.generator_plugin |
| + if (defined(invoker.generator_plugin_label)) { |
| + generator_plugin_label = invoker.generator_plugin_label |
| generator_plugin_suffix = invoker.generator_plugin_suffix |
| if (defined(invoker.generator_plugin_options)) { |
| generator_plugin_options = invoker.generator_plugin_options |
| @@ -178,9 +177,22 @@ template("proto_library") { |
| "$out_dir/{{source_name_part}}$generator_plugin_suffix.cc", |
| "$out_dir/{{source_name_part}}$generator_plugin_suffix.h", |
| ] |
| + |
| + # Straightforward way to get the name of executable doesn't work because |
| + # root_out_dir and root_build_dir may differ in cross-compilation and |
| + # also Windows executables have .exe at the end. |
| + |
| + plugin_host_label = generator_plugin_label + "($host_toolchain)" |
| + generator_plugin_executable = |
| + rebase_path(get_label_info(plugin_host_label, "root_out_dir") + "/" + |
| + get_label_info(plugin_host_label, "name"), |
| + root_build_dir) |
| + if (is_win) { |
|
Nico
2016/08/02 17:38:27
This is likely wrong (also in the old place). I'm
kraynov
2016/08/02 19:28:50
Done.
|
| + generator_plugin_executable += ".exe" |
| + } |
| args += [ |
| "--plugin", |
| - "protoc-gen-plugin=./$generator_plugin", |
| + "protoc-gen-plugin=./$generator_plugin_executable", |
| "--plugin_out", |
| "$generator_plugin_options$rel_out_dir", # Separated by colon. |
| ] |
| @@ -189,6 +201,9 @@ template("proto_library") { |
| deps = [ |
| protoc_label, |
| ] |
| + if (defined(plugin_host_label)) { |
| + deps += [ plugin_host_label ] |
| + } |
| # The deps may have steps that have to run before running protobuf. |
| if (defined(invoker.deps)) { |