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("perfetto.gni") |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 16 | import("proto_library.gni") |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 17 | |
| 18 | if (perfetto_root_path == "//") { |
Andres Medina | 2cf423c | 2019-03-29 10:27:49 -0700 | [diff] [blame] | 19 | import("//gn/standalone/sanitizers/vars.gni") |
| 20 | } else { |
| 21 | import("//build/config/sanitizers/sanitizers.gni") |
| 22 | } |
| 23 | |
Primiano Tucci | 8e62744 | 2019-08-28 07:58:38 +0200 | [diff] [blame] | 24 | # 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 Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 30 | # #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_ANDROID_BUILD() |
Primiano Tucci | 8e62744 | 2019-08-28 07:58:38 +0200 | [diff] [blame] | 31 | # - 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) |
| 34 | buildflag_gen_dir_ = "$root_gen_dir/$perfetto_root_path/build_config" |
| 35 | action("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 Tucci | 18c0cff | 2019-09-09 17:09:03 -0700 | [diff] [blame] | 46 | # We can't just use (is_linux || is_android) in perfetto.gni because that |
| 47 | # doesn't work in Android Mac host builds. We lose the GN notion of OS once |
| 48 | # we run the tools/gen_xxx generators. |
| 49 | if (enable_perfetto_watchdog) { |
| 50 | perfetto_watchdog = "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() || " + |
| 51 | "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX()" |
| 52 | } else { |
| 53 | perfetto_watchdog = "0" |
| 54 | } |
Primiano Tucci | 41af34f | 2019-10-01 13:09:22 +0100 | [diff] [blame] | 55 | if (enable_perfetto_tools) { |
Florian Mayer | 4c95570 | 2020-06-10 20:37:38 +0200 | [diff] [blame] | 56 | perfetto_local_symbolizer = |
| 57 | "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() || " + |
Joshua Gilpatrick | cd34994 | 2020-11-11 15:18:37 -0800 | [diff] [blame] | 58 | "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() ||" + |
| 59 | "PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN()" |
Primiano Tucci | 41af34f | 2019-10-01 13:09:22 +0100 | [diff] [blame] | 60 | } else { |
| 61 | perfetto_local_symbolizer = "0" |
| 62 | } |
Primiano Tucci | 8e62744 | 2019-08-28 07:58:38 +0200 | [diff] [blame] | 63 | response_file_contents = [ |
| 64 | "--flags", # Keep this marker first. |
| 65 | "PERFETTO_ANDROID_BUILD=$perfetto_build_with_android", |
Primiano Tucci | 8e62744 | 2019-08-28 07:58:38 +0200 | [diff] [blame] | 66 | "PERFETTO_CHROMIUM_BUILD=$build_with_chromium", |
| 67 | "PERFETTO_STANDALONE_BUILD=$perfetto_build_standalone", |
| 68 | "PERFETTO_START_DAEMONS=$start_daemons_for_testing", |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 69 | "PERFETTO_IPC=$enable_perfetto_ipc", |
Primiano Tucci | 18c0cff | 2019-09-09 17:09:03 -0700 | [diff] [blame] | 70 | "PERFETTO_WATCHDOG=$perfetto_watchdog", |
Primiano Tucci | 8e62744 | 2019-08-28 07:58:38 +0200 | [diff] [blame] | 71 | "PERFETTO_COMPONENT_BUILD=$perfetto_component_build", |
| 72 | "PERFETTO_FORCE_DLOG_ON=$perfetto_force_dlog_on", |
| 73 | "PERFETTO_FORCE_DLOG_OFF=$perfetto_force_dlog_off", |
Eric Seckler | 0846048 | 2019-12-16 17:40:21 +0000 | [diff] [blame] | 74 | "PERFETTO_VERBOSE_LOGS=$perfetto_verbose_logs_enabled", |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 75 | "PERFETTO_VERSION_GEN=$enable_perfetto_version_gen", |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 76 | "PERFETTO_TP_PERCENTILE=$enable_perfetto_trace_processor_percentile", |
Eric Seckler | de58995 | 2019-10-17 12:46:07 +0100 | [diff] [blame] | 77 | "PERFETTO_TP_LINENOISE=$enable_perfetto_trace_processor_linenoise", |
Primiano Tucci | 3ce4e8e | 2021-01-04 11:00:19 +0100 | [diff] [blame] | 78 | "PERFETTO_TP_HTTPD=$enable_perfetto_trace_processor_httpd", |
Eric Seckler | de58995 | 2019-10-17 12:46:07 +0100 | [diff] [blame] | 79 | "PERFETTO_TP_JSON=$enable_perfetto_trace_processor_json", |
Primiano Tucci | 41af34f | 2019-10-01 13:09:22 +0100 | [diff] [blame] | 80 | "PERFETTO_LOCAL_SYMBOLIZER=$perfetto_local_symbolizer", |
Primiano Tucci | 1b5fdae | 2020-01-16 09:28:05 +0000 | [diff] [blame] | 81 | "PERFETTO_ZLIB=$enable_perfetto_zlib", |
Primiano Tucci | 890cfbe | 2021-05-21 13:38:45 +0100 | [diff] [blame] | 82 | "PERFETTO_TRACED_PERF=$enable_perfetto_traced_perf", |
| 83 | "PERFETTO_HEAPPROFD=$enable_perfetto_heapprofd", |
Florian Mayer | 3bf39d0 | 2021-05-24 14:04:35 +0100 | [diff] [blame^] | 84 | "PERFETTO_STDERR_CRASH_DUMP=$enable_perfetto_stderr_crash_dump", |
Primiano Tucci | 8e62744 | 2019-08-28 07:58:38 +0200 | [diff] [blame] | 85 | ] |
| 86 | |
| 87 | rel_out_path = rebase_path(gen_header_path, "$root_build_dir") |
| 88 | args = [ |
| 89 | "--out", |
| 90 | rel_out_path, |
| 91 | "--rsp", |
| 92 | "{{response_file_name}}", |
| 93 | ] |
| 94 | |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 95 | outputs = [ gen_header_path ] |
Primiano Tucci | 8e62744 | 2019-08-28 07:58:38 +0200 | [diff] [blame] | 96 | } |
| 97 | |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 98 | # All targets should depend on this target to inherit the right flags and |
| 99 | # include directories. |
| 100 | group("default_deps") { |
Eric Seckler | 911f4d7 | 2020-10-08 15:10:51 +0100 | [diff] [blame] | 101 | visibility = [ "../*" ] # Prevent chromium targets from depending on this (breaks component). |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 102 | public_configs = [ ":default_config" ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 103 | deps = [ ":gen_buildflags" ] |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 104 | if (perfetto_build_standalone) { |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 105 | public_deps = [ |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 106 | "//gn/standalone:check_build_deps", |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 107 | "//gn/standalone/libc++:deps", |
| 108 | "//gn/standalone/sanitizers:deps", |
| 109 | ] |
Primiano Tucci | 69132a1 | 2020-02-07 22:33:06 +0000 | [diff] [blame] | 110 | if (is_android) { |
| 111 | public_deps += [ "//gn/standalone:check_build_deps_android" ] |
| 112 | } |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 113 | } |
| 114 | } |
| 115 | |
| 116 | # The config that all targets in the perfetto codebase inherit by virtue of |
| 117 | # having explicit deps on //gn:default_deps. This config is NOT propagated up to |
| 118 | # embedders that depend on perfetto (e.g. chrome). :public_config (see below) is |
| 119 | # used for that. |
| 120 | config("default_config") { |
Eric Seckler | 911f4d7 | 2020-10-08 15:10:51 +0100 | [diff] [blame] | 121 | visibility = [ "../*" ] # Prevent chromium targets from depending on this (breaks component). |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 122 | configs = [ ":public_config" ] |
| 123 | defines = [ "PERFETTO_IMPLEMENTATION" ] |
Florian Mayer | 5d09f5e | 2021-02-19 14:59:49 +0000 | [diff] [blame] | 124 | include_dirs = [ |
| 125 | "..", |
| 126 | "../src/profiling/memory/include", |
| 127 | ] |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 128 | |
| 129 | if (build_with_chromium && is_android) { |
| 130 | # Included for __android_log_print |
| 131 | libs = [ "log" ] |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | # This config is propagated to embedders via libperfetto. It's also included in |
| 136 | # the default_config above. |
| 137 | config("public_config") { |
| 138 | include_dirs = [ |
| 139 | "../include", |
| 140 | |
Primiano Tucci | 8e62744 | 2019-08-28 07:58:38 +0200 | [diff] [blame] | 141 | # For perfetto_build_flags.h |
| 142 | buildflag_gen_dir_, |
Eric Seckler | d7fd6c2 | 2020-01-22 18:46:35 +0000 | [diff] [blame] | 143 | |
| 144 | # For generated files (proto libraries etc). We add the directory here |
| 145 | # because we stop propagation of the configs for individual proto libraries |
| 146 | # to avoid duplicate include directory command line flags in compiler |
| 147 | # invocations, see proto_library.gni, crbug.com/1043279, crbug.com/gn/142. |
| 148 | "$root_gen_dir/$perfetto_root_path", |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 149 | ] |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 150 | } |
| 151 | |
Andres Medina | 2cf423c | 2019-03-29 10:27:49 -0700 | [diff] [blame] | 152 | config("asan_instrumentation") { |
| 153 | if (use_sanitizer_configs_without_instrumentation) { |
| 154 | defines = [ "ADDRESS_SANITIZER_WITHOUT_INSTRUMENTATION" ] |
| 155 | } |
| 156 | } |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 157 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 158 | if (perfetto_root_path != "//") { |
| 159 | config("gtest_and_gmock_embedder_config") { |
| 160 | include_dirs = [ |
| 161 | "//testing/gtest/include", |
| 162 | "//testing/gmock/include", |
| 163 | ] |
Eric Seckler | 57c89d9 | 2018-10-26 15:11:55 +0100 | [diff] [blame] | 164 | } |
| 165 | } |
| 166 | |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 167 | group("gtest_and_gmock") { |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 168 | testonly = true |
| 169 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 170 | if (perfetto_root_path == "//") { |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 171 | public_deps = [ |
| 172 | "//buildtools:gmock", |
| 173 | "//buildtools:gtest", |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 174 | ] |
| 175 | } else { |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 176 | public_configs = [ ":gtest_and_gmock_embedder_config" ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 177 | public_deps = [ |
| 178 | "//testing/gmock", |
| 179 | "//testing/gtest", |
Florian Mayer | d8bd81b | 2018-01-25 12:49:15 +0000 | [diff] [blame] | 180 | ] |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | group("gtest_main") { |
| 185 | testonly = true |
| 186 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 187 | if (perfetto_root_path == "//") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 188 | public_deps = [ "//buildtools:gtest_main" ] |
Eric Seckler | a6ba179 | 2019-01-02 12:51:00 +0000 | [diff] [blame] | 189 | } else if (build_with_chromium) { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 190 | public_deps = [ "//base/test:run_all_unittests" ] |
Florian Mayer | d8bd81b | 2018-01-25 12:49:15 +0000 | [diff] [blame] | 191 | } else { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 192 | public_deps = [ "//testing/gtest:gtest_main" ] |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 193 | } |
| 194 | } |
| 195 | |
Primiano Tucci | d0001c3 | 2019-09-08 22:45:58 -0700 | [diff] [blame] | 196 | # Full protobuf is just for host tools .No binary shipped on device should |
| 197 | # depend on this. |
Primiano Tucci | a364520 | 2020-08-03 16:28:18 +0200 | [diff] [blame] | 198 | protobuf_full_deps_allowlist = [ |
Primiano Tucci | d0001c3 | 2019-09-08 22:45:58 -0700 | [diff] [blame] | 199 | "../src/ipc/protoc_plugin:*", |
| 200 | "../src/protozero/protoc_plugin:*", |
Primiano Tucci | 3f00374 | 2021-05-14 19:25:14 +0100 | [diff] [blame] | 201 | "../src/protozero/filtering:filter_util", |
Primiano Tucci | d0001c3 | 2019-09-08 22:45:58 -0700 | [diff] [blame] | 202 | "../src/trace_processor:trace_processor_shell", |
Primiano Tucci | 3f00374 | 2021-05-14 19:25:14 +0100 | [diff] [blame] | 203 | "../src/protozero/filtering:filter_util", |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 204 | "../tools/*", |
Primiano Tucci | d0001c3 | 2019-09-08 22:45:58 -0700 | [diff] [blame] | 205 | ] |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 206 | |
Primiano Tucci | b7ebffd | 2019-09-09 07:42:35 -0700 | [diff] [blame] | 207 | group("protoc") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 208 | public_deps = [ "${perfetto_protobuf_target_prefix}:protoc($host_toolchain)" ] |
Primiano Tucci | b7ebffd | 2019-09-09 07:42:35 -0700 | [diff] [blame] | 209 | } |
Primiano Tucci | d0001c3 | 2019-09-08 22:45:58 -0700 | [diff] [blame] | 210 | |
Joel Fernandes | 80fc3cd | 2020-04-01 18:02:57 -0400 | [diff] [blame] | 211 | config("system_protoc") { |
| 212 | libs = [ "protoc" ] # This will link against libprotoc.so |
| 213 | } |
| 214 | |
| 215 | config("system_protobuf") { |
| 216 | libs = [ "protobuf" ] # This will link against libprotobuf.so |
| 217 | } |
| 218 | |
Lalit Maganti | e0986f3 | 2020-09-17 15:35:47 +0100 | [diff] [blame] | 219 | # protoc compiler library, it's used for building protoc plugins. |
Primiano Tucci | d0001c3 | 2019-09-08 22:45:58 -0700 | [diff] [blame] | 220 | group("protoc_lib") { |
Primiano Tucci | a364520 | 2020-08-03 16:28:18 +0200 | [diff] [blame] | 221 | visibility = protobuf_full_deps_allowlist |
Primiano Tucci | b7ebffd | 2019-09-09 07:42:35 -0700 | [diff] [blame] | 222 | if (current_toolchain == host_toolchain) { |
Joel Fernandes | 80fc3cd | 2020-04-01 18:02:57 -0400 | [diff] [blame] | 223 | if (perfetto_use_system_protobuf) { |
Primiano Tucci | 5cbeadf | 2020-04-03 22:28:40 +0100 | [diff] [blame] | 224 | public_configs = [ |
| 225 | ":system_protobuf", |
| 226 | ":system_protoc", |
Primiano Tucci | e95bb96 | 2020-04-06 09:05:02 +0100 | [diff] [blame] | 227 | ":protobuf_gen_config", |
Primiano Tucci | 5cbeadf | 2020-04-03 22:28:40 +0100 | [diff] [blame] | 228 | ] |
Joel Fernandes | 80fc3cd | 2020-04-01 18:02:57 -0400 | [diff] [blame] | 229 | } else { |
| 230 | public_deps = [ "${perfetto_protobuf_target_prefix}:protoc_lib" ] |
| 231 | } |
Primiano Tucci | b7ebffd | 2019-09-09 07:42:35 -0700 | [diff] [blame] | 232 | } |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 233 | } |
| 234 | |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 235 | group("protobuf_full") { |
Primiano Tucci | a364520 | 2020-08-03 16:28:18 +0200 | [diff] [blame] | 236 | visibility = protobuf_full_deps_allowlist |
Lalit Maganti | a97798d | 2020-09-16 17:40:57 +0100 | [diff] [blame] | 237 | if (perfetto_use_system_protobuf) { |
| 238 | public_configs = [ ":system_protobuf" ] |
| 239 | } else { |
| 240 | public_deps = [ "${perfetto_protobuf_target_prefix}:protobuf_full" ] |
Primiano Tucci | b7ebffd | 2019-09-09 07:42:35 -0700 | [diff] [blame] | 241 | } |
Oystein Eftevaag | dd727e4 | 2017-12-05 08:49:55 -0800 | [diff] [blame] | 242 | } |
| 243 | |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 244 | group("protobuf_lite") { |
Joel Fernandes | 80fc3cd | 2020-04-01 18:02:57 -0400 | [diff] [blame] | 245 | if (perfetto_use_system_protobuf) { |
| 246 | public_configs = [ ":system_protobuf" ] |
| 247 | } else { |
| 248 | public_deps = [ "${perfetto_protobuf_target_prefix}:protobuf_lite" ] |
| 249 | } |
Oystein Eftevaag | 5e8a4eb | 2018-01-09 11:41:58 -0800 | [diff] [blame] | 250 | } |
Florian Mayer | 3a3974e | 2018-01-24 11:37:29 +0000 | [diff] [blame] | 251 | |
Primiano Tucci | e95bb96 | 2020-04-06 09:05:02 +0100 | [diff] [blame] | 252 | # This config is applied to the .pb.{cc,h} generated by proto_library(). This |
| 253 | # config is propagated up to the source sets that depend on generated proto |
| 254 | # headers and proto libraries. Therefore this should stay as lean and clean as |
| 255 | # possible in terms of -W-no* suppressions. Thankfully the autogenerated .pb.h |
| 256 | # headers violate less warnings than the libprotobuf_* library itself. |
| 257 | # This config is defined here (as opposed to //buildtools/BUILD.gn) so that when |
| 258 | # perfetto_use_system_protobuf=true, the right compiler flags are passed. |
| 259 | config("protobuf_gen_config") { |
| 260 | visibility = [ "*" ] # This is injected by standalone/proto_library.gni |
| 261 | defines = [ |
| 262 | "GOOGLE_PROTOBUF_NO_RTTI", |
| 263 | "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", |
| 264 | ] |
Primiano Tucci | 2f81155 | 2020-12-07 16:48:22 +0100 | [diff] [blame] | 265 | cflags = [] |
| 266 | if (is_clang || !is_win) { |
| 267 | cflags += [ |
| 268 | "-Wno-unknown-warning-option", |
| 269 | "-Wno-deprecated", |
| 270 | "-Wno-undef", |
| 271 | "-Wno-zero-as-null-pointer-constant", |
| 272 | ] |
| 273 | } |
| 274 | if (is_clang && is_win) { |
| 275 | cflags += [ |
| 276 | "-Wno-reserved-id-macro", |
| 277 | "-Wno-language-extension-token", |
| 278 | "-Wno-sign-conversion", |
| 279 | "-Wno-suggest-destructor-override", |
| 280 | "-Wno-undefined-reinterpret-cast", |
| 281 | "-Wno-inconsistent-missing-destructor-override", |
| 282 | "-Wno-unused-parameter", |
| 283 | ] |
| 284 | } |
Primiano Tucci | e95bb96 | 2020-04-06 09:05:02 +0100 | [diff] [blame] | 285 | |
| 286 | if (!perfetto_use_system_protobuf) { |
| 287 | cflags += [ |
| 288 | # Using -isystem instead of include_dirs (-I), so we don't need to |
| 289 | # suppress warnings coming from libprotobuf headers. Doing so would mask |
| 290 | # warnings in our own code. |
Primiano Tucci | 2f81155 | 2020-12-07 16:48:22 +0100 | [diff] [blame] | 291 | perfetto_isystem_cflag, |
Primiano Tucci | e95bb96 | 2020-04-06 09:05:02 +0100 | [diff] [blame] | 292 | rebase_path("../buildtools/protobuf/src", root_build_dir), |
| 293 | ] |
| 294 | } |
| 295 | } |
| 296 | |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 297 | # The Google C++ Benchmark library. |
Hector Dearman | 5145e50 | 2019-09-18 16:52:24 +0100 | [diff] [blame] | 298 | # Only available in standalone builds. |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 299 | if (enable_perfetto_benchmarks) { |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 300 | group("benchmark") { |
| 301 | testonly = true |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 302 | public_deps = [ "//buildtools:benchmark" ] |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 303 | } |
| 304 | } |
| 305 | |
| 306 | # Libbacktrace, used for printing stack traces from crash handler, only in |
| 307 | # standalone debug builds. |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 308 | if (perfetto_build_standalone && (is_linux || is_android)) { |
| 309 | group("libbacktrace") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 310 | public_deps = [ "//buildtools:libbacktrace" ] |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 311 | } |
| 312 | } |
| 313 | |
Mikhail Khokhlov | 0f7e68d | 2020-01-16 15:39:27 +0000 | [diff] [blame] | 314 | if (enable_perfetto_trace_processor_sqlite) { |
| 315 | group("sqlite") { |
| 316 | if (perfetto_root_path == "//") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 317 | public_deps = [ "//buildtools:sqlite" ] |
Mikhail Khokhlov | 0f7e68d | 2020-01-16 15:39:27 +0000 | [diff] [blame] | 318 | } else { |
Mikhail Khokhlov | 302f1f6 | 2020-03-12 12:08:29 +0000 | [diff] [blame] | 319 | if (build_with_chromium) { |
| 320 | public_deps = [ "//third_party/sqlite:sqlite_dev" ] |
| 321 | } else { |
| 322 | public_deps = [ "//third_party/sqlite:sqlite" ] |
| 323 | } |
Mikhail Khokhlov | 0f7e68d | 2020-01-16 15:39:27 +0000 | [diff] [blame] | 324 | public_configs = [ ":sqlite_third_party_include_path" ] |
| 325 | } |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 326 | } |
Mikhail Khokhlov | 2bcfb35 | 2019-12-20 10:19:58 +0000 | [diff] [blame] | 327 | } |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 328 | |
Mikhail Khokhlov | 2bcfb35 | 2019-12-20 10:19:58 +0000 | [diff] [blame] | 329 | config("sqlite_third_party_include_path") { |
Mikhail Khokhlov | 302f1f6 | 2020-03-12 12:08:29 +0000 | [diff] [blame] | 330 | if (build_with_chromium) { |
| 331 | include_dirs = [ "//third_party/sqlite/dev" ] |
| 332 | } else { |
| 333 | include_dirs = [ "//third_party/sqlite" ] |
| 334 | } |
Mikhail Khokhlov | 2bcfb35 | 2019-12-20 10:19:58 +0000 | [diff] [blame] | 335 | } |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 336 | |
| 337 | if (enable_perfetto_trace_processor_json) { |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 338 | group("jsoncpp") { |
| 339 | if (perfetto_root_path == "//") { |
| 340 | public_configs = [ "//buildtools:jsoncpp_config" ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 341 | public_deps = [ "//buildtools:jsoncpp" ] |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 342 | } else { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 343 | public_deps = [ "//third_party/jsoncpp:jsoncpp" ] |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 344 | } |
| 345 | } |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 346 | } |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 347 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 348 | if (enable_perfetto_trace_processor_linenoise) { |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 349 | # Used by the trace_processor_shell for REPL history. |
Hector Dearman | 5145e50 | 2019-09-18 16:52:24 +0100 | [diff] [blame] | 350 | # Only available in standalone builds. |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 351 | group("linenoise") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 352 | public_deps = [ "//buildtools:linenoise" ] |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 353 | } |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 354 | } # if (enable_perfetto_trace_processor_linenoise) |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 355 | |
| 356 | # Only used by src/profiling in standalone and android builds. |
Ryan Savitski | 56bc0c6 | 2020-01-27 13:50:02 +0000 | [diff] [blame] | 357 | if (enable_perfetto_heapprofd || enable_perfetto_traced_perf) { |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 358 | group("libunwindstack") { |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 359 | public_configs = [ "//buildtools:libunwindstack_config" ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 360 | public_deps = [ "//buildtools:libunwindstack" ] |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 361 | } |
| 362 | } |
Ryan Savitski | 154bfab | 2019-06-07 15:12:27 +0100 | [diff] [blame] | 363 | |
Ryan Savitski | 56bc0c6 | 2020-01-27 13:50:02 +0000 | [diff] [blame] | 364 | # Used by src/profiling/perf for perf_regs.h. |
| 365 | if (enable_perfetto_traced_perf) { |
| 366 | group("bionic_kernel_uapi_headers") { |
| 367 | public_configs = [ "//buildtools:bionic_kernel_uapi_headers" ] |
| 368 | } |
| 369 | } |
| 370 | |
Florian Mayer | 319ba56 | 2021-04-20 17:35:03 +0100 | [diff] [blame] | 371 | config("system_zlib_config") { |
| 372 | libs = [ "z" ] |
| 373 | } |
| 374 | |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 375 | # Zlib is used both by trace_processor and by perfetto_cmd. |
Primiano Tucci | 1b5fdae | 2020-01-16 09:28:05 +0000 | [diff] [blame] | 376 | if (enable_perfetto_zlib) { |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 377 | group("zlib") { |
Florian Mayer | 319ba56 | 2021-04-20 17:35:03 +0100 | [diff] [blame] | 378 | if (perfetto_use_system_zlib) { |
| 379 | public_configs = [ "//gn:system_zlib_config" ] |
| 380 | } else if (perfetto_root_path == "//") { |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 381 | public_configs = [ "//buildtools:zlib_config" ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 382 | public_deps = [ "//buildtools:zlib" ] |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 383 | } else { |
| 384 | public_configs = [ "//third_party/zlib:zlib_config" ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 385 | public_deps = [ "//third_party/zlib" ] |
Primiano Tucci | 7e05fc1 | 2019-08-27 17:29:47 +0200 | [diff] [blame] | 386 | } |
| 387 | } |
| 388 | } |
| 389 | |
Ryan Savitski | 154bfab | 2019-06-07 15:12:27 +0100 | [diff] [blame] | 390 | # Used by fuzzers. |
Florian Mayer | 0bea797 | 2019-09-02 15:28:13 +0100 | [diff] [blame] | 391 | if (enable_perfetto_fuzzers && use_libfuzzer) { |
Ryan Savitski | 154bfab | 2019-06-07 15:12:27 +0100 | [diff] [blame] | 392 | group("libfuzzer") { |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 393 | assert(perfetto_root_path == "//") |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 394 | public_deps = [ "//buildtools:libfuzzer" ] |
Ryan Savitski | 154bfab | 2019-06-07 15:12:27 +0100 | [diff] [blame] | 395 | } |
| 396 | } |