OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # Generate C++ and JavaScript source files from mojom files. |
| 6 template("mojom") { |
| 7 assert(defined(invoker.sources), |
| 8 "\"sources\" must be defined for the $target_name template.") |
| 9 |
| 10 generator_root = "//mojo/public/tools/bindings" |
| 11 generator_script = "$generator_root/mojom_bindings_generator.py" |
| 12 generator_sources = [ |
| 13 generator_script, |
| 14 "$generator_root/generators/cpp_templates/enum_declaration.tmpl", |
| 15 "$generator_root/generators/cpp_templates/enum_traits.tmpl", |
| 16 "$generator_root/generators/cpp_templates/interface_declaration.tmpl", |
| 17 "$generator_root/generators/cpp_templates/interface_definition.tmpl", |
| 18 "$generator_root/generators/cpp_templates/interface_macros.tmpl", |
| 19 "$generator_root/generators/cpp_templates/interface_proxy_declaration.tmpl", |
| 20 "$generator_root/generators/cpp_templates/interface_stub_declaration.tmpl", |
| 21 "$generator_root/generators/cpp_templates/module.cc.tmpl", |
| 22 "$generator_root/generators/cpp_templates/module.h.tmpl", |
| 23 "$generator_root/generators/cpp_templates/module-internal.h.tmpl", |
| 24 "$generator_root/generators/cpp_templates/params_definition.tmpl", |
| 25 "$generator_root/generators/cpp_templates/struct_builder_definition.tmpl", |
| 26 "$generator_root/generators/cpp_templates/struct_declaration.tmpl", |
| 27 "$generator_root/generators/cpp_templates/struct_definition.tmpl", |
| 28 "$generator_root/generators/cpp_templates/struct_destructor.tmpl", |
| 29 "$generator_root/generators/cpp_templates/struct_macros.tmpl", |
| 30 "$generator_root/generators/cpp_templates/wrapper_class_declaration.tmpl", |
| 31 "$generator_root/generators/js_templates/enum_definition.tmpl", |
| 32 "$generator_root/generators/js_templates/interface_definition.tmpl", |
| 33 "$generator_root/generators/js_templates/module.js.tmpl", |
| 34 "$generator_root/generators/js_templates/struct_definition.tmpl", |
| 35 "$generator_root/generators/mojom_cpp_generator.py", |
| 36 "$generator_root/generators/mojom_js_generator.py", |
| 37 "$generator_root/pylib/mojom/__init__.py", |
| 38 "$generator_root/pylib/mojom/error.py", |
| 39 "$generator_root/pylib/mojom/generate/__init__.py", |
| 40 "$generator_root/pylib/mojom/generate/data.py", |
| 41 "$generator_root/pylib/mojom/generate/generator.py", |
| 42 "$generator_root/pylib/mojom/generate/module.py", |
| 43 "$generator_root/pylib/mojom/generate/pack.py", |
| 44 "$generator_root/pylib/mojom/generate/template_expander.py", |
| 45 "$generator_root/pylib/mojom/parse/__init__.py", |
| 46 "$generator_root/pylib/mojom/parse/ast.py", |
| 47 "$generator_root/pylib/mojom/parse/lexer.py", |
| 48 "$generator_root/pylib/mojom/parse/parser.py", |
| 49 "$generator_root/pylib/mojom/parse/translate.py", |
| 50 ] |
| 51 generator_cpp_outputs = [ |
| 52 "$target_gen_dir/{{source_name_part}}.mojom.cc", |
| 53 "$target_gen_dir/{{source_name_part}}.mojom.h", |
| 54 "$target_gen_dir/{{source_name_part}}.mojom-internal.h", |
| 55 ] |
| 56 generator_js_outputs = [ |
| 57 "$target_gen_dir/{{source_name_part}}.mojom.js", |
| 58 ] |
| 59 |
| 60 target_visibility = ":$target_name" |
| 61 |
| 62 generator_target_name = target_name + "_generator" |
| 63 action_foreach(generator_target_name) { |
| 64 visibility = target_visibility |
| 65 hard_dep = true |
| 66 script = generator_script |
| 67 source_prereqs = generator_sources |
| 68 sources = invoker.sources |
| 69 outputs = generator_cpp_outputs + generator_js_outputs |
| 70 args = [ |
| 71 "{{source}}", |
| 72 "--use_chromium_bundled_pylibs", |
| 73 "-d", rebase_path("//", root_build_dir), |
| 74 "-o", rebase_path(target_gen_dir, root_build_dir), |
| 75 ] |
| 76 } |
| 77 |
| 78 source_set(target_name) { |
| 79 hard_dep = true |
| 80 sources = process_file_template(invoker.sources, generator_cpp_outputs) |
| 81 data = process_file_template(invoker.sources, generator_js_outputs) |
| 82 deps = [ |
| 83 ":$generator_target_name", |
| 84 "//mojo/public/cpp/bindings", |
| 85 ] |
| 86 } |
| 87 } |
| 88 |
OLD | NEW |