Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [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 | ec59013 | 2020-11-16 14:16:44 +0100 | [diff] [blame] | 16 | import("../../gn/gen_perfetto_version_header.gni") |
Primiano Tucci | 38faa6f | 2018-04-01 20:12:08 +0200 | [diff] [blame] | 17 | import("../../gn/perfetto.gni") |
Primiano Tucci | 916f4e5 | 2020-10-16 20:40:33 +0200 | [diff] [blame] | 18 | import("../../gn/perfetto_component.gni") |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 19 | import("../../gn/test.gni") |
Primiano Tucci | 4bdc4c4 | 2018-05-10 15:52:33 +0100 | [diff] [blame] | 20 | import("../../gn/wasm.gni") |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 21 | |
Primiano Tucci | 916f4e5 | 2020-10-16 20:40:33 +0200 | [diff] [blame] | 22 | perfetto_component("base") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 23 | deps = [ "../../gn:default_deps" ] |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 24 | public_deps = [ |
| 25 | "../../include/perfetto/base", |
Primiano Tucci | 2c5488f | 2019-06-01 03:27:28 +0100 | [diff] [blame] | 26 | "../../include/perfetto/ext/base", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 27 | ] |
| 28 | sources = [ |
Primiano Tucci | bc2b244 | 2020-12-09 01:30:14 +0100 | [diff] [blame] | 29 | "event_fd.cc", |
Florian Mayer | 74b73a9 | 2018-03-09 17:37:13 +0000 | [diff] [blame] | 30 | "file_utils.cc", |
Primiano Tucci | c64b05f | 2019-12-05 10:30:52 +0000 | [diff] [blame] | 31 | "logging.cc", |
Florian Mayer | 236ba47 | 2018-05-09 15:47:53 +0100 | [diff] [blame] | 32 | "metatrace.cc", |
Eric Seckler | edf3f7c | 2018-10-23 16:44:53 +0100 | [diff] [blame] | 33 | "paged_memory.cc", |
Primiano Tucci | 1366dd0 | 2020-12-02 10:17:10 +0100 | [diff] [blame] | 34 | "pipe.cc", |
Primiano Tucci | df44031 | 2020-10-30 16:43:58 +0100 | [diff] [blame] | 35 | "status.cc", |
Primiano Tucci | 825e6de | 2018-03-13 05:43:15 +0000 | [diff] [blame] | 36 | "string_splitter.cc", |
Hector Dearman | 3afb1e0 | 2018-04-27 16:46:52 +0100 | [diff] [blame] | 37 | "string_utils.cc", |
Primiano Tucci | 60c4a2b | 2019-03-02 17:11:18 +0000 | [diff] [blame] | 38 | "string_view.cc", |
Primiano Tucci | 1797cd1 | 2020-04-14 09:43:24 +0100 | [diff] [blame] | 39 | "subprocess.cc", |
Primiano Tucci | e4de2da | 2020-12-01 14:54:07 +0100 | [diff] [blame] | 40 | "temp_file.cc", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 41 | "thread_checker.cc", |
Bruce Dawson | 2af6ef7 | 2018-05-01 15:28:39 +0100 | [diff] [blame] | 42 | "time.cc", |
Primiano Tucci | a81d277 | 2020-10-07 00:12:41 +0200 | [diff] [blame] | 43 | "utils.cc", |
Hector Dearman | f275f69 | 2019-07-31 12:56:59 +0100 | [diff] [blame] | 44 | "uuid.cc", |
Primiano Tucci | ec59013 | 2020-11-16 14:16:44 +0100 | [diff] [blame] | 45 | "version.cc", |
Primiano Tucci | 3cbb10a | 2018-04-10 17:52:40 +0100 | [diff] [blame] | 46 | "virtual_destructors.cc", |
Sami Kyostila | 389861f | 2019-07-09 20:52:43 +0100 | [diff] [blame] | 47 | "waitable_event.cc", |
Sami Kyostila | facfa14 | 2019-08-08 17:08:43 +0100 | [diff] [blame] | 48 | "watchdog_posix.cc", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 49 | ] |
Florian Mayer | 236ba47 | 2018-05-09 15:47:53 +0100 | [diff] [blame] | 50 | |
Bruce Dawson | 2af6ef7 | 2018-05-01 15:28:39 +0100 | [diff] [blame] | 51 | # TODO(brucedawson): Enable these for Windows when possible. |
Eric Seckler | 60eff7d | 2020-05-20 13:03:07 +0100 | [diff] [blame] | 52 | if (!is_win && !is_nacl) { |
Primiano Tucci | bc2b244 | 2020-12-09 01:30:14 +0100 | [diff] [blame] | 53 | sources += [ "thread_task_runner.cc" ] |
Bruce Dawson | 2af6ef7 | 2018-05-01 15:28:39 +0100 | [diff] [blame] | 54 | } |
| 55 | |
Mikhail Khokhlov | 0226b68 | 2020-12-09 13:47:33 +0000 | [diff] [blame] | 56 | if (!is_nacl) { |
| 57 | sources += [ "unix_task_runner.cc" ] |
| 58 | } |
| 59 | |
Primiano Tucci | 824be14 | 2020-07-08 16:15:44 +0100 | [diff] [blame] | 60 | if (enable_perfetto_stderr_crash_dump) { |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 61 | deps += [ ":debug_crash_stack_trace" ] |
| 62 | } |
Primiano Tucci | ec59013 | 2020-11-16 14:16:44 +0100 | [diff] [blame] | 63 | |
| 64 | if (enable_perfetto_version_gen) { |
| 65 | deps += [ ":version_gen_h" ] |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | if (enable_perfetto_version_gen) { |
| 70 | config("version_gen_config") { |
| 71 | include_dirs = [ root_gen_dir ] |
| 72 | } |
| 73 | |
| 74 | # Note: the build file translators (tools/gn_utils.py) depend on the hardcoded |
| 75 | # "//src/base:version_gen_h". If you rename this target, update build file |
| 76 | # translators accordingly. |
| 77 | gen_perfetto_version_header("version_gen_h") { |
| 78 | cpp_out = "${root_gen_dir}/perfetto_version.gen.h" |
| 79 | } |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 80 | } |
| 81 | |
Primiano Tucci | 824be14 | 2020-07-08 16:15:44 +0100 | [diff] [blame] | 82 | if (enable_perfetto_stderr_crash_dump) { |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 83 | source_set("debug_crash_stack_trace") { |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 84 | sources = [ "debug_crash_stack_trace.cc" ] |
Primiano Tucci | a5ff2a8 | 2017-12-20 11:37:00 +0100 | [diff] [blame] | 85 | deps = [ |
| 86 | "../../gn:default_deps", |
Primiano Tucci | 2c5488f | 2019-06-01 03:27:28 +0100 | [diff] [blame] | 87 | "../../include/perfetto/ext/base", |
| 88 | "../../include/perfetto/ext/base", |
Primiano Tucci | a5ff2a8 | 2017-12-20 11:37:00 +0100 | [diff] [blame] | 89 | ] |
Primiano Tucci | 38faa6f | 2018-04-01 20:12:08 +0200 | [diff] [blame] | 90 | if (is_linux || is_android) { |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 91 | deps += [ "../../gn:libbacktrace" ] |
Primiano Tucci | 38faa6f | 2018-04-01 20:12:08 +0200 | [diff] [blame] | 92 | } |
Primiano Tucci | 3cbb10a | 2018-04-10 17:52:40 +0100 | [diff] [blame] | 93 | cflags = [ "-Wno-deprecated" ] |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 94 | } |
| 95 | } |
| 96 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 97 | if (enable_perfetto_ipc) { |
Florian Mayer | b6c3bff | 2018-09-13 16:36:49 +0100 | [diff] [blame] | 98 | # This cannot be in :base as it does not build on WASM. |
Primiano Tucci | 916f4e5 | 2020-10-16 20:40:33 +0200 | [diff] [blame] | 99 | perfetto_component("unix_socket") { |
Florian Mayer | b6c3bff | 2018-09-13 16:36:49 +0100 | [diff] [blame] | 100 | deps = [ |
| 101 | "../../gn:default_deps", |
Primiano Tucci | 2c5488f | 2019-06-01 03:27:28 +0100 | [diff] [blame] | 102 | "../../include/perfetto/ext/base", |
| 103 | "../../include/perfetto/ext/base", |
Florian Mayer | b6c3bff | 2018-09-13 16:36:49 +0100 | [diff] [blame] | 104 | ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 105 | sources = [ "unix_socket.cc" ] |
Florian Mayer | b6c3bff | 2018-09-13 16:36:49 +0100 | [diff] [blame] | 106 | } |
Florian Mayer | f427a80 | 2018-09-13 11:21:46 +0100 | [diff] [blame] | 107 | } |
| 108 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 109 | source_set("test_support") { |
| 110 | testonly = true |
| 111 | deps = [ |
| 112 | ":base", |
| 113 | "../../gn:default_deps", |
| 114 | ] |
| 115 | sources = [ |
Hector Dearman | 7f71d0e | 2018-08-09 11:26:10 +0100 | [diff] [blame] | 116 | "test/utils.cc", |
| 117 | "test/utils.h", |
Florian Mayer | d8bd81b | 2018-01-25 12:49:15 +0000 | [diff] [blame] | 118 | "test/vm_test_utils.cc", |
| 119 | "test/vm_test_utils.h", |
Florian Mayer | c7255fd | 2018-01-25 10:29:24 +0000 | [diff] [blame] | 120 | ] |
Primiano Tucci | c2eb510 | 2018-05-15 10:40:01 +0100 | [diff] [blame] | 121 | |
Bruce Dawson | 78bca4b | 2018-05-10 17:35:30 +0100 | [diff] [blame] | 122 | # The Perfetto task runner is not used on Windows. |
| 123 | if (!is_win) { |
| 124 | sources += [ |
| 125 | "test/test_task_runner.cc", |
| 126 | "test/test_task_runner.h", |
| 127 | ] |
| 128 | } |
Florian Mayer | c7255fd | 2018-01-25 10:29:24 +0000 | [diff] [blame] | 129 | } |
| 130 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 131 | perfetto_unittest_source_set("unittests") { |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 132 | testonly = true |
| 133 | deps = [ |
| 134 | ":base", |
Bruce Dawson | 78bca4b | 2018-05-10 17:35:30 +0100 | [diff] [blame] | 135 | ":test_support", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 136 | "../../gn:default_deps", |
Primiano Tucci | 13ae72f | 2019-06-06 10:53:02 +0100 | [diff] [blame] | 137 | "../../gn:gtest_and_gmock", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 138 | ] |
Florian Mayer | 236ba47 | 2018-05-09 15:47:53 +0100 | [diff] [blame] | 139 | |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 140 | sources = [ |
Primiano Tucci | 89795fd | 2019-02-18 23:08:06 +0000 | [diff] [blame] | 141 | "circular_queue_unittest.cc", |
Primiano Tucci | 79dd3bc | 2019-12-05 13:17:37 +0000 | [diff] [blame] | 142 | "flat_set_unittest.cc", |
Ryan Savitski | 478c118 | 2019-04-04 23:28:11 +0100 | [diff] [blame] | 143 | "no_destructor_unittest.cc", |
Lalit Maganti | f3e5b07 | 2018-11-19 21:51:47 +0000 | [diff] [blame] | 144 | "optional_unittest.cc", |
Eric Seckler | edf3f7c | 2018-10-23 16:44:53 +0100 | [diff] [blame] | 145 | "paged_memory_unittest.cc", |
Bruce Dawson | 2c4a460 | 2018-05-08 19:51:49 +0100 | [diff] [blame] | 146 | "scoped_file_unittest.cc", |
| 147 | "string_splitter_unittest.cc", |
| 148 | "string_utils_unittest.cc", |
Primiano Tucci | 2da5d2e | 2018-08-10 14:23:31 +0100 | [diff] [blame] | 149 | "string_view_unittest.cc", |
Lalit Maganti | bd3fb82 | 2019-02-08 10:08:20 +0000 | [diff] [blame] | 150 | "string_writer_unittest.cc", |
Primiano Tucci | 1797cd1 | 2020-04-14 09:43:24 +0100 | [diff] [blame] | 151 | "subprocess_unittest.cc", |
Primiano Tucci | bc2b244 | 2020-12-09 01:30:14 +0100 | [diff] [blame] | 152 | "task_runner_unittest.cc", |
Primiano Tucci | e4de2da | 2020-12-01 14:54:07 +0100 | [diff] [blame] | 153 | "temp_file_unittest.cc", |
Primiano Tucci | bc2b244 | 2020-12-09 01:30:14 +0100 | [diff] [blame] | 154 | "thread_checker_unittest.cc", |
Primiano Tucci | 8934c6c | 2018-03-15 11:39:27 +0000 | [diff] [blame] | 155 | "time_unittest.cc", |
Primiano Tucci | 1366dd0 | 2020-12-02 10:17:10 +0100 | [diff] [blame] | 156 | "utils_unittest.cc", |
Hector Dearman | f275f69 | 2019-07-31 12:56:59 +0100 | [diff] [blame] | 157 | "uuid_unittest.cc", |
Bruce Dawson | 2c4a460 | 2018-05-08 19:51:49 +0100 | [diff] [blame] | 158 | "weak_ptr_unittest.cc", |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 159 | ] |
Florian Mayer | 236ba47 | 2018-05-09 15:47:53 +0100 | [diff] [blame] | 160 | |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 161 | # TODO: Enable these for Windows when possible. |
Bruce Dawson | 2af6ef7 | 2018-05-01 15:28:39 +0100 | [diff] [blame] | 162 | if (!is_win) { |
| 163 | sources += [ |
Primiano Tucci | f80d2d4 | 2019-06-05 09:30:59 +0100 | [diff] [blame] | 164 | "metatrace_unittest.cc", |
Ryan Savitski | 2988579 | 2019-03-14 12:10:13 +0000 | [diff] [blame] | 165 | "thread_task_runner_unittest.cc", |
Florian Mayer | 623f0fc | 2020-11-18 17:37:35 +0000 | [diff] [blame] | 166 | "watchdog_posix_unittest.cc", |
Bruce Dawson | 2af6ef7 | 2018-05-01 15:28:39 +0100 | [diff] [blame] | 167 | ] |
| 168 | } |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 169 | if (perfetto_build_standalone || perfetto_build_with_android) { |
Primiano Tucci | 02c1176 | 2019-08-30 00:57:59 +0200 | [diff] [blame] | 170 | # This causes some problems on the chromium waterfall. |
Florian Mayer | f7f0def | 2018-09-27 13:59:24 +0100 | [diff] [blame] | 171 | if (is_linux || is_android) { |
| 172 | sources += [ "watchdog_unittest.cc" ] |
| 173 | } |
Primiano Tucci | 6320170 | 2020-12-04 17:38:12 +0100 | [diff] [blame] | 174 | if (!is_win) { |
| 175 | sources += [ "unix_socket_unittest.cc" ] |
| 176 | } |
Primiano Tucci | c96f71b | 2018-02-06 19:21:09 +0000 | [diff] [blame] | 177 | } |
Primiano Tucci | 4f9b6d7 | 2017-12-05 20:59:16 +0000 | [diff] [blame] | 178 | } |
Primiano Tucci | 79dd3bc | 2019-12-05 13:17:37 +0000 | [diff] [blame] | 179 | |
| 180 | if (enable_perfetto_benchmarks) { |
| 181 | source_set("benchmarks") { |
| 182 | testonly = true |
| 183 | deps = [ |
| 184 | ":base", |
| 185 | "../../gn:benchmark", |
| 186 | "../../gn:default_deps", |
| 187 | ] |
Primiano Tucci | 2925e9d | 2020-01-27 10:15:58 +0000 | [diff] [blame] | 188 | sources = [ "flat_set_benchmark.cc" ] |
Primiano Tucci | 79dd3bc | 2019-12-05 13:17:37 +0000 | [diff] [blame] | 189 | } |
| 190 | } |