xref: /aosp_15_r20/external/angle/build_overrides/build.gni (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1# Copyright 2017 The ANGLE Project Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5declare_args() {
6  build_with_chromium = false
7  ignore_elf32_limitations = true
8
9  use_system_xcode = ""
10
11  # If true, it assumes that //third_party/abseil-cpp is an available
12  # dependency for googletest.
13  gtest_enable_absl_printers = false
14
15  # Set to default here so that it can be set via gn args
16  use_cxx17 = false
17}
18
19if (host_os == "mac" && use_system_xcode == "") {
20  _result = exec_script("//build/mac/should_use_hermetic_xcode.py",
21                        [ target_os ],
22                        "value")
23
24  assert(_result != 2,
25         "Do not allow building targets with the default" +
26             "hermetic toolchain if the minimum OS version is not met.")
27  assert(_result != 3,
28         "iOS does not support building with a hermetic toolchain. " +
29             "Please install Xcode.")
30
31  use_system_xcode = _result != 1
32}
33
34enable_java_templates = true
35
36# Build with fewer Android dependencies
37limit_android_deps = true
38
39# Standalone ANGLE is used in places that are extremely performance sensitive,
40# such as the system graphics driver on Android. ANGLE validates arguments at
41# the API boundary and assumes that all bounds, et cetera are valid elsewhere
42# in internal code.
43#
44# Unfortunately, this means the compiler cannot optimize out the vast majority
45# of hardening checks. To ensure performance remains competitive, drop the
46# libc++ hardening checks, since ANGLE already makes no security guarantees in
47# these situations.
48if (is_win) {
49  # TODO(https://crbug.com/1418717): ANGLE uses Chromium's abseil-cpp directory.
50  # Since Abseil does not mark symbols as exported, Chromium uses an alternate
51  # approach to scrape the symbols that need to be exported and generates .def
52  # files that the ANGLE build reuses.
53  #
54  # However, these symbol names include libc++ types, and libc++ hardening
55  # affects ABI, so ANGLE and Chromium's libc++ hardening modes need to remain
56  # in sync on Windows. This is a bit of a hack but "OK" since the performance
57  # concerns for standalone ANGLE builds are not relevant on Windows.
58  enable_safe_libcxx = true
59} else if (is_linux) {
60  # https://anglebug.com/40096878: turning off safe_libcxx breaks TSAN
61  enable_safe_libcxx = true
62} else {
63  enable_safe_libcxx = false
64}
65