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