1# Copyright (C) 2024 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("../../gn/perfetto.gni") 16import("../../gn/perfetto_cc_proto_descriptor.gni") 17import("../../gn/test.gni") 18import("../../gn/wasm.gni") 19 20source_set("txt_to_pb") { 21 deps = [ 22 ":gen_cc_config_descriptor", 23 "../../gn:default_deps", 24 "../base", 25 "../protozero", 26 "../protozero/text_to_proto", 27 ] 28 sources = [ 29 "txt_to_pb.cc", 30 "txt_to_pb.h", 31 ] 32} 33 34source_set("pb_to_txt") { 35 deps = [ 36 ":gen_cc_config_descriptor", 37 "../../gn:default_deps", 38 "../base", 39 "../protozero", 40 "../trace_processor/util:descriptors", 41 "../trace_processor/util:protozero_to_text", 42 ] 43 sources = [ 44 "pb_to_txt.cc", 45 "pb_to_txt.h", 46 ] 47} 48 49source_set("main") { 50 deps = [ 51 ":pb_to_txt", 52 ":txt_to_pb", 53 "../../gn:default_deps", 54 "../../include/perfetto/ext/base:base", 55 ] 56 sources = [ "main.cc" ] 57} 58 59perfetto_cc_proto_descriptor("gen_cc_config_descriptor") { 60 descriptor_name = "config.descriptor" 61 descriptor_target = "../../protos/perfetto/config:descriptor" 62} 63 64executable("trace_config_utils") { 65 testonly = true 66 deps = [ 67 ":main", 68 "../../gn:default_deps", 69 ] 70} 71 72if (enable_perfetto_ui) { 73 wasm_lib("trace_config_utils_wasm") { 74 name = "trace_config_utils" 75 sources = [ "wasm.cc" ] 76 deps = [ 77 ":pb_to_txt", 78 ":txt_to_pb", 79 "../../gn:default_deps", 80 "../../include/perfetto/ext/base:base", 81 ] 82 } 83} 84 85perfetto_unittest_source_set("unittests") { 86 testonly = true 87 deps = [ 88 ":pb_to_txt", 89 ":txt_to_pb", 90 "../../gn:default_deps", 91 "../../gn:gtest_and_gmock", 92 "../../protos/perfetto/config:cpp", 93 "../../protos/perfetto/config/ftrace:cpp", 94 "../../protos/perfetto/trace:cpp", 95 "../base", 96 ] 97 sources = [ 98 "pb_to_txt_unittest.cc", 99 "txt_to_pb_unittest.cc", 100 ] 101} 102