# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/features.gni")
import("//build/config/gclient_args.gni")
# Uncomment these to specify a different NDK location and version in
# non-Chromium builds.
# default_android_ndk_root = "//third_party/android_toolchain/ndk"
# default_android_ndk_version = "r10e"
# Some non-Chromium builds don't support building java targets.
enable_java_templates = true
# Variable that can be used to support multiple build scenarios, like when
# V8 is embedded within a target.
build_with_v8_embedder = build_with_chromium
# Enables assertions on safety checks in libc++.
#
# This should be set to true whenever building with Chrome's custom libc++ in
# order to guard against undefined behavior. However, the asserts added by
# hardening libc++ may introduce some performance overhead, so this is
# configurable to simplify A/B tests, and to allow performance-sensitive
# projects embedding Chrome (e.g. ANGLE) to disable libc++ hardening.
#
# Note that setting this to true only has an effect when also building with
# `use_custom_libcxx = true`.
enable_safe_libcxx = true
# Features used by //base/trace_event and //services/tracing.
declare_args() {
# Tracing support requires //third_party/perfetto, which is not available in
# libchrome (CrOS's version of //base). This flag can disable tracing support
# altogether, in which case all tracing instrumentation in //base becomes a
# no-op.
# TODO(crbug.com/40124378): Add dependency on perfetto to support typed events.
enable_base_tracing = true
# Limits the defined //third_party/android_deps targets to only "buildCompile"
# and "buildCompileNoDeps" targets. This is useful for third-party
# repositories which do not use JUnit tests. For instance,
# limit_android_deps == true removes "gn gen" requirement for
# //third_party/robolectric .
limit_android_deps = false
# Allows googletest to pretty-print various absl types. Disabled for nacl due
# to lack of toolchain support.
gtest_enable_absl_printers = !is_nacl
# Allow projects that wish to stay on C++17 to override Chromium's default.
# TODO(crbug.com/40251117): evaluate removing this end of 2023
use_cxx17 = false
}
# Features used by //base/trace_event.
declare_args() {
# Use Perfetto's trace processor for converting protobuf-encoded traces to
# the legacy JSON format in base::TraceLog.
use_perfetto_trace_processor = !is_nacl
}
# Allows different projects to specify their own suppression/ignore lists for
# sanitizer tools.
# asan_suppressions_file = "path/to/asan_suppressions.cc"
# asan_win_ignorelist_path = "path/to/asan/blocklist_win.txt"
# lsan_suppressions_file = "path/to/lsan_suppressions.cc"
# tsan_suppressions_file = "path/to/tsan_suppressions.cc"
# tsan_ignorelist_path = "path/to/tsan/ignores.txt"
# msan_ignorelist_path = "path/to/msan/ignorelist.txt"
# ubsan_ignorelist_path = "path/to/ubsan/ignorelist.txt"
# ubsan_vptr_ignorelist_path = "path/to/ubsan/vptr_ignorelist.txt"
# ubsan_security_ignorelist_path = "path/to/ubsan/security_ignorelist.txt"
# cfi_ignorelist_path = "path/to/cfi/ignores.txt"
if (host_os == "mac" || is_apple) {
# Needed for is_apple when targeting macOS or iOS, independent of host.
# Needed for host_os=="mac" for running host tool such as gperf in blink
# even when targeting e.g. Windows.
# TODO(thakis): See TODO in scripts.gni -- this should really only be needed
# if is_apple, independent of host_os.
declare_args() {
# Use the system install of Xcode for tools like ibtool, libtool, etc.
# This does not affect the compiler. When this variable is false, targets
# will instead use a hermetic install of Xcode. [The hermetic install can
# be obtained with gclient sync after setting the environment variable
# FORCE_MAC_TOOLCHAIN for target_os mac only].
use_system_xcode = ""
}
if (use_system_xcode == "") {
_result = exec_script("//build/mac/should_use_hermetic_xcode.py",
[ current_os ],
"value")
assert(_result != 2,
"Do not allow building targets with the default" +
"hermetic toolchain if the minimum OS version is not met.")
assert(_result != 3,
"iOS does not support building with a hermetic toolchain. " +
"Please install Xcode.")
use_system_xcode = _result != 1
}
assert(current_os != "ios" || use_system_xcode)
assert(host_os == "mac" || !use_system_xcode)
}