blob: 9c62f426f32d41eba44d2afe55ec0fab34c1ea9e [file] [log] [blame]
# 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("//build_overrides/build.gni")
# Summary of our build configurations:
# 1. Standalone builds
# perfetto_build_standalone = true
# perfetto_build_with_embedder = false
# perfetto_build_with_android = false
# build_with_chromium = false
# 2. Android tree builds
# perfetto_build_standalone = false
# perfetto_build_with_android = true
# perfetto_build_with_embedder = false
# build_with_chromium = false
# 3. Chromium tree builds
# perfetto_build_standalone = false
# perfetto_build_with_android = false
# perfetto_build_with_embedder = true
# build_with_chromium = true
# 4. Builds in other embedder trees
# perfetto_build_standalone = false
# perfetto_build_with_android = false
# perfetto_build_with_embedder = true
# build_with_chromium = false
# Note that |build_with_chromium| is a global convention used by several
# projects, set outside of our control.
declare_args() {
# The Android blueprint file generator overrides this to true.
perfetto_build_with_android = false
# Whether the ftrace producer and the service should be started
# by the integration test or assumed to be running.
start_daemons_for_testing = true
}
# Chromium sets this to true.
if (!defined(build_with_chromium)) {
build_with_chromium = false
}
# Embedders can override this to true.
if (!defined(perfetto_build_with_embedder)) {
perfetto_build_with_embedder = build_with_chromium
}
perfetto_force_dlog_default = ""
if (perfetto_build_with_embedder) {
perfetto_force_dlog_default = "off"
}
declare_args() {
# Whether DLOG should be enabled on debug builds (""), all builds ("on"), or
# none ("off"). We disable it by default for embedders to avoid spamming their
# console.
perfetto_force_dlog = perfetto_force_dlog_default
}
assert(perfetto_force_dlog == "" || perfetto_force_dlog == "on" ||
perfetto_force_dlog == "off")
perfetto_build_standalone =
!perfetto_build_with_android && !build_with_chromium &&
!perfetto_build_with_embedder
if (perfetto_build_standalone || perfetto_build_with_android) {
perfetto_root_path = "//"
} else if (!defined(perfetto_root_path)) {
perfetto_root_path = "//third_party/perfetto/"
}
# If we're building in the Android tree, we expect that the testing infra
# will start the binaries in the system image before the tests are run.
if (perfetto_build_with_android) {
start_daemons_for_testing = false
}
# Cross-checks.
# Exactly one between build_with_android, build_standalone and
# build_with_embedder must be true.
assert(perfetto_build_standalone || perfetto_build_with_android ||
perfetto_build_with_embedder)
assert(!(perfetto_build_with_android && perfetto_build_standalone))
assert(!(perfetto_build_with_embedder && perfetto_build_standalone))
assert(!(perfetto_build_with_android && perfetto_build_with_embedder))
# If |build_with_chromium| is true then also |perfetto_build_with_embedder|
# must be true
assert(!build_with_chromium || perfetto_build_with_embedder)
# Only perfetto itself (standalone or with android) and chromium should link
# in the IPC layer.
#
# This includes building things that rely on POSIX sockets, this places
# limitations on the supported operating systems.
perfetto_build_with_ipc_layer =
(is_android || is_linux || is_mac) &&
(perfetto_build_standalone || perfetto_build_with_android ||
build_with_chromium)