1# Copyright (C) 2021 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import("perfetto.gni") 16 17template("perfetto_cc_proto_descriptor") { 18 config("${target_name}_config") { 19 include_dirs = [ "${root_gen_dir}/${perfetto_root_path}" ] 20 } 21 22 action(target_name) { 23 generated_header = "${target_gen_dir}/${invoker.descriptor_name}.h" 24 descriptor_file_path = 25 get_label_info(invoker.descriptor_target, "target_gen_dir") + 26 "/${invoker.descriptor_name}" 27 28 script = "$perfetto_root_path/tools/gen_cc_proto_descriptor.py" 29 deps = [ invoker.descriptor_target ] 30 args = [ 31 "--gen_dir", 32 rebase_path(root_gen_dir, root_build_dir), 33 "--cpp_out", 34 rebase_path(generated_header, root_build_dir), 35 rebase_path(descriptor_file_path, root_build_dir), 36 ] 37 inputs = [ descriptor_file_path ] 38 outputs = [ generated_header ] 39 public_configs = [ ":${target_name}_config" ] 40 } 41} 42