blob: 25a0625183e5f774e2132cc0ea0e7eacceed5a37 [file] [log] [blame]
Primiano Tucciae2879e2017-09-27 11:02:09 +09001# 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
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080015import("gn/perfetto.gni")
16
Primiano Tucciae2879e2017-09-27 11:02:09 +090017group("all") {
18 testonly = true # allow to build also test targets
19 deps = [
Primiano Tuccib03ba362017-12-06 09:47:41 +000020 ":perfetto_tests",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000021 "src/ipc/protoc_plugin:ipc_plugin($host_toolchain)",
22 "src/protozero/protoc_plugin($host_toolchain)",
Primiano Tucci6067e732018-01-08 16:19:40 +000023 "src/tracing:consumer_cmd",
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080024 "tools/ftrace_proto_gen:ftrace_proto_gen",
Primiano Tucci5fec9212017-12-11 23:08:40 +000025 "tools/proto_to_cpp",
Primiano Tucciae2879e2017-09-27 11:02:09 +090026 ]
Primiano Tuccib03ba362017-12-06 09:47:41 +000027 if (!build_with_chromium) {
28 deps += [
Oystein Eftevaag72dac262018-01-09 11:48:50 -080029 ":perfetto",
Primiano Tuccib03ba362017-12-06 09:47:41 +000030 ":perfetto_benchmarks",
Oystein Eftevaag72dac262018-01-09 11:48:50 -080031 ":traced",
32 ":traced_probes",
Primiano Tuccib03ba362017-12-06 09:47:41 +000033 "src/ftrace_reader:ftrace_reader_integrationtests",
34 ]
35 }
Primiano Tucciae2879e2017-09-27 11:02:09 +090036}
37
Primiano Tuccib03ba362017-12-06 09:47:41 +000038executable("perfetto_tests") {
Primiano Tucciae2879e2017-09-27 11:02:09 +090039 testonly = true
40 deps = [
Primiano Tuccib03ba362017-12-06 09:47:41 +000041 "gn:default_deps",
42 "src/base:base_unittests",
Primiano Tucci4f9b6d72017-12-05 20:59:16 +000043 "src/ftrace_reader:ftrace_reader_unittests",
44 "src/ipc:perfetto_ipc_unittests",
45 "src/protozero:protozero_unittests",
46 "src/tracing:tracing_unittests",
Primiano Tucciae2879e2017-09-27 11:02:09 +090047 ]
Primiano Tucci931284e2017-12-11 09:23:53 +000048 if (!build_with_chromium) {
49 deps += [ "tools/sanitizers_unittests" ]
50 }
Primiano Tuccib03ba362017-12-06 09:47:41 +000051}
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080052
Primiano Tuccib03ba362017-12-06 09:47:41 +000053if (!build_with_chromium) {
54 executable("perfetto_benchmarks") {
55 testonly = true
56 deps = [
57 "gn:default_deps",
58 "src/tracing:tracing_benchmarks",
59 ]
Oystein Eftevaagdd727e42017-12-05 08:49:55 -080060 }
Primiano Tucci4e49c022017-12-21 18:22:44 +010061
Primiano Tucci6067e732018-01-08 16:19:40 +000062 shared_library("libtraced_shared") {
Primiano Tucci4e49c022017-12-21 18:22:44 +010063 deps = [
64 "gn:default_deps",
Primiano Tucci3b729102018-01-08 18:16:36 +000065 "src/traced/perfetto_cmd",
Primiano Tucci6067e732018-01-08 16:19:40 +000066 "src/traced/probes",
67 "src/traced/service",
68 ]
Primiano Tucciedf099c2018-01-08 18:27:56 +000069 if (build_with_android) {
70 cflags = [ "-DPERFETTO_BUILD_WITH_ANDROID" ]
Primiano Tucci6ea459c2018-01-10 10:42:27 +000071 deps += [ "src/base:android_task_runner" ]
Primiano Tucciedf099c2018-01-08 18:27:56 +000072 libs = [ "utils" ]
73 }
Primiano Tucci6067e732018-01-08 16:19:40 +000074 }
75
Primiano Tucci3b729102018-01-08 18:16:36 +000076 # The unprivileged trace daemon that listens for Producer and Consumer
77 # connections, handles the coordination of the tracing sessions and owns the
78 # log buffers.
Primiano Tucci6067e732018-01-08 16:19:40 +000079 executable("traced") {
80 deps = [
81 ":libtraced_shared",
82 "gn:default_deps",
83 ]
84 sources = [
85 "src/traced/service/main.cc",
86 ]
87 }
88
Primiano Tucci3b729102018-01-08 18:16:36 +000089 # The unprivileged daemon that is allowed to access tracefs (for ftrace).
90 # Registers as a Producer on the traced daemon.
Primiano Tucci6067e732018-01-08 16:19:40 +000091 executable("traced_probes") {
92 deps = [
93 ":libtraced_shared",
94 "gn:default_deps",
95 ]
96 sources = [
97 "src/traced/probes/main.cc",
Primiano Tucci4e49c022017-12-21 18:22:44 +010098 ]
99 }
Primiano Tucci3b729102018-01-08 18:16:36 +0000100
101 # The command line client for Perfetto. Allows to configure / start / stop
102 # tracing, acting as a Consumer.
103 executable("perfetto") {
104 deps = [
105 ":libtraced_shared",
106 "gn:default_deps",
107 ]
108 sources = [
109 "src/traced/perfetto_cmd/main.cc",
110 ]
111 }
Oystein Eftevaag5e8a4eb2018-01-09 11:41:58 -0800112} else {
113 group("lib") {
114 public_configs = [ "gn:public_config" ]
115 deps = [
116 "src/tracing",
117 ]
118 }
119} # !build_with_chromium