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

Side by Side Diff: mojo/public/tools/bindings/mojom.gni

Issue 1641163005: [Draft] try out the idea of adding export macros for C++ bindings. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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 mojom_generator_root = "//mojo/public/tools/bindings" 5 mojom_generator_root = "//mojo/public/tools/bindings"
6 mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py" 6 mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py"
7 mojom_generator_sources = [ 7 mojom_generator_sources = [
8 "$mojom_generator_root/generators/mojom_cpp_generator.py", 8 "$mojom_generator_root/generators/mojom_cpp_generator.py",
9 "$mojom_generator_root/generators/mojom_js_generator.py", 9 "$mojom_generator_root/generators/mojom_js_generator.py",
10 "$mojom_generator_root/generators/mojom_java_generator.py", 10 "$mojom_generator_root/generators/mojom_java_generator.py",
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 # typemaps (optional) 51 # typemaps (optional)
52 # A list of typemap files to apply during bindings generation. 52 # A list of typemap files to apply during bindings generation.
53 # 53 #
54 # variant (optional) 54 # variant (optional)
55 # A variant name to apply to generated bindings. Variant influences 55 # A variant name to apply to generated bindings. Variant influences
56 # generated source filenames as wells the symbols they define. 56 # generated source filenames as wells the symbols they define.
57 # 57 #
58 # testonly (optional) 58 # testonly (optional)
59 # 59 #
60 # visibility (optional) 60 # visibility (optional)
61 #
62 # TODO(yzshen): add comments.
63 # cpp_dll_export_declaration (optional)
64 # cpp_dll_export_include (optional)
65 # cpp_configs (optional)
61 template("mojom") { 66 template("mojom") {
62 assert( 67 assert(
63 defined(invoker.sources) || defined(invoker.deps) || 68 defined(invoker.sources) || defined(invoker.deps) ||
64 defined(invoker.public_deps), 69 defined(invoker.public_deps),
65 "\"sources\" or \"deps\" must be defined for the $target_name template.") 70 "\"sources\" or \"deps\" must be defined for the $target_name template.")
66 71
67 cpp_sources_suffix = "cpp_sources" 72 cpp_sources_suffix = "cpp_sources"
68 cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}" 73 cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}"
69 if (defined(invoker.sources)) { 74 if (defined(invoker.sources)) {
70 if (defined(invoker.variant)) { 75 if (defined(invoker.variant)) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 143 }
139 144
140 if (defined(invoker.typemaps)) { 145 if (defined(invoker.typemaps)) {
141 foreach(typemap, invoker.typemaps) { 146 foreach(typemap, invoker.typemaps) {
142 args += [ 147 args += [
143 "--typemap", 148 "--typemap",
144 rebase_path(typemap, root_build_dir), 149 rebase_path(typemap, root_build_dir),
145 ] 150 ]
146 } 151 }
147 } 152 }
153
154 if (defined(invoker.dll_export_declaration)) {
155 args += [
156 "--dll_export_declaration",
157 invoker.dll_export_declaration,
158 ]
159 }
160
161 if (defined(invoker.dll_export_include)) {
162 args += [
163 "--dll_export_include",
164 invoker.dll_export_include,
165 ]
166 }
148 } 167 }
149 } 168 }
150 169
151 source_set(target_name) { 170 source_set(target_name) {
152 if (defined(invoker.visibility)) { 171 if (defined(invoker.visibility)) {
153 visibility = invoker.visibility 172 visibility = invoker.visibility
154 } 173 }
155 if (defined(invoker.testonly)) { 174 if (defined(invoker.testonly)) {
156 testonly = invoker.testonly 175 testonly = invoker.testonly
157 } 176 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 220 }
202 221
203 if (defined(invoker.sources)) { 222 if (defined(invoker.sources)) {
204 # The generated C++ source files. The main reason to introduce this target 223 # The generated C++ source files. The main reason to introduce this target
205 # is so that mojo/public/cpp/bindings can depend on mojom interfaces without 224 # is so that mojo/public/cpp/bindings can depend on mojom interfaces without
206 # circular dependencies. It means that the target is missing the dependency 225 # circular dependencies. It means that the target is missing the dependency
207 # on mojo/public/cpp/bindings. No external targets should depend directly on 226 # on mojo/public/cpp/bindings. No external targets should depend directly on
208 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources 227 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources
209 # targets. 228 # targets.
210 source_set(cpp_sources_target_name) { 229 source_set(cpp_sources_target_name) {
230 if (defined(invoker.cpp_configs)) {
231 configs += invoker.cpp_configs
232 }
233
211 if (defined(invoker.testonly)) { 234 if (defined(invoker.testonly)) {
212 testonly = invoker.testonly 235 testonly = invoker.testonly
213 } 236 }
214 sources = process_file_template(invoker.sources, generator_cpp_outputs) 237 sources = process_file_template(invoker.sources, generator_cpp_outputs)
215 deps = [ 238 deps = [
216 ":$generator_target_name", 239 ":$generator_target_name",
217 "//base", 240 "//base",
218 "//mojo/public/interfaces/bindings:bindings__generator", 241 "//mojo/public/interfaces/bindings:bindings__generator",
219 ] 242 ]
220 foreach(d, all_deps) { 243 foreach(d, all_deps) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 # //mojo/something:something and we can append "_java" to get the java 288 # //mojo/something:something and we can append "_java" to get the java
266 # dependency name. 289 # dependency name.
267 full_name = get_label_info(d, "label_no_toolchain") 290 full_name = get_label_info(d, "label_no_toolchain")
268 deps += [ "${full_name}_java" ] 291 deps += [ "${full_name}_java" ]
269 } 292 }
270 293
271 srcjar_deps = [ ":$java_srcjar_target_name" ] 294 srcjar_deps = [ ":$java_srcjar_target_name" ]
272 } 295 }
273 } 296 }
274 } 297 }
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_cpp_generator.py ('k') | mojo/public/tools/bindings/mojom_bindings_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698