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("../../gn/perfetto.gni") 16 import("../../gn/proto_library.gni") 17 import("../../gn/wasm.gni") 18 19 # The core source files that are used both by the "full" version (the host 20 # executable) and by the "lite" version (the WASM module for the UI). 21 source_set("common") { 22 public_deps = [ 23 "../../gn:default_deps", 24 "../../include/perfetto/base", 25 "../../include/perfetto/trace_processor:trace_processor", 26 "../../include/perfetto/traced:sys_stats_counters", 27 "../../protos/perfetto/trace:lite", 28 "../../protos/perfetto/trace/ftrace:lite", 29 "../../protos/perfetto/trace/profiling:lite", 30 "../../protos/third_party/pprof:lite", 31 "../../src/base", 32 "../../src/trace_processor:lib", 33 ] 34 sources = [ 35 "main.cc", 36 "trace_to_profile.cc", 37 "trace_to_profile.h", 38 "trace_to_systrace.cc", 39 "trace_to_systrace.h", 40 "trace_to_text.h", 41 "utils.cc", 42 "utils.h", 43 ] 44 if (perfetto_build_standalone) { 45 deps = [ 46 "../../gn/standalone:gen_git_revision", 47 ] 48 } 49 } 50 51 # Lite target for the WASM UI. Doesn't have any dependency on libprotobuf-full. 52 source_set("lite") { 53 deps = [ 54 ":common", 55 "../../gn:default_deps", 56 ] 57 sources = [ 58 "lite_fallbacks.cc", 59 ] 60 } 61 62 # Full traget for the host. Depends on libprotobuf-full. 63 source_set("full") { 64 testonly = true 65 deps = [ 66 ":common", 67 "../../gn:default_deps", 68 "../../gn:protobuf_full_deps", 69 ] 70 sources = [ 71 "proto_full_utils.cc", 72 "proto_full_utils.h", 73 "trace_to_text.cc", 74 ] 75 } 76 77 if (current_toolchain == host_toolchain) { 78 executable("trace_to_text_host") { 79 testonly = true 80 deps = [ 81 ":full", 82 "../../gn:default_deps", 83 ] 84 } 85 86 # WASM is too permissive, build a normal version of the binary to test for 87 # missing symbols. 88 executable("trace_to_text_lite_host") { 89 deps = [ 90 ":lite", 91 "../../gn:default_deps", 92 ] 93 } 94 } 95 96 wasm_lib("trace_to_text_wasm") { 97 name = "trace_to_text" 98 deps = [ 99 ":lite", 100 "../../gn:default_deps", 101 ] 102 } 103 104 # The one for the android tree is defined in the top-level BUILD.gn. 105 if (!perfetto_build_with_android) { 106 copy("trace_to_text") { 107 testonly = true 108 host_out_dir_ = 109 get_label_info(":trace_to_text_host($host_toolchain)", "root_out_dir") 110 deps = [ 111 ":trace_to_text_host($host_toolchain)", 112 ] 113 sources = [ 114 "${host_out_dir_}/trace_to_text_host", 115 ] 116 outputs = [ 117 "${root_out_dir}/trace_to_text", 118 ] 119 } 120 } 121