Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 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 | |
| 15 | import("//build_overrides/build.gni") |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 16 | import("wasm_vars.gni") |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 17 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 18 | # Summary of our typical build configurations: |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 19 | |
| 20 | # 1. Standalone builds |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 21 | # build_with_chromium = false |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 22 | # is_perfetto_build_generator = false |
| 23 | # perfetto_build_standalone = true |
| 24 | # perfetto_build_with_android = false |
| 25 | # perfetto_build_with_embedder = false |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 26 | |
| 27 | # 2. Android tree builds |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 28 | # build_with_chromium = false |
| 29 | # is_perfetto_build_generator = true |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 30 | # perfetto_build_standalone = false |
| 31 | # perfetto_build_with_android = true |
| 32 | # perfetto_build_with_embedder = false |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 33 | |
| 34 | # 3. Chromium tree builds |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 35 | # build_with_chromium = true |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 36 | # is_perfetto_build_generator = false |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 37 | # perfetto_build_standalone = false |
| 38 | # perfetto_build_with_android = false |
| 39 | # perfetto_build_with_embedder = true |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 40 | |
| 41 | # 4. Builds in other embedder trees (e.g. V8 standalone) |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 42 | # build_with_chromium = false |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 43 | # is_perfetto_build_generator = false |
| 44 | # perfetto_build_standalone = false |
| 45 | # perfetto_build_with_android = false |
| 46 | # perfetto_build_with_embedder = true |
| 47 | |
| 48 | # 5. Amalgamated sources (Client library) |
| 49 | # build_with_chromium = false |
| 50 | # is_perfetto_build_generator = true |
| 51 | # perfetto_build_standalone = false |
| 52 | # perfetto_build_with_android = false |
| 53 | # perfetto_build_with_embedder = true |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 54 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 55 | # +----------------------------------------------------------------------------+ |
| 56 | # | Toolchain / environment related configuration | |
| 57 | # +----------------------------------------------------------------------------+ |
| 58 | # This section contains a bunch of variables that are related with the toolchain |
| 59 | # and the build environment. Only tools/gen_xxx should customize them. |
| 60 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 61 | # Note that |build_with_chromium| is a global convention used by several |
| 62 | # projects, set outside of our control. |
| 63 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 64 | # Chromium sets this to true in its //build_overrides/build.gni. |
Eric Seckler | 7faef11 | 2019-01-16 15:07:50 +0000 | [diff] [blame] | 65 | if (!defined(build_with_chromium)) { |
| 66 | build_with_chromium = false |
| 67 | } |
| 68 | |
Stephen Nusko | 036d198 | 2020-01-22 13:10:37 +0000 | [diff] [blame] | 69 | if (!defined(is_nacl)) { |
| 70 | is_nacl = false |
| 71 | } |
| 72 | |
Eric Seckler | 357966a | 2019-01-15 13:45:37 +0000 | [diff] [blame] | 73 | declare_args() { |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 74 | # The Android blueprint file generator set this to true (as well as |
| 75 | # is_perfetto_build_generator). This is just about being built in the |
| 76 | # Android tree (AOSP and internal) and is NOT related with the target OS. |
| 77 | # In standalone Android builds and Chromium Android builds, this is false. |
| 78 | perfetto_build_with_android = false |
| 79 | |
| 80 | # All the tools/gen_* scripts set this to true. This is mainly used to locate |
| 81 | # .gni files from //gn rather than //build. |
| 82 | is_perfetto_build_generator = false |
| 83 | |
| 84 | # This is for override via `gn args` (e.g. for tools/gen_xxx). Embedders |
| 85 | # based on GN (e.g. v8) should NOT set this and instead directly sets |
| 86 | # perfetto_build_with_embedder=true in their GN files. |
| 87 | is_perfetto_embedder = false |
Eric Seckler | 357966a | 2019-01-15 13:45:37 +0000 | [diff] [blame] | 88 | } |
| 89 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 90 | # This can be overridden by embedders (e.g. v8) in their .gn(i) files. This must |
| 91 | # be different from the GN args flag (is_perfetto_embedder) because of the way |
| 92 | # GN works. |
| 93 | if (!defined(perfetto_build_with_embedder)) { |
| 94 | perfetto_build_with_embedder = build_with_chromium || is_perfetto_embedder |
| 95 | } |
| 96 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 97 | perfetto_build_standalone = |
| 98 | !perfetto_build_with_android && !build_with_chromium && |
| 99 | !perfetto_build_with_embedder |
| 100 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 101 | # Only relevant for GN builds. Sets the path where perfetto lives. This is // |
| 102 | # for standalone builds and //third_party/perfetto/ in embedders. The embedder |
| 103 | # can ovverride it in its GN files. |
| 104 | if (perfetto_build_standalone || is_perfetto_build_generator) { |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 105 | perfetto_root_path = "//" |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 106 | import("//gn/standalone/android.gni") # For android_api_level |
| 107 | import("//gn/standalone/sanitizers/vars.gni") # For is_fuzzer |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 108 | } else if (!defined(perfetto_root_path)) { |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 109 | perfetto_root_path = "//third_party/perfetto/" |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 110 | import("//build/config/android/config.gni") # For android_api_level |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 111 | } |
Lalit Maganti | d0e7679 | 2018-02-12 14:25:01 +0000 | [diff] [blame] | 112 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 113 | # Whether the ftrace producer and the service should be started |
| 114 | # by the integration test or assumed to be running. |
Lalit Maganti | d0e7679 | 2018-02-12 14:25:01 +0000 | [diff] [blame] | 115 | # If we're building in the Android tree, we expect that the testing infra |
| 116 | # will start the binaries in the system image before the tests are run. |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 117 | # In all other cases (i.e. when true), a temporary in-process instance will be |
| 118 | # brought up by our own integrationtest harness. |
| 119 | start_daemons_for_testing = !perfetto_build_with_android |
| 120 | |
| 121 | # +----------------------------------------------------------------------------+ |
| 122 | # | Tunable build variables for embedders | |
| 123 | # +----------------------------------------------------------------------------+ |
| 124 | # The variables in this section allow embedders to enable/disable features |
| 125 | # at the build-system level. This allows to opt-in into the various services |
| 126 | # and tools. |
| 127 | |
| 128 | perfetto_force_dlog_default = "" |
| 129 | if (build_with_chromium) { |
| 130 | perfetto_force_dlog_default = "off" |
Lalit Maganti | d0e7679 | 2018-02-12 14:25:01 +0000 | [diff] [blame] | 131 | } |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 132 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 133 | declare_args() { |
Primiano Tucci | a7f5a8e | 2021-01-02 17:10:50 +0100 | [diff] [blame] | 134 | # Enables build of platform-wide tracing services (traced, traced_probes) |
| 135 | # and executables (perfetto_cmd, trigger_perfetto). |
| 136 | # When disabled, only the client library and other auxiliary tools can be |
| 137 | # built (for Chromium and other GN embedders). |
| 138 | # Note that traced_probes is further conditioned by the GN variable |
| 139 | # enable_perfetto_traced_probes, in the declare_args() section below. |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 140 | enable_perfetto_platform_services = |
Primiano Tucci | a7f5a8e | 2021-01-02 17:10:50 +0100 | [diff] [blame] | 141 | perfetto_build_standalone || perfetto_build_with_android |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 142 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 143 | # Allow the embedder to use the IPC layer. In turn this allows to use the |
| 144 | # system backend in the client library. |
| 145 | # This includes building things that rely on POSIX sockets, this places |
| 146 | # limitations on the supported operating systems. |
Primiano Tucci | 5f3008e | 2021-05-19 21:34:45 +0100 | [diff] [blame] | 147 | # For now the IPC layer is conservatively not enabled on Chromium+Windows |
| 148 | # builds. |
| 149 | enable_perfetto_ipc = |
| 150 | !is_fuchsia && !is_nacl && |
| 151 | (perfetto_build_standalone || perfetto_build_with_android || |
| 152 | (build_with_chromium && !is_win)) |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 153 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 154 | # Makes the heap profiling daemon target reachable. It works only on Android, |
| 155 | # but is built on Linux as well for test/compiler coverage. |
| 156 | # On Android, it requires API level 26 due to libunwindstack. |
| 157 | enable_perfetto_heapprofd = |
| 158 | perfetto_build_with_android || |
| 159 | (perfetto_build_standalone && is_clang && |
| 160 | (is_linux || (is_android && android_api_level >= 26))) |
| 161 | |
Ryan Savitski | a76b3cc | 2019-11-20 16:25:24 +0000 | [diff] [blame] | 162 | # Build the perf event profiler (traced_perf). |
| 163 | # TODO(b/144281346): under development. |
Ryan Savitski | 56bc0c6 | 2020-01-27 13:50:02 +0000 | [diff] [blame] | 164 | # TODO(rsavitski): figure out how to make the android-core dependencies build |
| 165 | # under gcc (_Atomic and other issues). |
| 166 | enable_perfetto_traced_perf = |
| 167 | perfetto_build_with_android || |
| 168 | (perfetto_build_standalone && is_clang && is_linux) |
Ryan Savitski | a76b3cc | 2019-11-20 16:25:24 +0000 | [diff] [blame] | 169 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 170 | # The Trace Processor: offline analytical engine to process traces and compute |
| 171 | # metrics using a SQL engine. |
Sami Kyostila | 413b643 | 2020-02-04 17:52:12 +0000 | [diff] [blame] | 172 | if (!defined(enable_perfetto_trace_processor)) { |
| 173 | enable_perfetto_trace_processor = |
| 174 | perfetto_build_standalone || build_with_chromium || |
| 175 | is_perfetto_build_generator |
| 176 | } |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 177 | |
Primiano Tucci | 44729e0 | 2021-10-25 11:28:19 +0100 | [diff] [blame] | 178 | # Enables base::Watchdog. Is supported only on Linux-based platforms in |
| 179 | # standalone GN builds (NOT in bazel/blaze). |
Primiano Tucci | 18c0cff | 2019-09-09 17:09:03 -0700 | [diff] [blame] | 180 | # gn/BUILD.gn further restricts this to OS_LINUX || OS_ANDROID when generating |
| 181 | # the perfetto_build_flags.h header. |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 182 | enable_perfetto_watchdog = |
Primiano Tucci | 44729e0 | 2021-10-25 11:28:19 +0100 | [diff] [blame] | 183 | perfetto_build_with_android || |
| 184 | (perfetto_build_standalone && !is_perfetto_build_generator) |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 185 | |
| 186 | # Misc host executable under tools/. |
| 187 | enable_perfetto_tools = |
Primiano Tucci | f33540e | 2019-09-19 12:35:57 +0100 | [diff] [blame] | 188 | perfetto_build_standalone || perfetto_build_with_android |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 189 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 190 | enable_perfetto_unittests = perfetto_build_standalone || |
| 191 | build_with_chromium || perfetto_build_with_android |
| 192 | |
| 193 | enable_perfetto_integration_tests = |
Primiano Tucci | 5f3008e | 2021-05-19 21:34:45 +0100 | [diff] [blame] | 194 | perfetto_build_standalone || perfetto_build_with_android |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 195 | |
Primiano Tucci | 42433ab | 2020-11-30 18:42:01 +0100 | [diff] [blame] | 196 | enable_perfetto_benchmarks = perfetto_build_standalone && !is_win |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 197 | |
| 198 | enable_perfetto_fuzzers = |
| 199 | perfetto_build_standalone && defined(is_fuzzer) && is_fuzzer |
| 200 | |
Primiano Tucci | ec59013 | 2020-11-16 14:16:44 +0100 | [diff] [blame] | 201 | # Enables the write_version_header.py tool that generates a .h that contains a |
| 202 | # macro with the current git revision and latest release version from |
| 203 | # CHANGELOG. If false base/version.h will return "unknown". |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 204 | enable_perfetto_version_gen = |
Primiano Tucci | ec59013 | 2020-11-16 14:16:44 +0100 | [diff] [blame] | 205 | perfetto_build_standalone || is_perfetto_build_generator || |
| 206 | perfetto_build_with_android |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 207 | |
| 208 | # Only for local development. When true the binaries (perfetto, traced, ...) |
| 209 | # are monolithic and don't use a common shared library. This is mainly to |
| 210 | # avoid LD_LIBRARY_PATH dances when testing locally. |
Primiano Tucci | 59a00fe | 2021-01-02 12:58:02 +0100 | [diff] [blame] | 211 | # On Windows we default to monolithic executables, because pairing |
| 212 | # dllexport/import adds extra complexity for little benefit. Te only reason |
| 213 | # for monolithic_binaries=false is saving binary size, which matters mainly on |
| 214 | # Android. See also comments on PERFETTO_EXPORTED_ENTRYPOINT in compiler.h. |
| 215 | monolithic_binaries = is_win |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 216 | |
| 217 | # Whether DLOG should be enabled on debug builds (""), all builds ("on"), or |
| 218 | # none ("off"). We disable it by default for embedders to avoid spamming their |
| 219 | # console. |
| 220 | perfetto_force_dlog = perfetto_force_dlog_default |
Primiano Tucci | 824be14 | 2020-07-08 16:15:44 +0100 | [diff] [blame] | 221 | |
Primiano Tucci | 1a69d01 | 2021-09-07 14:52:27 +0100 | [diff] [blame] | 222 | # Whether DCHECKs should be enabled or not. Values: "on" | "off" | "". |
| 223 | # By default ("") DCHECKs are enabled only: |
| 224 | # - If DCHECK_ALWAYS_ON is defined (which is mainly a Chromium-ism). |
| 225 | # - On debug builds (i.e. if NDEBUG is NOT defined) but only in Chromium, |
| 226 | # Android and standalone builds. |
| 227 | # - On all other builds (e.g., SDK) it's off regardless of NDEBUG (unless |
| 228 | # DCHECK_ALWAYS_ON is defined). |
| 229 | # See base/logging.h for the implementation of all this. |
| 230 | perfetto_force_dcheck = "" |
| 231 | |
Primiano Tucci | 824be14 | 2020-07-08 16:15:44 +0100 | [diff] [blame] | 232 | # Installs a signal handler for the most common crash signals which unwinds |
| 233 | # the stack and prints the stack trace on stderr. Requires a dependency on |
| 234 | # libbacktrace when enabled. |
| 235 | enable_perfetto_stderr_crash_dump = |
Primiano Tucci | 42433ab | 2020-11-30 18:42:01 +0100 | [diff] [blame] | 236 | is_debug && perfetto_build_standalone && !is_wasm && !is_win |
Primiano Tucci | 2277f06 | 2021-11-08 22:24:05 +0000 | [diff] [blame] | 237 | |
| 238 | # Enables more aggressive compiler flags that assume recent Intel CPUs. |
| 239 | # Runtime checks during initialization will print an error message and exit |
| 240 | # if the CPU doesn't support those flags. |
| 241 | enable_perfetto_x64_cpu_opt = |
| 242 | current_cpu == "x64" && (is_linux || is_mac) && !is_wasm && |
| 243 | perfetto_build_standalone && !is_perfetto_build_generator |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | declare_args() { |
Primiano Tucci | dc77d72 | 2021-10-15 13:17:52 +0100 | [diff] [blame] | 247 | perfetto_enable_git_rev_version_header = |
| 248 | enable_perfetto_version_gen && perfetto_build_standalone && |
| 249 | !is_perfetto_build_generator |
Florian Mayer | 8951683 | 2021-04-21 16:37:00 +0100 | [diff] [blame] | 250 | |
Primiano Tucci | a7f5a8e | 2021-01-02 17:10:50 +0100 | [diff] [blame] | 251 | # The traced_probes daemon is very Linux-specific, as it depends on ftrace and |
| 252 | # various /proc interfaces. There is no point making its code platform-neutral |
| 253 | # as it won't do anything useful on Windows. |
| 254 | # The only reason why we still build it on Mac OS is to be able to run the |
| 255 | # unittests there and making dev on mac less cumbersome. The traced_probes |
| 256 | # code happens to build cleanly and for now the mainteinance cost on Mac is |
| 257 | # extremely low. |
| 258 | enable_perfetto_traced_probes = enable_perfetto_platform_services && !is_win |
| 259 | |
Eric Seckler | 0846048 | 2019-12-16 17:40:21 +0000 | [diff] [blame] | 260 | # Whether info-level logging is enabled. |
| 261 | perfetto_verbose_logs_enabled = |
| 262 | !build_with_chromium || perfetto_force_dlog == "on" |
| 263 | |
Mikhail Khokhlov | 0f7e68d | 2020-01-16 15:39:27 +0000 | [diff] [blame] | 264 | # Enables the SQL query layer of trace processor. |
| 265 | enable_perfetto_trace_processor_sqlite = |
| 266 | enable_perfetto_trace_processor && |
| 267 | (build_with_chromium || !perfetto_build_with_embedder) |
| 268 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 269 | # Enables the optional SQLite percentile module. |
| 270 | enable_perfetto_trace_processor_percentile = |
| 271 | enable_perfetto_trace_processor && perfetto_build_standalone |
| 272 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 273 | # Enables the REPL interactive prompt in the trace processor. |
| 274 | enable_perfetto_trace_processor_linenoise = |
| 275 | perfetto_build_standalone && enable_perfetto_trace_processor && |
| 276 | (is_linux || is_android || is_mac) |
Eric Seckler | de58995 | 2019-10-17 12:46:07 +0100 | [diff] [blame] | 277 | |
Eric Seckler | 510a3ee | 2019-11-01 13:23:24 +0000 | [diff] [blame] | 278 | # Enables JSON support in the trace processor. Required for JSON trace import |
Lalit Maganti | 6d1f7b5 | 2020-02-27 13:16:44 +0000 | [diff] [blame] | 279 | # and export. |
Eric Seckler | de58995 | 2019-10-17 12:46:07 +0100 | [diff] [blame] | 280 | enable_perfetto_trace_processor_json = |
| 281 | enable_perfetto_trace_processor && !perfetto_build_with_android |
Eric Seckler | ac2ea61 | 2019-10-21 16:44:39 +0100 | [diff] [blame] | 282 | |
Primiano Tucci | a36cccc | 2019-10-27 13:15:04 +0100 | [diff] [blame] | 283 | # Enables httpd RPC support in the trace processor. |
| 284 | # Further per-OS conditionals are applied in gn/BUILD.gn. |
| 285 | enable_perfetto_trace_processor_httpd = |
Paul Thomson | 4a79295 | 2021-06-04 13:51:47 +0100 | [diff] [blame] | 286 | enable_perfetto_trace_processor && |
| 287 | (perfetto_build_standalone || perfetto_build_with_android) |
Primiano Tucci | 1b5fdae | 2020-01-16 09:28:05 +0000 | [diff] [blame] | 288 | |
| 289 | # Enables Zlib support. This is used both by the "perfetto" cmdline client |
| 290 | # (for compressing traces) and by trace processor (for compressed traces). |
| 291 | enable_perfetto_zlib = |
Mohit Saini | 9809709 | 2022-02-17 14:40:44 +0000 | [diff] [blame] | 292 | (enable_perfetto_trace_processor && !build_with_chromium) || |
| 293 | enable_perfetto_platform_services |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 294 | } |
| 295 | |
Eric Seckler | a7870e6 | 2019-11-01 10:11:58 +0000 | [diff] [blame] | 296 | declare_args() { |
| 297 | # Enables the trace_to_text tool. |
Mikhail Khokhlov | 0f7e68d | 2020-01-16 15:39:27 +0000 | [diff] [blame] | 298 | enable_perfetto_tools_trace_to_text = |
| 299 | enable_perfetto_tools && enable_perfetto_trace_processor_sqlite |
Eric Seckler | a7870e6 | 2019-11-01 10:11:58 +0000 | [diff] [blame] | 300 | |
| 301 | # Allows to build the UI (TypeScript/ HTML / WASM) |
Mikhail Khokhlov | 0f7e68d | 2020-01-16 15:39:27 +0000 | [diff] [blame] | 302 | enable_perfetto_ui = |
Primiano Tucci | 42433ab | 2020-11-30 18:42:01 +0100 | [diff] [blame] | 303 | perfetto_build_standalone && enable_perfetto_trace_processor_sqlite && |
| 304 | host_os != "win" |
Joel Fernandes | 090d271 | 2020-02-24 13:53:27 -0500 | [diff] [blame] | 305 | |
| 306 | # Skip buildtools dependency checks (needed for ChromeOS). |
| 307 | skip_buildtools_check = false |
Joel Fernandes | 80fc3cd | 2020-04-01 18:02:57 -0400 | [diff] [blame] | 308 | |
| 309 | # Used by CrOS system builds. Uses the system version of protobuf |
| 310 | # from /usr/include instead of the hermetic one. |
| 311 | perfetto_use_system_protobuf = false |
Florian Mayer | 319ba56 | 2021-04-20 17:35:03 +0100 | [diff] [blame] | 312 | |
| 313 | perfetto_use_system_zlib = false |
Eric Seckler | a7870e6 | 2019-11-01 10:11:58 +0000 | [diff] [blame] | 314 | } |
| 315 | |
Primiano Tucci | 2f81155 | 2020-12-07 16:48:22 +0100 | [diff] [blame] | 316 | if (is_win) { |
| 317 | # clang-cl |
| 318 | perfetto_isystem_cflag = "/I" |
| 319 | } else { |
| 320 | perfetto_isystem_cflag = "-isystem" |
| 321 | } |
| 322 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 323 | # +---------------------------------------------------------------------------+ |
| 324 | # | Cross-checks | |
| 325 | # +---------------------------------------------------------------------------+ |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 326 | |
Primiano Tucci | 7c7f5f5 | 2019-01-15 21:47:04 +0000 | [diff] [blame] | 327 | # Exactly one between build_with_android, build_standalone and |
| 328 | # build_with_embedder must be true. |
| 329 | assert(perfetto_build_standalone || perfetto_build_with_android || |
| 330 | perfetto_build_with_embedder) |
| 331 | assert(!(perfetto_build_with_android && perfetto_build_standalone)) |
| 332 | assert(!(perfetto_build_with_embedder && perfetto_build_standalone)) |
| 333 | assert(!(perfetto_build_with_android && perfetto_build_with_embedder)) |
| 334 | |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 335 | # If |build_with_chromium| is true then also |perfetto_build_with_embedder| |
| 336 | # must be true |
| 337 | assert(!build_with_chromium || perfetto_build_with_embedder) |
Stephen Nusko | 5da63f3 | 2019-04-25 17:06:26 +0100 | [diff] [blame] | 338 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 339 | # If |perfetto_build_with_android| is true then also |
| 340 | # |is_perfetto_build_generator| must be true. |
| 341 | assert(!perfetto_build_with_android || is_perfetto_build_generator) |
Primiano Tucci | 2bf8284 | 2019-08-27 07:10:55 +0200 | [diff] [blame] | 342 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 343 | # We should never end up in a state where is_perfetto_embedder=true but |
| 344 | # perfetto_build_with_embedder=false. |
| 345 | assert(!is_perfetto_embedder || perfetto_build_with_embedder) |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 346 | |
| 347 | # The monolithic binaries is not supported when building in the Android tree. |
| 348 | assert(!monolithic_binaries || !perfetto_build_with_android) |
| 349 | |
| 350 | # Watchdog must be on in Android builds. |
| 351 | assert(enable_perfetto_watchdog || !perfetto_build_with_android) |
| 352 | |
| 353 | assert(perfetto_force_dlog == "" || perfetto_force_dlog == "on" || |
| 354 | perfetto_force_dlog == "off") |
Primiano Tucci | a7f5a8e | 2021-01-02 17:10:50 +0100 | [diff] [blame] | 355 | |
| 356 | # If enable_perfetto_traced_probes is set, enable_perfetto_platform_services |
| 357 | # must be set as well. Doesn't make sense to build traced_probes without the |
| 358 | # rest. traced_probes integration tests depend on traced. |
| 359 | assert(!enable_perfetto_traced_probes || enable_perfetto_platform_services) |