| # Copyright (C) 2017 The Android Open Source Project |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| import("gn/perfetto.gni") |
| |
| declare_args() { |
| # Only for local development. When true the binaries (perfetto, traced, ...) |
| # are monolithic and don't use a common shared library. This is mainly to |
| # avoid LD_LIBRARY_PATH dances when testing locally. |
| monolithic_binaries = false |
| } |
| assert(!monolithic_binaries || !build_with_android) |
| |
| group("all") { |
| testonly = true # allow to build also test targets |
| deps = [ |
| ":perfetto_unittests", |
| "src/ipc/protoc_plugin:ipc_plugin($host_toolchain)", |
| "src/protozero/protoc_plugin($host_toolchain)", |
| "tools/ftrace_proto_gen:ftrace_proto_gen", |
| "tools/proto_to_cpp", |
| "tools/trace_to_text", |
| ] |
| if (!build_with_chromium) { |
| deps += [ |
| ":perfetto", |
| ":perfetto_benchmarks", |
| ":perfetto_integrationtests", |
| ":traced", |
| ":traced_probes", |
| "protos/perfetto/config:merged_config", # For syntax-checking the proto. |
| "test/configs", |
| "tools:protoc_helper", |
| ] |
| } |
| } |
| |
| executable("perfetto_unittests") { |
| testonly = true |
| deps = [ |
| "gn:default_deps", |
| "gn:gtest_main", |
| "src/base:base_unittests", |
| "src/ftrace_reader:ftrace_reader_unittests", |
| "src/ipc:perfetto_ipc_unittests", |
| "src/protozero:protozero_unittests", |
| "src/tracing:tracing_unittests", |
| "tools/ftrace_proto_gen:ftrace_proto_gen_unittests", |
| ] |
| if (!build_with_chromium) { |
| deps += [ "tools/sanitizers_unittests" ] |
| } |
| } |
| |
| if (!build_with_chromium) { |
| executable("perfetto_benchmarks") { |
| testonly = true |
| deps = [ |
| "gn:default_deps", |
| "src/ftrace_reader:ftrace_reader_benchmarks", |
| "src/tracing:tracing_benchmarks", |
| "test:benchmark_main", |
| ] |
| } |
| |
| executable("perfetto_integrationtests") { |
| testonly = true |
| deps = [ |
| "gn:default_deps", |
| "gn:gtest_main", |
| "src/ftrace_reader:ftrace_reader_integrationtests", |
| "test:end_to_end_integrationtests", |
| ] |
| if (build_with_android) { |
| cflags = [ "-DPERFETTO_BUILD_WITH_ANDROID" ] |
| } |
| } |
| |
| if (monolithic_binaries) { |
| libtraced_shared_target_type = "source_set" |
| } else { |
| libtraced_shared_target_type = "shared_library" |
| } |
| |
| target(libtraced_shared_target_type, "libtraced_shared") { |
| deps = [ |
| "gn:default_deps", |
| "src/traced/probes", |
| "src/traced/service", |
| ] |
| } |
| |
| # The unprivileged trace daemon that listens for Producer and Consumer |
| # connections, handles the coordination of the tracing sessions and owns the |
| # log buffers. |
| executable("traced") { |
| deps = [ |
| ":libtraced_shared", |
| "gn:default_deps", |
| ] |
| sources = [ |
| "src/traced/service/main.cc", |
| ] |
| } |
| |
| # The unprivileged daemon that is allowed to access tracefs (for ftrace). |
| # Registers as a Producer on the traced daemon. |
| executable("traced_probes") { |
| deps = [ |
| ":libtraced_shared", |
| "gn:default_deps", |
| ] |
| sources = [ |
| "src/traced/probes/main.cc", |
| ] |
| } |
| |
| # The command line client for Perfetto. Allows to configure / start / stop |
| # tracing, acting as a Consumer. |
| executable("perfetto") { |
| deps = [ |
| "gn:default_deps", |
| "src/traced/perfetto_cmd", |
| ] |
| sources = [ |
| "src/traced/perfetto_cmd/main.cc", |
| ] |
| if (build_with_android) { |
| cflags = [ "-DPERFETTO_BUILD_WITH_ANDROID" ] |
| deps += [ "src/base:android_task_runner" ] |
| libs = [ |
| "binder", |
| "services", |
| "utils", |
| ] |
| } |
| } |
| } else { |
| group("lib") { |
| public_configs = [ "gn:public_config" ] |
| deps = [ |
| "src/tracing", |
| ] |
| } |
| } # !build_with_chromium |