blob: 3c01fdbe1abe61de015f67336bf9a219a3936dcf [file] [log] [blame]
Austin Enga329ac02023-11-01 20:50:44 +00001# Copyright 2023 The Dawn & Tint Authors
Arthur Sonzogni8b28afe2023-10-12 16:06:04 +00002#
Austin Enga329ac02023-11-01 20:50:44 +00003# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions are met:
5# 1. Redistributions of source code must retain the above copyright notice, this
6# list of conditions and the following disclaimer.
7# 2. Redistributions in binary form must reproduce the above copyright notice,
8# this list of conditions and the following disclaimer in the documentation
9# and/or other materials provided with the distribution.
10# 3. Neither the name of the copyright holder nor the names of its
11# contributors may be used to endorse or promote products derived from
12# this software without specific prior written permission.
13# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Arthur Sonzogni3aaa0a32024-05-31 14:01:04 +000023import("//build/config/android/config.gni")
24import("//build/config/cast.gni")
25import("//build/config/chromeos/ui_mode.gni")
26import("//build/config/compiler/compiler.gni")
27import("//build/config/cronet/config.gni")
28import("//build/config/dcheck_always_on.gni")
29import("//build/config/logging.gni")
Arthur Sonzogni9e394332024-01-10 17:35:02 +000030import("//build/config/sanitizers/sanitizers.gni")
Arthur Sonzogni8b28afe2023-10-12 16:06:04 +000031
Arthur Sonzogni3aaa0a32024-05-31 14:01:04 +000032partition_alloc_enable_arc_config = "//build/config/compiler:enable_arc"
33
34# partition_alloc is performance critical and it should generally be optimized for speed, even in
35# debug mode. Dawn doesn't really need its debug version.
36partition_alloc_remove_configs =
37 [ "//build/config/compiler:default_optimization" ]
38partition_alloc_add_configs = [ "//build/config/compiler:optimize_speed" ]
39
Arthur Sonzogni9e394332024-01-10 17:35:02 +000040# MSVC's cl.exe compiler is not supported.
Arthur Sonzogni7379e222024-01-09 17:32:25 +000041_compiler_supported = is_clang || !is_win
Arthur Sonzogni9e394332024-01-10 17:35:02 +000042
43# Windows: debug CRT is not compatible with the allocator shim.
Arthur Sonzogni7379e222024-01-09 17:32:25 +000044_build_type_supported = !is_win || (!is_component_build && !is_debug)
Arthur Sonzogni9e394332024-01-10 17:35:02 +000045
Arthur Sonzogni7379e222024-01-09 17:32:25 +000046_platform_supported =
47 is_android || is_apple || is_chromeos || is_fuchsia || is_linux || is_win
48
Arthur Sonzogni9e394332024-01-10 17:35:02 +000049# Sanitizers replace the allocator, don't replace it ourselves with partition_alloc.
50_is_using_sanitizers = is_asan || is_hwasan || is_lsan || is_tsan || is_msan
51
52_supported = _compiler_supported && _build_type_supported &&
53 _platform_supported && !_is_using_sanitizers
Arthur Sonzogni7379e222024-01-09 17:32:25 +000054
55use_partition_alloc_as_malloc_default = _supported
56use_allocator_shim_default = _supported
57enable_backup_ref_ptr_support_default = _supported
Arthur Sonzogni8b28afe2023-10-12 16:06:04 +000058put_ref_count_in_previous_slot_default = true
59enable_backup_ref_ptr_slow_checks_default = false
Arthur Sonzogni7379e222024-01-09 17:32:25 +000060enable_dangling_raw_ptr_checks_default = _supported
Arthur Sonzogni8b28afe2023-10-12 16:06:04 +000061
62# This is the default build configuration for pointers/raw_ptr*.
63raw_ptr_zero_on_construct_default = true
64raw_ptr_zero_on_move_default = true
65raw_ptr_zero_on_destruct_default = false
Arthur Sonzogni3aaa0a32024-05-31 14:01:04 +000066
67# Allow embedders to opt-out of C++20 build which is set as default.
68#
69# Dawn still uses C++17 only, because of Skia.
70assert_cpp20_default = false