xref: /aosp_15_r20/external/perfetto/src/tracing/core/BUILD.gn (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Copyright (C) 2020 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/test.gni")
17
18# Core tracing library, platform independent, no IPC layer, no service.
19source_set("core") {
20  public_deps = [
21    "../../../include/perfetto/ext/tracing/core",
22    "../../protozero",
23  ]
24  deps = [
25    "..:common",
26    "../../../gn:default_deps",
27    "../../../include/perfetto/tracing",
28    "../../../protos/perfetto/trace:zero",
29    "../../base",
30  ]
31  sources = [
32    "id_allocator.cc",
33    "id_allocator.h",
34    "in_process_shared_memory.cc",
35    "in_process_shared_memory.h",
36    "null_trace_writer.cc",
37    "null_trace_writer.h",
38    "patch_list.h",
39    "shared_memory_abi.cc",
40    "shared_memory_arbiter_impl.cc",
41    "shared_memory_arbiter_impl.h",
42    "trace_packet.cc",
43    "trace_writer_impl.cc",
44    "trace_writer_impl.h",
45    "virtual_destructors.cc",
46  ]
47}
48
49perfetto_unittest_source_set("unittests") {
50  testonly = true
51  deps = [
52    ":core",
53    "../../../gn:default_deps",
54    "../../../gn:gtest_and_gmock",
55    "../../../protos/perfetto/trace:cpp",
56    "../../../protos/perfetto/trace:zero",
57    "../../../protos/perfetto/trace/ftrace:cpp",
58    "../../../protos/perfetto/trace/perfetto:cpp",
59    "../../../src/protozero/filtering:bytecode_generator",
60    "../../base",
61    "../../base:test_support",
62    "../test:test_support",
63  ]
64
65  sources = [
66    "id_allocator_unittest.cc",
67    "null_trace_writer_unittest.cc",
68    "patch_list_unittest.cc",
69    "shared_memory_abi_unittest.cc",
70    "trace_packet_unittest.cc",
71  ]
72
73  # These tests rely on test_task_runner.h which
74  # has no Windows implementation.
75  if (!is_win) {
76    sources += [
77      "shared_memory_arbiter_impl_unittest.cc",
78      "trace_writer_impl_unittest.cc",
79    ]
80  }
81}
82
83perfetto_unittest_source_set("test_support") {
84  testonly = true
85  public_deps = [
86    "../../../include/perfetto/ext/tracing/core",
87    "../../../protos/perfetto/trace:cpp",
88    "../../../protos/perfetto/trace:zero",
89    "../../protozero",
90  ]
91  sources = [
92    "trace_writer_for_testing.cc",
93    "trace_writer_for_testing.h",
94  ]
95}
96