# # Copyright 2021 Google, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # Generate single c++ headers for each pdl # # Parameters: # include: Base include path (i.e. bt/gd) # source_root: Root of source relative to current BUILD.gn # sources: PDL files to use for generation. template("packetgen_headers") { all_dependent_config_name = "_${target_name}_all_dependent_config" config(all_dependent_config_name) { include_dirs = [ "${root_gen_dir}" ] } action(target_name) { forward_variables_from(invoker, [ "include", "sources", "source_root" ]) assert(defined(sources), "sources must be set") assert(defined(include), "include must be set") assert(defined(source_root), "source root must be set") outdir = rebase_path(root_gen_dir) source_root = rebase_path(source_root) script = "//common-mk/file_generator_wrapper.py" binfile = "${root_out_dir}/bluetooth_packetgen" args = [ binfile, "--include=${include}", "--out=${outdir}", "--source_root=${source_root}", ] outputs = [] foreach (source, sources) { rel_source = rebase_path(source, ".") args += [ rebase_path(source, source_root) ] outputs += [ string_replace("${outdir}/${rel_source}.h", ".pdl", "") ] } all_dependent_configs = [ ":${all_dependent_config_name}" ] if (defined(invoker.all_dependent_configs)) { all_dependent_configs += invoker.all_dependent_configs } if (defined(invoker.configs)) { configs += invoker.configs } } }