| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 flatbuffer. | 5 # Compile a flatbuffer. |
| 6 # | 6 # |
| 7 # flatc_out_dir (optional) | 7 # flatc_out_dir (optional) |
| 8 # Specifies the path suffix that output files are generated under. This | 8 # Specifies the path suffix that output files are generated under. This |
| 9 # path will be appended to root_gen_dir. | 9 # path will be appended to root_gen_dir. |
| 10 # | 10 # |
| 11 # Targets that depend on the proto target will be able to include the | 11 # Targets that depend on the flatbuffer target will be able to include |
| 12 # resulting flatbuffers header with an include like: | 12 # the resulting FlatBuffers header with an include like: |
| 13 # #include "dir/for/my_flatbuffer/buffer_generated.h" | 13 # #include "dir/for/my_flatbuffer/buffer_generated.h" |
| 14 # If undefined, this defaults to matchign the input directory for each | 14 # If undefined, this defaults to matchign the input directory for each |
| 15 # .fbs file (you should almost always use the default mode). | 15 # .fbs file (you should almost always use the default mode). |
| 16 # | 16 # |
| 17 # flatc_include_dirs (optional) |
| 18 # Specifies the directories which FlatBuffers compiler uses to find |
| 19 # included .fbs files in. |
| 20 # |
| 21 # The directories will be tried in the order given, and if all fail (or, |
| 22 # as by default, none are specified) it will try to load relative to the |
| 23 # directory of the schema file being parsed. |
| 24 # |
| 25 # TODO(pkalinnikov): Add repository root to this list, to allow including |
| 26 # by absolute path. |
| 27 # |
| 17 # deps (optional) | 28 # deps (optional) |
| 18 # Additional dependencies. | 29 # Additional dependencies. |
| 19 # | 30 # |
| 20 # Parameters for compiling the generated code: | 31 # Parameters for compiling the generated code: |
| 21 # | 32 # |
| 22 # defines (optional) | 33 # defines (optional) |
| 23 # Defines to supply to the source set that compiles the generated source | 34 # Defines to supply to the source set that compiles the generated source |
| 24 # code. | 35 # code. |
| 25 # | 36 # |
| 26 # extra_configs (optional) | 37 # extra_configs (optional) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (defined(invoker.flatc_out_dir)) { | 72 if (defined(invoker.flatc_out_dir)) { |
| 62 out_dir = "$root_gen_dir/" + invoker.flatc_out_dir | 73 out_dir = "$root_gen_dir/" + invoker.flatc_out_dir |
| 63 } else { | 74 } else { |
| 64 out_dir = "{{source_gen_dir}}" | 75 out_dir = "{{source_gen_dir}}" |
| 65 } | 76 } |
| 66 | 77 |
| 67 outputs = [ | 78 outputs = [ |
| 68 "$out_dir/{{source_name_part}}_generated.h", | 79 "$out_dir/{{source_name_part}}_generated.h", |
| 69 ] | 80 ] |
| 70 | 81 |
| 71 args = [ | 82 args = [ "-c" ] |
| 72 "-c", | 83 |
| 84 if (defined(invoker.flatc_include_dirs)) { |
| 85 foreach(include_dir, invoker.flatc_include_dirs) { |
| 86 args += [ |
| 87 "-I", |
| 88 rebase_path(include_dir, "$root_build_dir"), |
| 89 ] |
| 90 } |
| 91 } |
| 92 |
| 93 args += [ |
| 73 "-o", | 94 "-o", |
| 74 "$out_dir", | 95 "$out_dir", |
| 75 "{{source}}", | 96 "{{source}}", |
| 76 ] | 97 ] |
| 77 | 98 |
| 78 # The deps may have steps that have to run before running flatc. | 99 # The deps may have steps that have to run before running flatc. |
| 79 if (defined(invoker.deps)) { | 100 if (defined(invoker.deps)) { |
| 80 deps += invoker.deps | 101 deps += invoker.deps |
| 81 } | 102 } |
| 82 } | 103 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 94 configs += invoker.extra_configs | 115 configs += invoker.extra_configs |
| 95 } | 116 } |
| 96 | 117 |
| 97 if (defined(invoker.testonly)) { | 118 if (defined(invoker.testonly)) { |
| 98 testonly = invoker.testonly | 119 testonly = invoker.testonly |
| 99 } | 120 } |
| 100 | 121 |
| 101 public_configs = [ "//third_party/flatbuffers:flatbuffers_config" ] | 122 public_configs = [ "//third_party/flatbuffers:flatbuffers_config" ] |
| 102 | 123 |
| 103 public_deps = [ | 124 public_deps = [ |
| 104 # The generated headers reference headers within flatbuffers, so | 125 # The generated headers reference headers within FlatBuffers, so |
| 105 # dependencies must be able to find those headers too. | 126 # dependencies must be able to find those headers too. |
| 106 "//third_party/flatbuffers", | 127 "//third_party/flatbuffers", |
| 107 ] | 128 ] |
| 108 deps = [ | 129 deps = [ |
| 109 ":$action_name", | 130 ":$action_name", |
| 110 ] | 131 ] |
| 111 | 132 |
| 112 # This will link any libraries in the deps (the use of invoker.deps in the | 133 # This will link any libraries in the deps (the use of invoker.deps in the |
| 113 # action won't link it). | 134 # action won't link it). |
| 114 if (defined(invoker.deps)) { | 135 if (defined(invoker.deps)) { |
| 115 deps += invoker.deps | 136 deps += invoker.deps |
| 116 } | 137 } |
| 117 } | 138 } |
| 118 } | 139 } |
| OLD | NEW |