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

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

Issue 2082693002: Plugin support for protobuf compiler (protoc) targets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « build/protoc.gypi ('k') | tools/protoc_wrapper/protoc_wrapper.py » ('j') | 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
11 # path will be appended to the root_gen_dir. 11 # path will be appended to the root_gen_dir.
12 # 12 #
13 # Targets that depend on the proto target will be able to include the 13 # Targets that depend on the proto target will be able to include the
14 # resulting proto headers with an include like: 14 # resulting proto headers with an include like:
15 # #include "dir/for/my_proto_lib/foo.pb.h" 15 # #include "dir/for/my_proto_lib/foo.pb.h"
16 # If undefined, this defaults to matching the input directory for each 16 # If undefined, this defaults to matching the input directory for each
17 # .proto file (you should almost always use the default mode). 17 # .proto file (you should almost always use the default mode).
18 # 18 #
19 # cc_generator_options (optional) 19 # cc_generator_options (optional)
20 # List of extra flags passed to the protocol compiler. If you need to 20 # List of extra flags passed to the protocol compiler. If you need to
21 # add an EXPORT macro to a protobuf's C++ header, set the 21 # add an EXPORT macro to a protobuf's C++ header, set the
22 # 'cc_generator_options' variable with the value: 22 # 'cc_generator_options' variable with the value:
23 # 'dllexport_decl=FOO_EXPORT:' (note trailing colon). 23 # 'dllexport_decl=FOO_EXPORT:' (note trailing colon).
24 # 24 #
25 # It is likely you also need to #include a file for the above EXPORT 25 # It is likely you also need to #include a file for the above EXPORT
26 # macro to work. See cc_include. 26 # macro to work. See cc_include.
27 # 27 #
28 # cc_generator_plugin (optional)
29 # Plugin executable name. Expected .pb.h and .pb.cc as output.
xyzzyz 2016/06/20 20:17:46 If you drop the requirement that the plugin output
kraynov 2016/06/20 20:19:47 Acknowledged.
30 #
28 # cc_include (optional) 31 # cc_include (optional)
29 # String listing an extra include that should be passed. 32 # String listing an extra include that should be passed.
30 # Example: cc_include = "foo/bar.h" 33 # Example: cc_include = "foo/bar.h"
31 # 34 #
32 # deps (optional) 35 # deps (optional)
33 # Additional dependencies. 36 # Additional dependencies.
34 # 37 #
35 # Parameters for compiling the generated code: 38 # Parameters for compiling the generated code:
36 # 39 #
37 # defines (optional) 40 # defines (optional)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 ] 96 ]
94 97
95 args = [] 98 args = []
96 if (defined(invoker.cc_include)) { 99 if (defined(invoker.cc_include)) {
97 args += [ 100 args += [
98 "--include", 101 "--include",
99 invoker.cc_include, 102 invoker.cc_include,
100 ] 103 ]
101 } 104 }
102 105
106 if (defined(invoker.cc_generator_plugin)) {
107 cc_generator_plugin = invoker.cc_generator_plugin
108 } else {
109 cc_generator_plugin = ""
110 }
103 args += [ 111 args += [
104 "--protobuf", 112 "--protobuf",
105 "$rel_out_dir/{{source_name_part}}.pb.h", 113 "$rel_out_dir/{{source_name_part}}.pb.h",
106 "--proto-in-dir", 114 "--proto-in-dir",
107 "{{source_dir}}", 115 "{{source_dir}}",
108 "--proto-in-file", 116 "--proto-in-file",
109 "{{source_file_part}}", 117 "{{source_file_part}}",
118 "--cc-generator-plugin=$cc_generator_plugin",
110 119
111 # TODO(brettw) support system protobuf compiler. 120 # TODO(brettw) support system protobuf compiler.
112 "--use-system-protobuf=0", 121 "--use-system-protobuf=0",
113 ] 122 ]
114 123
115 protoc_label = "//third_party/protobuf:protoc($host_toolchain)" 124 protoc_label = "//third_party/protobuf:protoc($host_toolchain)"
116 args += [ 125 args += [
117 "--", 126 "--",
118 127
119 # Prepend with "./" so this will never pick up the system one (normally 128 # Prepend with "./" so this will never pick up the system one (normally
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 ]) 167 ])
159 168
160 sources = get_target_outputs(":$action_name") 169 sources = get_target_outputs(":$action_name")
161 170
162 if (defined(invoker.extra_configs)) { 171 if (defined(invoker.extra_configs)) {
163 configs += invoker.extra_configs 172 configs += invoker.extra_configs
164 } 173 }
165 174
166 public_configs = [ "//third_party/protobuf:using_proto" ] 175 public_configs = [ "//third_party/protobuf:using_proto" ]
167 176
168 public_deps = [ 177 # If using built-in cc generator the resulting headers reference headers
169 # The generated headers reference headers within protobuf_lite, so 178 # within protobuf_lite, hence dependencies require those headers too.
170 # dependencies must be able to find those headers too. 179 # In case of generator plugin such issues should be resolved by invoker.
171 "//third_party/protobuf:protobuf_lite", 180 if (!defined(invoker.cc_generator_plugin)) {
172 ] 181 public_deps = [
182 "//third_party/protobuf:protobuf_lite",
183 ]
184 }
173 deps = [ 185 deps = [
174 ":$action_name", 186 ":$action_name",
175 ] 187 ]
176 188
177 # This will link any libraries in the deps (the use of invoker.deps in the 189 # This will link any libraries in the deps (the use of invoker.deps in the
178 # action won't link it). 190 # action won't link it).
179 if (defined(invoker.deps)) { 191 if (defined(invoker.deps)) {
180 deps += invoker.deps 192 deps += invoker.deps
181 } 193 }
182 } 194 }
183 } 195 }
OLDNEW
« no previous file with comments | « build/protoc.gypi ('k') | tools/protoc_wrapper/protoc_wrapper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698