• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
15import("//build_overrides/build.gni")
16
17# Summary of our build configurations:
18
19# 1. Standalone builds
20#    perfetto_build_standalone = true
21#    perfetto_build_with_embedder = false
22#    perfetto_build_with_android = false
23#    build_with_chromium = false
24
25# 2. Android tree builds
26#    perfetto_build_standalone = false
27#    perfetto_build_with_android = true
28#    perfetto_build_with_embedder = false
29#    build_with_chromium = false
30
31# 3. Chromium tree builds
32#    perfetto_build_standalone = false
33#    perfetto_build_with_android = false
34#    perfetto_build_with_embedder = true
35#    build_with_chromium = true
36
37# 4. Builds in other embedder trees
38#    perfetto_build_standalone = false
39#    perfetto_build_with_android = false
40#    perfetto_build_with_embedder = true
41#    build_with_chromium = false
42
43# Note that |build_with_chromium| is a global convention used by several
44# projects, set outside of our control.
45
46declare_args() {
47  # The Android blueprint file generator overrides this to true.
48  perfetto_build_with_android = false
49
50  # Whether the ftrace producer and the service should be started
51  # by the integration test or assumed to be running.
52  start_daemons_for_testing = true
53}
54
55# Chromium sets this to true.
56if (!defined(build_with_chromium)) {
57  build_with_chromium = false
58}
59
60# Embedders can override this to true.
61if (!defined(perfetto_build_with_embedder)) {
62  perfetto_build_with_embedder = build_with_chromium
63}
64
65perfetto_force_dlog_default = ""
66if (perfetto_build_with_embedder) {
67  perfetto_force_dlog_default = "off"
68}
69
70declare_args() {
71  # Whether DLOG should be enabled on debug builds (""), all builds ("on"), or
72  # none ("off"). We disable it by default for embedders to avoid spamming their
73  # console.
74  perfetto_force_dlog = perfetto_force_dlog_default
75}
76
77assert(perfetto_force_dlog == "" || perfetto_force_dlog == "on" ||
78       perfetto_force_dlog == "off")
79
80perfetto_build_standalone =
81    !perfetto_build_with_android && !build_with_chromium &&
82    !perfetto_build_with_embedder
83
84if (perfetto_build_standalone || perfetto_build_with_android) {
85  perfetto_root_path = "//"
86} else if (!defined(perfetto_root_path)) {
87  perfetto_root_path = "//third_party/perfetto/"
88}
89
90# If we're building in the Android tree, we expect that the testing infra
91# will start the binaries in the system image before the tests are run.
92if (perfetto_build_with_android) {
93  start_daemons_for_testing = false
94}
95
96# Cross-checks.
97
98# Exactly one between build_with_android, build_standalone and
99# build_with_embedder must be true.
100assert(perfetto_build_standalone || perfetto_build_with_android ||
101       perfetto_build_with_embedder)
102assert(!(perfetto_build_with_android && perfetto_build_standalone))
103assert(!(perfetto_build_with_embedder && perfetto_build_standalone))
104assert(!(perfetto_build_with_android && perfetto_build_with_embedder))
105
106# If |build_with_chromium| is true then also |perfetto_build_with_embedder|
107# must be true
108assert(!build_with_chromium || perfetto_build_with_embedder)
109
110# Only perfetto itself (standalone or with android) and chromium should link
111# in the IPC layer.
112#
113# This includes building things that rely on POSIX sockets, this places
114# limitations on the supported operating systems.
115perfetto_build_with_ipc_layer =
116    (is_android || is_linux || is_mac) &&
117    (perfetto_build_standalone || perfetto_build_with_android ||
118     build_with_chromium)
119