Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 1 | # Copyright 2018 The Dawn Authors |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Austin Eng | 6ea362c | 2019-12-17 00:47:40 +0000 | [diff] [blame] | 15 | import("//build_overrides/build.gni") |
| 16 | |
| 17 | if (build_with_chromium) { |
| 18 | import("//build/config/sanitizers/sanitizers.gni") |
Corentin Wallez | a727845 | 2020-10-15 14:30:23 +0000 | [diff] [blame] | 19 | import("//build/config/ui.gni") |
| 20 | |
| 21 | dawn_use_x11 = use_x11 |
| 22 | } else { |
| 23 | declare_args() { |
| 24 | # Whether Dawn should enable X11 support. |
| 25 | dawn_use_x11 = is_linux && !is_chromeos |
| 26 | } |
Austin Eng | 6ea362c | 2019-12-17 00:47:40 +0000 | [diff] [blame] | 27 | } |
| 28 | |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 29 | declare_args() { |
Stephen White | 77fcdf7 | 2021-01-11 15:52:12 +0000 | [diff] [blame] | 30 | dawn_use_angle = true |
| 31 | |
Austin Eng | eb1ca45 | 2020-01-25 02:14:39 +0000 | [diff] [blame] | 32 | # Enables usage of swiftshader on the Vulkan backend. |
| 33 | # Note that this will only work in standalone and in projects that set the |
| 34 | # dawn_swiftshader_dir variable in build_overrides/dawn.gni |
| 35 | # Because of how the Vulkan loader works, setting this makes Dawn only able |
| 36 | # to find the Swiftshader ICD and not the others. |
| 37 | # Enabled by default when fuzzing. |
| 38 | dawn_use_swiftshader = build_with_chromium && use_fuzzing_engine |
| 39 | } |
| 40 | |
| 41 | declare_args() { |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 42 | # Enable Dawn's ASSERTs even in release builds |
| 43 | dawn_always_assert = false |
| 44 | |
Corentin Wallez | 03f6429 | 2019-01-12 17:26:49 +0000 | [diff] [blame] | 45 | # Should the Dawn static libraries be fully linked vs. GN's default of |
| 46 | # treating them as source sets. This is useful for people using Dawn |
| 47 | # standalone to produce static libraries to use in their projects. |
| 48 | dawn_complete_static_libs = false |
| 49 | |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 50 | # Enables the compilation of Dawn's D3D12 backend |
| 51 | dawn_enable_d3d12 = is_win |
| 52 | |
| 53 | # Enables the compilation of Dawn's Metal backend |
| 54 | dawn_enable_metal = is_mac |
| 55 | |
| 56 | # Enables the compilation of Dawn's Null backend |
| 57 | # (required for unittests, obviously non-conformant) |
| 58 | dawn_enable_null = true |
| 59 | |
| 60 | # Enables the compilation of Dawn's OpenGL backend |
| 61 | # (best effort, non-conformant) |
Brian Ho | 0ebd54c | 2019-08-13 22:45:14 +0000 | [diff] [blame] | 62 | dawn_enable_opengl = is_linux && !is_chromeos |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 63 | |
| 64 | # Enables the compilation of Dawn's Vulkan backend |
Hidehiko Abe | 948b3a0 | 2020-09-11 02:24:16 +0000 | [diff] [blame] | 65 | dawn_enable_vulkan = is_linux || is_chromeos || is_win || is_fuchsia || |
| 66 | is_android || dawn_use_swiftshader |
Ryan Harrison | d561448 | 2019-10-07 15:47:27 +0000 | [diff] [blame] | 67 | |
| 68 | # Enable use of reflection compiler in spirv-cross. This is needed |
| 69 | # if performing reflection on systems that the platform language |
| 70 | # shader is SPIR-V, since there isn't an instance of the |
| 71 | # GLSL/HLSL/MSL compiler. This implicitly pulls in the GLSL |
Ryan Harrison | 4f3811c | 2020-05-07 21:15:55 +0000 | [diff] [blame] | 72 | # compiler, since it is a sub-class of it. |
Ryan Harrison | d561448 | 2019-10-07 15:47:27 +0000 | [diff] [blame] | 73 | dawn_enable_cross_reflection = false |
Corentin Wallez | 74cebd6 | 2019-11-26 18:21:51 +0000 | [diff] [blame] | 74 | |
Austin Eng | 6ea362c | 2019-12-17 00:47:40 +0000 | [diff] [blame] | 75 | # Enables error injection for faking failures to native API calls |
| 76 | dawn_enable_error_injection = |
| 77 | is_debug || (build_with_chromium && use_fuzzing_engine) |
Corentin Wallez | 3a1746e | 2020-01-15 13:14:12 +0000 | [diff] [blame] | 78 | |
Ryan Harrison | c4c4ff9 | 2020-07-28 21:57:18 +0000 | [diff] [blame] | 79 | # Enable support WGSL for shaders. |
| 80 | # Turned off for Skia, because Tint is currently not part of its DEPS. |
| 81 | dawn_enable_wgsl = !defined(is_skia_standalone) |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 82 | } |
Li, Hao | 0e1bef3 | 2019-11-07 12:13:27 +0000 | [diff] [blame] | 83 | |
| 84 | # GN does not allow reading a variable defined in the same declare_args(). |
| 85 | # Put them in two separate declare_args() when setting the value of one |
| 86 | # argument based on another. |
Corentin Wallez | 74cebd6 | 2019-11-26 18:21:51 +0000 | [diff] [blame] | 87 | declare_args() { |
Corentin Wallez | 0925720 | 2020-04-17 08:22:25 +0000 | [diff] [blame] | 88 | # Uses our built version of the Vulkan validation layers |
Corentin Wallez | 74cebd6 | 2019-11-26 18:21:51 +0000 | [diff] [blame] | 89 | dawn_enable_vulkan_validation_layers = |
Corentin Wallez | 0925720 | 2020-04-17 08:22:25 +0000 | [diff] [blame] | 90 | dawn_enable_vulkan && ((is_linux && !is_chromeos) || is_win || is_mac) |
| 91 | |
| 92 | # Uses our built version of the Vulkan loader on platforms where we can't |
| 93 | # assume to have one present at the system level. |
| 94 | dawn_enable_vulkan_loader = dawn_enable_vulkan && is_mac |
Li, Hao | 0e1bef3 | 2019-11-07 12:13:27 +0000 | [diff] [blame] | 95 | } |
Corentin Wallez | b31015b | 2020-04-10 08:20:10 +0000 | [diff] [blame] | 96 | |
| 97 | dawn_supports_glfw_for_windowing = |
| 98 | is_win || (is_linux && !is_chromeos) || is_mac |