blob: f4048320defc10858359b83ed623cc79e24a134a [file] [log] [blame]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -08001# 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("perfetto.gni")
Primiano Tucci4c5efa42018-10-23 13:15:13 +010016import("proto_library.gni")
Primiano Tucci7e05fc12019-08-27 17:29:47 +020017
18if (perfetto_root_path == "//") {
Andres Medina2cf423c2019-03-29 10:27:49 -070019 import("//gn/standalone/sanitizers/vars.gni")
20} else {
21 import("//build/config/sanitizers/sanitizers.gni")
22}
23
Primiano Tucci8e627442019-08-28 07:58:38 +020024# Genereates a header files that contains a macro definition for each build flag
25# that is required by the codebase. This is to avoid sprinkling cflags all over
26# the places, which is very fragile especially for our codebase that needs to
27# deal with several build systems.
28# The way this works is the following:
29# - This rule generates a header that contains a bunch of lines like:
Primiano Tucci02c11762019-08-30 00:57:59 +020030# #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_BUILD()
Primiano Tucci8e627442019-08-28 07:58:38 +020031# - The generated header is included by base/build_config.h
32# - Source files in the codebase #include base/build_config and use the
33# pattern #if PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD)
34buildflag_gen_dir_ = "$root_gen_dir/$perfetto_root_path/build_config"
35action("gen_buildflags") {
36 script = "write_buildflag_header.py"
37 gen_header_path = "$buildflag_gen_dir_/perfetto_build_flags.h"
38
39 perfetto_component_build = false
40 if (defined(is_component_build) && is_component_build) {
41 perfetto_component_build = true
42 }
43 perfetto_force_dlog_on = perfetto_force_dlog == "on"
44 perfetto_force_dlog_off = perfetto_force_dlog == "off"
45
Primiano Tucci1a69d012021-09-07 14:52:27 +010046 perfetto_force_dcheck_on = perfetto_force_dcheck == "on"
47 perfetto_force_dcheck_off = perfetto_force_dcheck == "off"
48
Primiano Tucci18c0cff2019-09-09 17:09:03 -070049 # We can't just use (is_linux || is_android) in perfetto.gni because that
50 # doesn't work in Android Mac host builds. We lose the GN notion of OS once
51 # we run the tools/gen_xxx generators.
52 if (enable_perfetto_watchdog) {
53 perfetto_watchdog = "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() || " +
54 "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX()"
55 } else {
56 perfetto_watchdog = "0"
57 }
Primiano Tucci41af34f2019-10-01 13:09:22 +010058 if (enable_perfetto_tools) {
Florian Mayer4c955702020-06-10 20:37:38 +020059 perfetto_local_symbolizer =
60 "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() || " +
Joshua Gilpatrickcd349942020-11-11 15:18:37 -080061 "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() ||" +
62 "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN()"
Primiano Tucci41af34f2019-10-01 13:09:22 +010063 } else {
64 perfetto_local_symbolizer = "0"
65 }
Primiano Tucci8e627442019-08-28 07:58:38 +020066 response_file_contents = [
67 "--flags", # Keep this marker first.
68 "PERFETTO_ANDROID_BUILD=$perfetto_build_with_android",
Primiano Tucci8e627442019-08-28 07:58:38 +020069 "PERFETTO_CHROMIUM_BUILD=$build_with_chromium",
70 "PERFETTO_STANDALONE_BUILD=$perfetto_build_standalone",
71 "PERFETTO_START_DAEMONS=$start_daemons_for_testing",
Primiano Tucci02c11762019-08-30 00:57:59 +020072 "PERFETTO_IPC=$enable_perfetto_ipc",
Primiano Tucci18c0cff2019-09-09 17:09:03 -070073 "PERFETTO_WATCHDOG=$perfetto_watchdog",
Primiano Tucci8e627442019-08-28 07:58:38 +020074 "PERFETTO_COMPONENT_BUILD=$perfetto_component_build",
75 "PERFETTO_FORCE_DLOG_ON=$perfetto_force_dlog_on",
76 "PERFETTO_FORCE_DLOG_OFF=$perfetto_force_dlog_off",
Primiano Tucci1a69d012021-09-07 14:52:27 +010077 "PERFETTO_FORCE_DCHECK_ON=$perfetto_force_dcheck_on",
78 "PERFETTO_FORCE_DCHECK_OFF=$perfetto_force_dcheck_off",
Eric Seckler08460482019-12-16 17:40:21 +000079 "PERFETTO_VERBOSE_LOGS=$perfetto_verbose_logs_enabled",
Primiano Tucci02c11762019-08-30 00:57:59 +020080 "PERFETTO_VERSION_GEN=$enable_perfetto_version_gen",
Primiano Tucci02c11762019-08-30 00:57:59 +020081 "PERFETTO_TP_PERCENTILE=$enable_perfetto_trace_processor_percentile",
Eric Secklerde589952019-10-17 12:46:07 +010082 "PERFETTO_TP_LINENOISE=$enable_perfetto_trace_processor_linenoise",
Primiano Tucci3ce4e8e2021-01-04 11:00:19 +010083 "PERFETTO_TP_HTTPD=$enable_perfetto_trace_processor_httpd",
Eric Secklerde589952019-10-17 12:46:07 +010084 "PERFETTO_TP_JSON=$enable_perfetto_trace_processor_json",
Primiano Tucci41af34f2019-10-01 13:09:22 +010085 "PERFETTO_LOCAL_SYMBOLIZER=$perfetto_local_symbolizer",
Primiano Tucci1b5fdae2020-01-16 09:28:05 +000086 "PERFETTO_ZLIB=$enable_perfetto_zlib",
Primiano Tucci890cfbe2021-05-21 13:38:45 +010087 "PERFETTO_TRACED_PERF=$enable_perfetto_traced_perf",
88 "PERFETTO_HEAPPROFD=$enable_perfetto_heapprofd",
Florian Mayer3bf39d02021-05-24 14:04:35 +010089 "PERFETTO_STDERR_CRASH_DUMP=$enable_perfetto_stderr_crash_dump",
Primiano Tucci2277f062021-11-08 22:24:05 +000090 "PERFETTO_X64_CPU_OPT=$enable_perfetto_x64_cpu_opt",
Primiano Tucci8e627442019-08-28 07:58:38 +020091 ]
92
93 rel_out_path = rebase_path(gen_header_path, "$root_build_dir")
94 args = [
95 "--out",
96 rel_out_path,
97 "--rsp",
98 "{{response_file_name}}",
99 ]
100
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000101 outputs = [ gen_header_path ]
Primiano Tucci8e627442019-08-28 07:58:38 +0200102}
103
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100104# All targets should depend on this target to inherit the right flags and
105# include directories.
106group("default_deps") {
Lalit Maganti91fdb4c2022-03-03 23:41:28 +0000107 visibility = [ "../*" ] # Prevent chromium targets from depending on this (breaks component).
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100108 public_configs = [ ":default_config" ]
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000109 deps = [ ":gen_buildflags" ]
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200110 if (perfetto_build_standalone) {
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100111 public_deps = [
Primiano Tucci69132a12020-02-07 22:33:06 +0000112 "//gn/standalone:check_build_deps",
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100113 "//gn/standalone/libc++:deps",
114 "//gn/standalone/sanitizers:deps",
115 ]
Primiano Tucci69132a12020-02-07 22:33:06 +0000116 if (is_android) {
117 public_deps += [ "//gn/standalone:check_build_deps_android" ]
118 }
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100119 }
120}
121
122# The config that all targets in the perfetto codebase inherit by virtue of
123# having explicit deps on //gn:default_deps. This config is NOT propagated up to
124# embedders that depend on perfetto (e.g. chrome). :public_config (see below) is
125# used for that.
126config("default_config") {
Lalit Maganti91fdb4c2022-03-03 23:41:28 +0000127 visibility = [ "../*" ] # Prevent chromium targets from depending on this (breaks component).
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100128 configs = [ ":public_config" ]
129 defines = [ "PERFETTO_IMPLEMENTATION" ]
Florian Mayer5d09f5e2021-02-19 14:59:49 +0000130 include_dirs = [
131 "..",
132 "../src/profiling/memory/include",
133 ]
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100134
135 if (build_with_chromium && is_android) {
136 # Included for __android_log_print
137 libs = [ "log" ]
138 }
139}
140
141# This config is propagated to embedders via libperfetto. It's also included in
142# the default_config above.
143config("public_config") {
144 include_dirs = [
145 "../include",
146
Primiano Tucci8e627442019-08-28 07:58:38 +0200147 # For perfetto_build_flags.h
148 buildflag_gen_dir_,
Eric Secklerd7fd6c22020-01-22 18:46:35 +0000149
150 # For generated files (proto libraries etc). We add the directory here
151 # because we stop propagation of the configs for individual proto libraries
152 # to avoid duplicate include directory command line flags in compiler
153 # invocations, see proto_library.gni, crbug.com/1043279, crbug.com/gn/142.
154 "$root_gen_dir/$perfetto_root_path",
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100155 ]
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100156}
157
Andres Medina2cf423c2019-03-29 10:27:49 -0700158config("asan_instrumentation") {
159 if (use_sanitizer_configs_without_instrumentation) {
160 defines = [ "ADDRESS_SANITIZER_WITHOUT_INSTRUMENTATION" ]
161 }
162}
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800163
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200164if (perfetto_root_path != "//") {
165 config("gtest_and_gmock_embedder_config") {
166 include_dirs = [
167 "//testing/gtest/include",
168 "//testing/gmock/include",
169 ]
Eric Seckler57c89d92018-10-26 15:11:55 +0100170 }
171}
172
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100173group("gtest_and_gmock") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800174 testonly = true
175
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200176 if (perfetto_root_path == "//") {
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800177 public_deps = [
178 "//buildtools:gmock",
179 "//buildtools:gtest",
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800180 ]
181 } else {
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200182 public_configs = [ ":gtest_and_gmock_embedder_config" ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800183 public_deps = [
184 "//testing/gmock",
185 "//testing/gtest",
Florian Mayerd8bd81b2018-01-25 12:49:15 +0000186 ]
187 }
188}
189
190group("gtest_main") {
191 testonly = true
192
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200193 if (perfetto_root_path == "//") {
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000194 public_deps = [ "//buildtools:gtest_main" ]
Eric Secklera6ba1792019-01-02 12:51:00 +0000195 } else if (build_with_chromium) {
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000196 public_deps = [ "//base/test:run_all_unittests" ]
Florian Mayerd8bd81b2018-01-25 12:49:15 +0000197 } else {
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000198 public_deps = [ "//testing/gtest:gtest_main" ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800199 }
200}
201
Primiano Tuccid0001c32019-09-08 22:45:58 -0700202# Full protobuf is just for host tools .No binary shipped on device should
203# depend on this.
Primiano Tuccia3645202020-08-03 16:28:18 +0200204protobuf_full_deps_allowlist = [
Primiano Tuccid0001c32019-09-08 22:45:58 -0700205 "../src/ipc/protoc_plugin:*",
206 "../src/protozero/protoc_plugin:*",
Primiano Tucci3f003742021-05-14 19:25:14 +0100207 "../src/protozero/filtering:filter_util",
Primiano Tuccid0001c32019-09-08 22:45:58 -0700208 "../src/trace_processor:trace_processor_shell",
Primiano Tucci3f003742021-05-14 19:25:14 +0100209 "../src/protozero/filtering:filter_util",
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000210 "../tools/*",
Primiano Tuccid0001c32019-09-08 22:45:58 -0700211]
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100212
Primiano Tuccib7ebffd2019-09-09 07:42:35 -0700213group("protoc") {
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000214 public_deps = [ "${perfetto_protobuf_target_prefix}:protoc($host_toolchain)" ]
Primiano Tuccib7ebffd2019-09-09 07:42:35 -0700215}
Primiano Tuccid0001c32019-09-08 22:45:58 -0700216
Joel Fernandes80fc3cd2020-04-01 18:02:57 -0400217config("system_protoc") {
218 libs = [ "protoc" ] # This will link against libprotoc.so
219}
220
221config("system_protobuf") {
222 libs = [ "protobuf" ] # This will link against libprotobuf.so
223}
224
Lalit Magantie0986f32020-09-17 15:35:47 +0100225# protoc compiler library, it's used for building protoc plugins.
Primiano Tuccid0001c32019-09-08 22:45:58 -0700226group("protoc_lib") {
Primiano Tuccia3645202020-08-03 16:28:18 +0200227 visibility = protobuf_full_deps_allowlist
Primiano Tuccib7ebffd2019-09-09 07:42:35 -0700228 if (current_toolchain == host_toolchain) {
Joel Fernandes80fc3cd2020-04-01 18:02:57 -0400229 if (perfetto_use_system_protobuf) {
Primiano Tucci5cbeadf2020-04-03 22:28:40 +0100230 public_configs = [
231 ":system_protobuf",
232 ":system_protoc",
Primiano Tuccie95bb962020-04-06 09:05:02 +0100233 ":protobuf_gen_config",
Primiano Tucci5cbeadf2020-04-03 22:28:40 +0100234 ]
Joel Fernandes80fc3cd2020-04-01 18:02:57 -0400235 } else {
236 public_deps = [ "${perfetto_protobuf_target_prefix}:protoc_lib" ]
237 }
Primiano Tuccib7ebffd2019-09-09 07:42:35 -0700238 }
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800239}
240
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100241group("protobuf_full") {
Primiano Tuccia3645202020-08-03 16:28:18 +0200242 visibility = protobuf_full_deps_allowlist
Lalit Magantia97798d2020-09-16 17:40:57 +0100243 if (perfetto_use_system_protobuf) {
244 public_configs = [ ":system_protobuf" ]
245 } else {
246 public_deps = [ "${perfetto_protobuf_target_prefix}:protobuf_full" ]
Primiano Tuccib7ebffd2019-09-09 07:42:35 -0700247 }
Oystein Eftevaagdd727e42017-12-05 08:49:55 -0800248}
249
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100250group("protobuf_lite") {
Joel Fernandes80fc3cd2020-04-01 18:02:57 -0400251 if (perfetto_use_system_protobuf) {
252 public_configs = [ ":system_protobuf" ]
253 } else {
254 public_deps = [ "${perfetto_protobuf_target_prefix}:protobuf_lite" ]
255 }
Oystein Eftevaag5e8a4eb2018-01-09 11:41:58 -0800256}
Florian Mayer3a3974e2018-01-24 11:37:29 +0000257
Primiano Tuccie95bb962020-04-06 09:05:02 +0100258# This config is applied to the .pb.{cc,h} generated by proto_library(). This
259# config is propagated up to the source sets that depend on generated proto
260# headers and proto libraries. Therefore this should stay as lean and clean as
261# possible in terms of -W-no* suppressions. Thankfully the autogenerated .pb.h
262# headers violate less warnings than the libprotobuf_* library itself.
263# This config is defined here (as opposed to //buildtools/BUILD.gn) so that when
264# perfetto_use_system_protobuf=true, the right compiler flags are passed.
265config("protobuf_gen_config") {
266 visibility = [ "*" ] # This is injected by standalone/proto_library.gni
267 defines = [
268 "GOOGLE_PROTOBUF_NO_RTTI",
269 "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
270 ]
Primiano Tucci2f811552020-12-07 16:48:22 +0100271 cflags = []
272 if (is_clang || !is_win) {
273 cflags += [
274 "-Wno-unknown-warning-option",
275 "-Wno-deprecated",
276 "-Wno-undef",
277 "-Wno-zero-as-null-pointer-constant",
278 ]
279 }
280 if (is_clang && is_win) {
281 cflags += [
282 "-Wno-reserved-id-macro",
283 "-Wno-language-extension-token",
284 "-Wno-sign-conversion",
285 "-Wno-suggest-destructor-override",
286 "-Wno-undefined-reinterpret-cast",
287 "-Wno-inconsistent-missing-destructor-override",
288 "-Wno-unused-parameter",
289 ]
290 }
Primiano Tuccie95bb962020-04-06 09:05:02 +0100291
292 if (!perfetto_use_system_protobuf) {
293 cflags += [
294 # Using -isystem instead of include_dirs (-I), so we don't need to
295 # suppress warnings coming from libprotobuf headers. Doing so would mask
296 # warnings in our own code.
Primiano Tucci2f811552020-12-07 16:48:22 +0100297 perfetto_isystem_cflag,
Primiano Tuccie95bb962020-04-06 09:05:02 +0100298 rebase_path("../buildtools/protobuf/src", root_build_dir),
299 ]
300 }
301}
302
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100303# The Google C++ Benchmark library.
Hector Dearman5145e502019-09-18 16:52:24 +0100304# Only available in standalone builds.
Primiano Tucci02c11762019-08-30 00:57:59 +0200305if (enable_perfetto_benchmarks) {
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200306 group("benchmark") {
307 testonly = true
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000308 public_deps = [ "//buildtools:benchmark" ]
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100309 }
310}
311
312# Libbacktrace, used for printing stack traces from crash handler, only in
313# standalone debug builds.
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200314if (perfetto_build_standalone && (is_linux || is_android)) {
315 group("libbacktrace") {
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000316 public_deps = [ "//buildtools:libbacktrace" ]
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100317 }
318}
319
Mikhail Khokhlov0f7e68d2020-01-16 15:39:27 +0000320if (enable_perfetto_trace_processor_sqlite) {
321 group("sqlite") {
322 if (perfetto_root_path == "//") {
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000323 public_deps = [ "//buildtools:sqlite" ]
Mikhail Khokhlov0f7e68d2020-01-16 15:39:27 +0000324 } else {
Mikhail Khokhlov302f1f62020-03-12 12:08:29 +0000325 if (build_with_chromium) {
326 public_deps = [ "//third_party/sqlite:sqlite_dev" ]
327 } else {
328 public_deps = [ "//third_party/sqlite:sqlite" ]
329 }
Mikhail Khokhlov0f7e68d2020-01-16 15:39:27 +0000330 public_configs = [ ":sqlite_third_party_include_path" ]
331 }
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100332 }
Mikhail Khokhlov2bcfb352019-12-20 10:19:58 +0000333}
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100334
Mikhail Khokhlov2bcfb352019-12-20 10:19:58 +0000335config("sqlite_third_party_include_path") {
Mikhail Khokhlov302f1f62020-03-12 12:08:29 +0000336 if (build_with_chromium) {
337 include_dirs = [ "//third_party/sqlite/dev" ]
338 } else {
339 include_dirs = [ "//third_party/sqlite" ]
340 }
Mikhail Khokhlov2bcfb352019-12-20 10:19:58 +0000341}
Primiano Tucci02c11762019-08-30 00:57:59 +0200342
343if (enable_perfetto_trace_processor_json) {
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200344 group("jsoncpp") {
345 if (perfetto_root_path == "//") {
346 public_configs = [ "//buildtools:jsoncpp_config" ]
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000347 public_deps = [ "//buildtools:jsoncpp" ]
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200348 } else {
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000349 public_deps = [ "//third_party/jsoncpp:jsoncpp" ]
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200350 }
351 }
Primiano Tucci02c11762019-08-30 00:57:59 +0200352}
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200353
Primiano Tucci02c11762019-08-30 00:57:59 +0200354if (enable_perfetto_trace_processor_linenoise) {
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200355 # Used by the trace_processor_shell for REPL history.
Hector Dearman5145e502019-09-18 16:52:24 +0100356 # Only available in standalone builds.
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200357 group("linenoise") {
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000358 public_deps = [ "//buildtools:linenoise" ]
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200359 }
Primiano Tucci02c11762019-08-30 00:57:59 +0200360} # if (enable_perfetto_trace_processor_linenoise)
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200361
362# Only used by src/profiling in standalone and android builds.
Ryan Savitski56bc0c62020-01-27 13:50:02 +0000363if (enable_perfetto_heapprofd || enable_perfetto_traced_perf) {
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200364 group("libunwindstack") {
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100365 public_configs = [ "//buildtools:libunwindstack_config" ]
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000366 public_deps = [ "//buildtools:libunwindstack" ]
Primiano Tucci13ae72f2019-06-06 10:53:02 +0100367 }
368}
Ryan Savitski154bfab2019-06-07 15:12:27 +0100369
Ryan Savitski56bc0c62020-01-27 13:50:02 +0000370# Used by src/profiling/perf for perf_regs.h.
371if (enable_perfetto_traced_perf) {
372 group("bionic_kernel_uapi_headers") {
373 public_configs = [ "//buildtools:bionic_kernel_uapi_headers" ]
374 }
375}
376
Florian Mayer319ba562021-04-20 17:35:03 +0100377config("system_zlib_config") {
378 libs = [ "z" ]
379}
380
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200381# Zlib is used both by trace_processor and by perfetto_cmd.
Primiano Tucci1b5fdae2020-01-16 09:28:05 +0000382if (enable_perfetto_zlib) {
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200383 group("zlib") {
Florian Mayer319ba562021-04-20 17:35:03 +0100384 if (perfetto_use_system_zlib) {
385 public_configs = [ "//gn:system_zlib_config" ]
386 } else if (perfetto_root_path == "//") {
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200387 public_configs = [ "//buildtools:zlib_config" ]
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000388 public_deps = [ "//buildtools:zlib" ]
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200389 } else {
390 public_configs = [ "//third_party/zlib:zlib_config" ]
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000391 public_deps = [ "//third_party/zlib" ]
Primiano Tucci7e05fc12019-08-27 17:29:47 +0200392 }
393 }
394}
395
Ryan Savitski154bfab2019-06-07 15:12:27 +0100396# Used by fuzzers.
Florian Mayer0bea7972019-09-02 15:28:13 +0100397if (enable_perfetto_fuzzers && use_libfuzzer) {
Ryan Savitski154bfab2019-06-07 15:12:27 +0100398 group("libfuzzer") {
Primiano Tucci02c11762019-08-30 00:57:59 +0200399 assert(perfetto_root_path == "//")
Primiano Tucci2925e9d2020-01-27 10:15:58 +0000400 public_deps = [ "//buildtools:libfuzzer" ]
Ryan Savitski154bfab2019-06-07 15:12:27 +0100401 }
402}