Austin Eng | a329ac0 | 2023-11-01 20:50:44 +0000 | [diff] [blame] | 1 | # Copyright 2023 The Dawn & Tint Authors |
Arthur Sonzogni | 8b28afe | 2023-10-12 16:06:04 +0000 | [diff] [blame] | 2 | # |
Austin Eng | a329ac0 | 2023-11-01 20:50:44 +0000 | [diff] [blame] | 3 | # 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 Sonzogni | 3aaa0a3 | 2024-05-31 14:01:04 +0000 | [diff] [blame] | 23 | import("//build/config/android/config.gni") |
| 24 | import("//build/config/cast.gni") |
| 25 | import("//build/config/chromeos/ui_mode.gni") |
| 26 | import("//build/config/compiler/compiler.gni") |
| 27 | import("//build/config/cronet/config.gni") |
| 28 | import("//build/config/dcheck_always_on.gni") |
| 29 | import("//build/config/logging.gni") |
Arthur Sonzogni | 9e39433 | 2024-01-10 17:35:02 +0000 | [diff] [blame] | 30 | import("//build/config/sanitizers/sanitizers.gni") |
Arthur Sonzogni | 8b28afe | 2023-10-12 16:06:04 +0000 | [diff] [blame] | 31 | |
Arthur Sonzogni | 3aaa0a3 | 2024-05-31 14:01:04 +0000 | [diff] [blame] | 32 | partition_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. |
| 36 | partition_alloc_remove_configs = |
| 37 | [ "//build/config/compiler:default_optimization" ] |
| 38 | partition_alloc_add_configs = [ "//build/config/compiler:optimize_speed" ] |
| 39 | |
Arthur Sonzogni | 9e39433 | 2024-01-10 17:35:02 +0000 | [diff] [blame] | 40 | # MSVC's cl.exe compiler is not supported. |
Arthur Sonzogni | 7379e22 | 2024-01-09 17:32:25 +0000 | [diff] [blame] | 41 | _compiler_supported = is_clang || !is_win |
Arthur Sonzogni | 9e39433 | 2024-01-10 17:35:02 +0000 | [diff] [blame] | 42 | |
| 43 | # Windows: debug CRT is not compatible with the allocator shim. |
Arthur Sonzogni | 7379e22 | 2024-01-09 17:32:25 +0000 | [diff] [blame] | 44 | _build_type_supported = !is_win || (!is_component_build && !is_debug) |
Arthur Sonzogni | 9e39433 | 2024-01-10 17:35:02 +0000 | [diff] [blame] | 45 | |
Arthur Sonzogni | 7379e22 | 2024-01-09 17:32:25 +0000 | [diff] [blame] | 46 | _platform_supported = |
| 47 | is_android || is_apple || is_chromeos || is_fuchsia || is_linux || is_win |
| 48 | |
Arthur Sonzogni | 9e39433 | 2024-01-10 17:35:02 +0000 | [diff] [blame] | 49 | # 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 Sonzogni | 7379e22 | 2024-01-09 17:32:25 +0000 | [diff] [blame] | 54 | |
| 55 | use_partition_alloc_as_malloc_default = _supported |
| 56 | use_allocator_shim_default = _supported |
| 57 | enable_backup_ref_ptr_support_default = _supported |
Arthur Sonzogni | 8b28afe | 2023-10-12 16:06:04 +0000 | [diff] [blame] | 58 | put_ref_count_in_previous_slot_default = true |
| 59 | enable_backup_ref_ptr_slow_checks_default = false |
Arthur Sonzogni | 7379e22 | 2024-01-09 17:32:25 +0000 | [diff] [blame] | 60 | enable_dangling_raw_ptr_checks_default = _supported |
Arthur Sonzogni | 8b28afe | 2023-10-12 16:06:04 +0000 | [diff] [blame] | 61 | |
| 62 | # This is the default build configuration for pointers/raw_ptr*. |
| 63 | raw_ptr_zero_on_construct_default = true |
| 64 | raw_ptr_zero_on_move_default = true |
| 65 | raw_ptr_zero_on_destruct_default = false |
Arthur Sonzogni | 3aaa0a3 | 2024-05-31 14:01:04 +0000 | [diff] [blame] | 66 | |
| 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. |
| 70 | assert_cpp20_default = false |