xref: /aosp_15_r20/external/perfetto/src/traceconv/BUILD.gn (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Copyright (C) 2017 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/perfetto_host_executable.gni")
18import("../../gn/test.gni")
19import("../../gn/wasm.gni")
20
21executable("traceconv") {
22  testonly = true
23  deps = [
24    ":main",
25    "../../gn:default_deps",
26  ]
27}
28
29source_set("utils") {
30  deps = [
31    "../../gn:default_deps",
32    "../../include/perfetto/protozero",
33    "../../include/perfetto/trace_processor",
34    "../../protos/perfetto/trace:zero",
35    "../../protos/perfetto/trace/interned_data:zero",
36    "../../protos/perfetto/trace/profiling:zero",
37    "../../src/profiling:deobfuscator",
38    "../../src/profiling/symbolizer",
39    "../../src/profiling/symbolizer:symbolize_database",
40  ]
41  public_deps = [ "../../include/perfetto/ext/base" ]
42  if (enable_perfetto_zlib) {
43    public_deps += [ "../../gn:zlib" ]
44  }
45  sources = [
46    "utils.cc",
47    "utils.h",
48  ]
49}
50
51source_set("pprofbuilder") {
52  public_deps = [ "../../include/perfetto/profiling:pprof_builder" ]
53  deps = [
54    ":utils",
55    "../../gn:default_deps",
56    "../../include/perfetto/base",
57    "../../include/perfetto/protozero",
58    "../../include/perfetto/trace_processor",
59    "../../protos/perfetto/trace:zero",
60    "../../protos/perfetto/trace/profiling:zero",
61    "../../protos/third_party/pprof:zero",
62    "../../src/profiling/symbolizer",
63    "../../src/profiling/symbolizer:symbolize_database",
64    "../../src/trace_processor/containers:containers",
65  ]
66  sources = [ "pprof_builder.cc" ]
67}
68
69# Exposed in bazel builds.
70static_library("libpprofbuilder") {
71  complete_static_lib = true
72  public_deps = [ ":pprofbuilder" ]
73}
74
75source_set("lib") {
76  deps = [
77    ":gen_cc_trace_descriptor",
78    ":gen_cc_winscope_descriptor",
79    ":pprofbuilder",
80    ":utils",
81    "../../gn:default_deps",
82    "../../include/perfetto/base",
83    "../../include/perfetto/ext/traced:sys_stats_counters",
84    "../../include/perfetto/protozero",
85    "../../protos/perfetto/trace:zero",
86    "../../src/profiling:deobfuscator",
87    "../../src/profiling/symbolizer",
88    "../../src/profiling/symbolizer:symbolize_database",
89    "../../src/protozero:proto_ring_buffer",
90    "../../src/trace_processor:lib",
91    "../../src/trace_processor:storage_minimal",
92    "../../src/trace_processor/util:descriptors",
93    "../../src/trace_processor/util:gzip",
94    "../../src/trace_processor/util:protozero_to_text",
95    "../../src/trace_processor/util:trace_type",
96  ]
97  sources = [
98    "deobfuscate_profile.cc",
99    "deobfuscate_profile.h",
100    "symbolize_profile.cc",
101    "symbolize_profile.h",
102    "trace_to_firefox.cc",
103    "trace_to_firefox.h",
104    "trace_to_hprof.cc",
105    "trace_to_hprof.h",
106    "trace_to_json.cc",
107    "trace_to_json.h",
108    "trace_to_profile.cc",
109    "trace_to_profile.h",
110    "trace_to_systrace.cc",
111    "trace_to_systrace.h",
112    "trace_to_text.cc",
113    "trace_to_text.h",
114    "trace_to_text.h",
115    "trace_unpack.cc",
116    "trace_unpack.h",
117  ]
118}
119
120source_set("main") {
121  deps = [
122    ":lib",
123    "../../gn:default_deps",
124    "../../include/perfetto/ext/base:base",
125    "../base:version",
126  ]
127  sources = [ "main.cc" ]
128}
129
130if (enable_perfetto_ui) {
131  wasm_lib("traceconv_wasm") {
132    name = "traceconv"
133    deps = [
134      ":main",
135      "../../gn:default_deps",
136    ]
137  }
138}
139
140perfetto_cc_proto_descriptor("gen_cc_trace_descriptor") {
141  descriptor_name = "trace.descriptor"
142  descriptor_target = "../../protos/perfetto/trace:descriptor"
143}
144
145perfetto_cc_proto_descriptor("gen_cc_winscope_descriptor") {
146  descriptor_name = "winscope.descriptor"
147  descriptor_target = "../../protos/perfetto/trace/android:winscope_descriptor"
148}
149
150source_set("integrationtests") {
151  testonly = true
152  deps = [
153    ":lib",
154    "../../gn:default_deps",
155    "../../gn:gtest_and_gmock",
156    "../../include/perfetto/base",
157    "../../include/perfetto/ext/base:base",
158    "../../protos/third_party/pprof:cpp",
159    "../../protos/third_party/pprof:zero",
160    "../../src/base:test_support",
161  ]
162  sources = [
163    "pprof_reader.cc",
164    "pprof_reader.h",
165    "trace_to_pprof_integrationtest.cc",
166    "trace_to_text_integrationtest.cc",
167  ]
168}
169