Hector Dearman | 20b3c1c | 2018-01-15 15:34:03 +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 | |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 15 | import("../../gn/perfetto.gni") |
Primiano Tucci | 1c752c1 | 2018-10-23 09:27:19 +0100 | [diff] [blame] | 16 | import("../../gn/wasm.gni") |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 17 | |
Primiano Tucci | 20dc8f7 | 2018-10-23 12:28:29 +0100 | [diff] [blame] | 18 | # The core source files that are used both by the "full" version (the host |
| 19 | # executable) and by the "lite" version (the WASM module for the UI). |
| 20 | source_set("common") { |
| 21 | public_deps = [ |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 22 | "../../gn:default_deps", |
Primiano Tucci | c2eb510 | 2018-05-15 10:40:01 +0100 | [diff] [blame] | 23 | "../../include/perfetto/base", |
Primiano Tucci | 82a8bfd | 2018-09-19 11:33:04 +0100 | [diff] [blame] | 24 | "../../include/perfetto/traced:sys_stats_counters", |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 25 | "../../protos/perfetto/trace:lite", |
Primiano Tucci | c2eb510 | 2018-05-15 10:40:01 +0100 | [diff] [blame] | 26 | "../../protos/perfetto/trace/ftrace:lite", |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 27 | ] |
| 28 | sources = [ |
| 29 | "ftrace_event_formatter.cc", |
| 30 | "ftrace_event_formatter.h", |
| 31 | "ftrace_inode_handler.cc", |
| 32 | "ftrace_inode_handler.h", |
| 33 | "main.cc", |
Isabelle Taylor | 0a6b4c7 | 2018-10-15 11:30:52 +0100 | [diff] [blame] | 34 | "process_formatter.h", |
Primiano Tucci | 20dc8f7 | 2018-10-23 12:28:29 +0100 | [diff] [blame] | 35 | "trace_to_systrace.cc", |
| 36 | "trace_to_systrace.h", |
| 37 | "trace_to_text.h", |
| 38 | "utils.cc", |
| 39 | "utils.h", |
| 40 | ] |
| 41 | } |
| 42 | |
| 43 | # Lite target for the WASM UI. Doesn't have any dependency on libprotobuf-full. |
| 44 | source_set("lite") { |
| 45 | deps = [ |
| 46 | ":common", |
| 47 | "../../gn:default_deps", |
| 48 | ] |
| 49 | sources = [ |
| 50 | "lite_fallbacks.cc", |
| 51 | ] |
| 52 | } |
| 53 | |
| 54 | # Full traget for the host. Depends on libprotobuf-full. |
| 55 | source_set("full") { |
| 56 | testonly = true |
| 57 | deps = [ |
| 58 | ":common", |
| 59 | "../../gn:default_deps", |
| 60 | "../../gn:protobuf_full_deps", |
| 61 | ] |
| 62 | sources = [ |
| 63 | "proto_full_utils.cc", |
| 64 | "proto_full_utils.h", |
Primiano Tucci | 20dc8f7 | 2018-10-23 12:28:29 +0100 | [diff] [blame] | 65 | "trace_to_text.cc", |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 66 | ] |
| 67 | } |
| 68 | |
Primiano Tucci | e8a7760 | 2018-01-16 00:14:08 +0000 | [diff] [blame] | 69 | if (current_toolchain == host_toolchain) { |
| 70 | executable("trace_to_text_host") { |
Primiano Tucci | 20dc8f7 | 2018-10-23 12:28:29 +0100 | [diff] [blame] | 71 | testonly = true |
Primiano Tucci | e8a7760 | 2018-01-16 00:14:08 +0000 | [diff] [blame] | 72 | deps = [ |
Primiano Tucci | 20dc8f7 | 2018-10-23 12:28:29 +0100 | [diff] [blame] | 73 | ":full", |
Primiano Tucci | e8a7760 | 2018-01-16 00:14:08 +0000 | [diff] [blame] | 74 | "../../gn:default_deps", |
Primiano Tucci | e8a7760 | 2018-01-16 00:14:08 +0000 | [diff] [blame] | 75 | ] |
| 76 | } |
| 77 | } |
| 78 | |
Primiano Tucci | 1c752c1 | 2018-10-23 09:27:19 +0100 | [diff] [blame] | 79 | wasm_lib("trace_to_text_wasm") { |
| 80 | name = "trace_to_text" |
| 81 | deps = [ |
Primiano Tucci | 20dc8f7 | 2018-10-23 12:28:29 +0100 | [diff] [blame] | 82 | ":lite", |
Primiano Tucci | 1c752c1 | 2018-10-23 09:27:19 +0100 | [diff] [blame] | 83 | "../../gn:default_deps", |
| 84 | ] |
| 85 | } |
| 86 | |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 87 | # The one for the android tree is defined in the top-level BUILD.gn. |
Primiano Tucci | 4c5efa4 | 2018-10-23 13:15:13 +0100 | [diff] [blame] | 88 | if (!perfetto_build_with_android) { |
Primiano Tucci | 21c19d8 | 2018-03-29 12:35:08 +0100 | [diff] [blame] | 89 | copy("trace_to_text") { |
| 90 | testonly = true |
| 91 | host_out_dir_ = |
| 92 | get_label_info(":trace_to_text_host($host_toolchain)", "root_out_dir") |
| 93 | deps = [ |
| 94 | ":trace_to_text_host($host_toolchain)", |
| 95 | ] |
| 96 | sources = [ |
| 97 | "${host_out_dir_}/trace_to_text_host", |
| 98 | ] |
| 99 | outputs = [ |
| 100 | "${root_out_dir}/trace_to_text", |
| 101 | ] |
| 102 | } |
Hector Dearman | 20b3c1c | 2018-01-15 15:34:03 +0000 | [diff] [blame] | 103 | } |