-
Notifications
You must be signed in to change notification settings - Fork 1
/
BUILD.gn
195 lines (181 loc) · 4.96 KB
/
BUILD.gn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# Copyright (C) 2017 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("gn/perfetto.gni")
declare_args() {
# Only for local development. When true the binaries (perfetto, traced, ...)
# are monolithic and don't use a common shared library. This is mainly to
# avoid LD_LIBRARY_PATH dances when testing locally.
monolithic_binaries = false
}
assert(!monolithic_binaries || !build_with_android)
group("all") {
testonly = true # allow to build also test targets
deps = [
":perfetto_unittests",
"src/protozero/protoc_plugin($host_toolchain)",
]
if (!build_with_chromium) {
deps += [
":perfetto",
":perfetto_benchmarks",
":perfetto_integrationtests",
":traced",
":traced_probes",
"protos/perfetto/config:merged_config", # For syntax-checking the proto.
"src/ipc/protoc_plugin:ipc_plugin($host_toolchain)",
"test/configs",
"tools:protoc_helper",
"tools/ftrace_proto_gen:ftrace_proto_gen",
"tools/proto_to_cpp",
]
if (!build_with_android) {
deps += [ "tools/trace_to_text" ]
}
if (is_linux || is_android) {
deps += [ "tools/skippy" ]
}
}
}
executable("perfetto_unittests") {
testonly = true
deps = [
"gn:default_deps",
"gn:gtest_main",
"src/base:unittests",
"src/protozero:unittests",
"src/tracing:unittests",
]
if (!build_with_chromium) {
deps += [
"src/ftrace_reader:unittests",
"src/ipc:unittests",
"src/perfetto_cmd:unittests",
"src/traced/probes:unittests",
"src/traced/probes/filesystem:unittests",
"tools/ftrace_proto_gen:unittests",
"tools/sanitizers_unittests",
]
}
}
if (!build_with_chromium) {
executable("perfetto_benchmarks") {
testonly = true
deps = [
"gn:default_deps",
"src/ftrace_reader:ftrace_reader_benchmarks",
"src/tracing:tracing_benchmarks",
"test:benchmark_main",
"test:end_to_end_benchmarks",
]
}
executable("perfetto_integrationtests") {
testonly = true
deps = [
"gn:default_deps",
"gn:gtest_main",
"src/ftrace_reader:ftrace_reader_integrationtests",
"test:end_to_end_integrationtests",
]
if (build_with_android) {
cflags = [ "-DPERFETTO_BUILD_WITH_ANDROID" ]
}
}
if (monolithic_binaries) {
libtraced_shared_target_type = "source_set"
} else {
libtraced_shared_target_type = "shared_library"
}
target(libtraced_shared_target_type, "libtraced_shared") {
deps = [
"gn:default_deps",
"src/traced/probes",
"src/traced/service",
]
}
# The unprivileged trace daemon that listens for Producer and Consumer
# connections, handles the coordination of the tracing sessions and owns the
# log buffers.
executable("traced") {
deps = [
":libtraced_shared",
"gn:default_deps",
]
sources = [
"src/traced/service/main.cc",
]
}
# The unprivileged daemon that is allowed to access tracefs (for ftrace).
# Registers as a Producer on the traced daemon.
executable("traced_probes") {
deps = [
":libtraced_shared",
"gn:default_deps",
]
sources = [
"src/traced/probes/main.cc",
]
}
# The command line client for Perfetto. Allows to configure / start / stop
# tracing, acting as a Consumer.
executable("perfetto") {
deps = [
"gn:default_deps",
"src/perfetto_cmd",
]
sources = [
"src/perfetto_cmd/main.cc",
]
if (is_android) {
deps += [ "src/base:android_task_runner" ]
}
if (build_with_android) {
cflags = [ "-DPERFETTO_BUILD_WITH_ANDROID" ]
libs = [
"binder",
"services",
"utils",
]
}
}
if (build_with_android) {
executable("trace_to_text") {
testonly = true
deps = [
"gn:default_deps",
"tools/trace_to_text:lib",
]
}
# This target exports perfetto trace protos in the Android build system,
# allowing both host and device targets to implement custom parsers based on
# our protos.
static_library("perfetto_trace_protos") {
deps = [
"protos/perfetto/trace:lite",
]
}
}
}
if (build_with_chromium) {
component("libperfetto") {
public_configs = [ "gn:public_config" ]
deps = [
"src/tracing",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
public_deps = [
"include/perfetto/tracing/core",
]
}
}