xref: /aosp_15_r20/external/perfetto/src/trace_processor/rpc/BUILD.gn (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Copyright (C) 2019 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
20# Prevent that this file is accidentally included in embedder builds.
21assert(enable_perfetto_trace_processor)
22assert(enable_perfetto_trace_processor_sqlite)
23
24# This source_set is used both by WASM (for the function-call-based query
25# interface) and by the :httpd module for the HTTP interface.
26source_set("rpc") {
27  sources = [
28    "query_result_serializer.cc",
29    "rpc.cc",
30    "rpc.h",
31  ]
32  deps = [
33    "..:lib",
34    "..:metatrace",
35    "../../../gn:default_deps",
36    "../../../include/perfetto/trace_processor",
37    "../../../protos/perfetto/trace_processor:zero",
38    "../../base",
39    "../../base:version",
40    "../../protozero",
41    "../../protozero:proto_ring_buffer",
42    "../util",
43  ]
44  public_deps = [
45    "../../../include/perfetto/ext/trace_processor/rpc:query_result_serializer",
46  ]
47}
48
49if (is_perfetto_build_generator || perfetto_build_standalone) {
50  # Static library target for RPC code. Needed for BigTrace in Google3.
51  # TODO(b/278208757): remove this when we migrate to using rpc_shell.
52  static_library("trace_processor_rpc") {
53    public_deps = [ ":rpc" ]
54  }
55}
56
57source_set("stdiod") {
58  sources = [
59    "stdiod.cc",
60    "stdiod.h",
61  ]
62  deps = [
63    ":rpc",
64    "..:lib",
65    "../../../gn:default_deps",
66    "../../base",
67  ]
68}
69
70perfetto_unittest_source_set("unittests") {
71  testonly = true
72  sources = [ "query_result_serializer_unittest.cc" ]
73  deps = [
74    ":rpc",
75    "..:lib",
76    "../../../gn:default_deps",
77    "../../../gn:gtest_and_gmock",
78    "../../../protos/perfetto/trace_processor:zero",
79    "../../base",
80    "../../protozero",
81  ]
82}
83
84if (enable_perfetto_trace_processor_httpd) {
85  source_set("httpd") {
86    sources = [
87      "httpd.cc",
88      "httpd.h",
89    ]
90    deps = [
91      ":rpc",
92      "../../../gn:default_deps",
93      "../../../include/perfetto/trace_processor",
94      "../../../protos/perfetto/trace_processor:zero",
95      "../../base",
96      "../../base/http",
97      "../../protozero",
98    ]
99  }
100}
101
102if (enable_perfetto_ui && is_wasm) {
103  source_set("wasm_bridge") {
104    sources = [ "wasm_bridge.cc" ]
105    deps = [
106      ":rpc",
107      "../../../gn:default_deps",
108      "../../../include/perfetto/trace_processor",
109      "../../base",
110    ]
111  }
112}
113
114if (enable_perfetto_benchmarks) {
115  source_set("benchmarks") {
116    testonly = true
117    deps = [
118      ":rpc",
119      "..:lib",
120      "../../../gn:benchmark",
121      "../../../gn:default_deps",
122      "../../../gn:sqlite",
123      "../../base",
124    ]
125    sources = [ "query_result_serializer_benchmark.cc" ]
126  }
127}
128