| 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 flatbuffer target will be able to include | 11 # Targets that depend on the flatbuffer target will be able to include |
| 12 # the 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) | 17 # flatc_include_dirs (optional) |
| 18 # Specifies the directories which FlatBuffers compiler uses to find | 18 # Specifies the directories which FlatBuffers compiler uses to find |
| 19 # included .fbs files in. | 19 # included .fbs files in. Almost always should be empty. |
| 20 # | 20 # |
| 21 # The directories will be tried in the order given, and if all fail (or, | 21 # The list always has an implicit first item corresponding to the root of |
| 22 # as by default, none are specified) it will try to load relative to the | 22 # the source tree. This enables including .fbs files by absolute path. |
| 23 # directory of the schema file being parsed. | |
| 24 # | 23 # |
| 25 # TODO(pkalinnikov): Add repository root to this list, to allow including | 24 # The compiler will try the directories in the order given, and if all |
| 26 # by absolute path. | 25 # fail it will try to load relative to the directory of the schema file |
| 26 # being parsed. |
| 27 # | 27 # |
| 28 # deps (optional) | 28 # deps (optional) |
| 29 # Additional dependencies. | 29 # Additional dependencies. |
| 30 # | 30 # |
| 31 # Parameters for compiling the generated code: | 31 # Parameters for compiling the generated code: |
| 32 # | 32 # |
| 33 # defines (optional) | 33 # defines (optional) |
| 34 # 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 |
| 35 # code. | 35 # code. |
| 36 # | 36 # |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 if (defined(invoker.flatc_out_dir)) { | 72 if (defined(invoker.flatc_out_dir)) { |
| 73 out_dir = "$root_gen_dir/" + invoker.flatc_out_dir | 73 out_dir = "$root_gen_dir/" + invoker.flatc_out_dir |
| 74 } else { | 74 } else { |
| 75 out_dir = "{{source_gen_dir}}" | 75 out_dir = "{{source_gen_dir}}" |
| 76 } | 76 } |
| 77 | 77 |
| 78 outputs = [ | 78 outputs = [ |
| 79 "$out_dir/{{source_name_part}}_generated.h", | 79 "$out_dir/{{source_name_part}}_generated.h", |
| 80 ] | 80 ] |
| 81 | 81 |
| 82 args = [ "-c" ] | 82 args = [ |
| 83 "-c", |
| 84 "--keep-prefix", |
| 85 "-o", |
| 86 "$out_dir", |
| 87 "-I", |
| 88 rebase_path("//", root_build_dir), |
| 89 ] |
| 83 | 90 |
| 84 if (defined(invoker.flatc_include_dirs)) { | 91 if (defined(invoker.flatc_include_dirs)) { |
| 85 foreach(include_dir, invoker.flatc_include_dirs) { | 92 foreach(include_dir, invoker.flatc_include_dirs) { |
| 86 args += [ | 93 args += [ |
| 87 "-I", | 94 "-I", |
| 88 rebase_path(include_dir, "$root_build_dir"), | 95 rebase_path(include_dir, root_build_dir), |
| 89 ] | 96 ] |
| 90 } | 97 } |
| 91 } | 98 } |
| 92 | 99 |
| 93 args += [ | 100 args += [ "{{source}}" ] |
| 94 "-o", | |
| 95 "$out_dir", | |
| 96 "{{source}}", | |
| 97 ] | |
| 98 | 101 |
| 99 # The deps may have steps that have to run before running flatc. | 102 # The deps may have steps that have to run before running flatc. |
| 100 if (defined(invoker.deps)) { | 103 if (defined(invoker.deps)) { |
| 101 deps += invoker.deps | 104 deps += invoker.deps |
| 102 } | 105 } |
| 103 } | 106 } |
| 104 | 107 |
| 105 source_set(target_name) { | 108 source_set(target_name) { |
| 106 forward_variables_from(invoker, | 109 forward_variables_from(invoker, |
| 107 [ | 110 [ |
| (...skipping 22 matching lines...) Expand all Loading... |
| 130 ":$action_name", | 133 ":$action_name", |
| 131 ] | 134 ] |
| 132 | 135 |
| 133 # This will link any libraries in the deps (the use of invoker.deps in the | 136 # This will link any libraries in the deps (the use of invoker.deps in the |
| 134 # action won't link it). | 137 # action won't link it). |
| 135 if (defined(invoker.deps)) { | 138 if (defined(invoker.deps)) { |
| 136 deps += invoker.deps | 139 deps += invoker.deps |
| 137 } | 140 } |
| 138 } | 141 } |
| 139 } | 142 } |
| OLD | NEW |