OLD | NEW |
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 # The 'proto_in_dir' variable is the path to the directory containing the | 7 # Protobuf parameters: |
8 # .proto files. If left out, it defaults to '.'. | |
9 # | 8 # |
10 # The 'proto_out_dir' variable specifies the path suffix that output files are | 9 # proto_in_dir (optional) |
11 # generated under. Targets that gyp-depend on my_proto_lib will be able to | 10 # The path to the directory containing the .proto files. If left out, it |
12 # include the resulting proto headers with an include like: | 11 # defaults to '.'. |
13 # #include "dir/for/my_proto_lib/foo.pb.h" | |
14 # If undefined, this defaults to matching the input directory. | |
15 # | 12 # |
16 # If you need to add an EXPORT macro to a protobuf's C++ header, set the | 13 # proto_out_dir (optional) |
17 # 'cc_generator_options' variable with the value: 'dllexport_decl=FOO_EXPORT:' | 14 # Specifies the path suffix that output files are generated under. |
18 # e.g. 'dllexport_decl=BASE_EXPORT:' | 15 # Targets that gyp-depend on my_proto_lib will be able to include the |
| 16 # resulting proto headers with an include like: |
| 17 # #include "dir/for/my_proto_lib/foo.pb.h" |
| 18 # If undefined, this defaults to matching the input directory. |
19 # | 19 # |
20 # It is likely you also need to #include a file for the above EXPORT macro to | 20 # cc_generator_options (optional) |
21 # work. You can do so with the 'cc_include' variable. | 21 # List of extra flags passed to the protocol compiler. If you need to |
22 # e.g. 'base/base_export.h' | 22 # add an EXPORT macro to a protobuf's C++ header, set the |
| 23 # 'cc_generator_options' variable with the value: |
| 24 # 'dllexport_decl=FOO_EXPORT:' (note trailing colon). |
| 25 # |
| 26 # It is likely you also need to #include a file for the above EXPORT |
| 27 # macro to work. See cc_include. |
| 28 # |
| 29 # cc_include (optional) |
| 30 # String listing an extra include that should be passed. |
| 31 # Example: cc_include = "foo/bar.h" |
| 32 # |
| 33 # Parameters for compiling the generated code: |
| 34 # |
| 35 # defines (optional) |
| 36 # Defines to supply to the source set that compiles the generated source |
| 37 # code. |
| 38 # |
| 39 # extra_configs (optional) |
| 40 # A list of config labels that will be appended to the configs applying |
| 41 # to the source set. |
23 # | 42 # |
24 # Example: | 43 # Example: |
25 # proto_library("mylib") { | 44 # proto_library("mylib") { |
26 # sources = [ | 45 # sources = [ |
27 # "foo.proto", | 46 # "foo.proto", |
28 # ] | 47 # ] |
29 # } | 48 # } |
30 | 49 |
31 template("proto_library") { | 50 template("proto_library") { |
32 assert(defined(invoker.sources), "Need sources for proto_library") | 51 assert(defined(invoker.sources), "Need sources for proto_library") |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 deps = [ protoc_label ] | 127 deps = [ protoc_label ] |
109 } | 128 } |
110 | 129 |
111 source_set(target_name) { | 130 source_set(target_name) { |
112 if (defined(invoker.visibility)) { | 131 if (defined(invoker.visibility)) { |
113 visibility = invoker.visibility | 132 visibility = invoker.visibility |
114 } | 133 } |
115 | 134 |
116 sources = get_target_outputs(":$action_name") | 135 sources = get_target_outputs(":$action_name") |
117 | 136 |
| 137 if (defined(invoker.defines)) { |
| 138 defines = invoker.defines |
| 139 } |
| 140 if (defined(invoker.extra_configs)) { |
| 141 configs += invoker.extra_configs |
| 142 } |
| 143 |
118 direct_dependent_configs = [ "//third_party/protobuf:using_proto" ] | 144 direct_dependent_configs = [ "//third_party/protobuf:using_proto" ] |
119 | 145 |
120 deps = [ | 146 deps = [ |
121 ":$action_name", | 147 ":$action_name", |
122 "//third_party/protobuf:protobuf_lite", | 148 "//third_party/protobuf:protobuf_lite", |
123 ] | 149 ] |
124 | 150 |
125 # The generated headers reference headers within protobuf_lite, so | 151 # The generated headers reference headers within protobuf_lite, so |
126 # dependencies must be able to find those headers too. | 152 # dependencies must be able to find those headers too. |
127 forward_dependent_configs_from = [ "//third_party/protobuf:protobuf_lite" ] | 153 forward_dependent_configs_from = [ "//third_party/protobuf:protobuf_lite" ] |
128 } | 154 } |
129 } | 155 } |
OLD | NEW |