blob: cec37f4f6d2335e600c7d3837e2d409ba1537e16 [file] [log] [blame]
Hector Dearman20b3c1c2018-01-15 15:34:03 +00001# 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 Tucci21c19d82018-03-29 12:35:08 +010015import("../../gn/perfetto.gni")
Primiano Tucci1c752c12018-10-23 09:27:19 +010016import("../../gn/wasm.gni")
Primiano Tucci21c19d82018-03-29 12:35:08 +010017
Primiano Tucci20dc8f72018-10-23 12:28:29 +010018# 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).
20source_set("common") {
21 public_deps = [
Primiano Tucci21c19d82018-03-29 12:35:08 +010022 "../../gn:default_deps",
Primiano Tuccic2eb5102018-05-15 10:40:01 +010023 "../../include/perfetto/base",
Primiano Tucci82a8bfd2018-09-19 11:33:04 +010024 "../../include/perfetto/traced:sys_stats_counters",
Primiano Tucci21c19d82018-03-29 12:35:08 +010025 "../../protos/perfetto/trace:lite",
Primiano Tuccic2eb5102018-05-15 10:40:01 +010026 "../../protos/perfetto/trace/ftrace:lite",
Primiano Tucci21c19d82018-03-29 12:35:08 +010027 ]
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 Taylor0a6b4c72018-10-15 11:30:52 +010034 "process_formatter.h",
Primiano Tucci20dc8f72018-10-23 12:28:29 +010035 "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.
44source_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.
55source_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 Tucci20dc8f72018-10-23 12:28:29 +010065 "trace_to_text.cc",
Primiano Tucci21c19d82018-03-29 12:35:08 +010066 ]
67}
68
Primiano Tuccie8a77602018-01-16 00:14:08 +000069if (current_toolchain == host_toolchain) {
70 executable("trace_to_text_host") {
Primiano Tucci20dc8f72018-10-23 12:28:29 +010071 testonly = true
Primiano Tuccie8a77602018-01-16 00:14:08 +000072 deps = [
Primiano Tucci20dc8f72018-10-23 12:28:29 +010073 ":full",
Primiano Tuccie8a77602018-01-16 00:14:08 +000074 "../../gn:default_deps",
Primiano Tuccie8a77602018-01-16 00:14:08 +000075 ]
76 }
77}
78
Primiano Tucci1c752c12018-10-23 09:27:19 +010079wasm_lib("trace_to_text_wasm") {
80 name = "trace_to_text"
81 deps = [
Primiano Tucci20dc8f72018-10-23 12:28:29 +010082 ":lite",
Primiano Tucci1c752c12018-10-23 09:27:19 +010083 "../../gn:default_deps",
84 ]
85}
86
Primiano Tucci21c19d82018-03-29 12:35:08 +010087# The one for the android tree is defined in the top-level BUILD.gn.
Primiano Tucci4c5efa42018-10-23 13:15:13 +010088if (!perfetto_build_with_android) {
Primiano Tucci21c19d82018-03-29 12:35:08 +010089 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 Dearman20b3c1c2018-01-15 15:34:03 +0000103}