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) { |
Maksim Sisov | 08949a3 | 2021-09-10 06:08:41 +0000 | [diff] [blame] | 18 | import("//build/config/ozone.gni") |
Loko Kung | 349062f | 2021-11-29 18:18:58 +0000 | [diff] [blame] | 19 | import("//build/config/sanitizers/sanitizers.gni") |
Corentin Wallez | a727845 | 2020-10-15 14:30:23 +0000 | [diff] [blame] | 20 | |
Maksim Sisov | 08949a3 | 2021-09-10 06:08:41 +0000 | [diff] [blame] | 21 | dawn_use_x11 = ozone_platform_x11 |
Corentin Wallez | a727845 | 2020-10-15 14:30:23 +0000 | [diff] [blame] | 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 | |
陈俊嘉 | 02336e6 | 2021-04-23 02:16:12 +0000 | [diff] [blame] | 29 | # Enable the compilation for UWP |
| 30 | dawn_is_winuwp = is_win && target_os == "winuwp" |
| 31 | |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 32 | declare_args() { |
Stephen White | 77fcdf7 | 2021-01-11 15:52:12 +0000 | [diff] [blame] | 33 | dawn_use_angle = true |
| 34 | |
Austin Eng | 017f9cc | 2022-01-19 17:32:56 +0000 | [diff] [blame] | 35 | # Enables SwiftShader as the fallback adapter. Requires dawn_swiftshader_dir |
| 36 | # to be set to take effect. |
Austin Eng | 9157c78 | 2022-01-21 20:00:18 +0000 | [diff] [blame] | 37 | dawn_use_swiftshader = true |
Austin Eng | eb1ca45 | 2020-01-25 02:14:39 +0000 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | declare_args() { |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 41 | # Enable Dawn's ASSERTs even in release builds |
| 42 | dawn_always_assert = false |
| 43 | |
Corentin Wallez | 03f6429 | 2019-01-12 17:26:49 +0000 | [diff] [blame] | 44 | # Should the Dawn static libraries be fully linked vs. GN's default of |
| 45 | # treating them as source sets. This is useful for people using Dawn |
| 46 | # standalone to produce static libraries to use in their projects. |
| 47 | dawn_complete_static_libs = false |
| 48 | |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 49 | # Enables the compilation of Dawn's D3D12 backend |
| 50 | dawn_enable_d3d12 = is_win |
| 51 | |
| 52 | # Enables the compilation of Dawn's Metal backend |
| 53 | dawn_enable_metal = is_mac |
| 54 | |
| 55 | # Enables the compilation of Dawn's Null backend |
| 56 | # (required for unittests, obviously non-conformant) |
| 57 | dawn_enable_null = true |
| 58 | |
| 59 | # Enables the compilation of Dawn's OpenGL backend |
| 60 | # (best effort, non-conformant) |
Stephen White | 7c0afdf | 2022-02-15 22:16:29 +0000 | [diff] [blame] | 61 | dawn_enable_desktop_gl = is_linux && !is_chromeos |
Stephen White | 21ce5d2 | 2021-05-17 18:04:48 +0000 | [diff] [blame] | 62 | |
| 63 | # Enables the compilation of Dawn's OpenGLES backend |
| 64 | # (WebGPU/Compat subset) |
陈俊嘉 | 16201e6 | 2021-05-31 08:46:21 +0000 | [diff] [blame] | 65 | # Disables OpenGLES when compiling for UWP, since UWP only supports d3d |
Stephen White | 7c0afdf | 2022-02-15 22:16:29 +0000 | [diff] [blame] | 66 | dawn_enable_opengles = |
| 67 | (is_linux && !is_chromeos) || (is_win && !dawn_is_winuwp) |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 68 | |
| 69 | # Enables the compilation of Dawn's Vulkan backend |
陈俊嘉 | 02336e6 | 2021-04-23 02:16:12 +0000 | [diff] [blame] | 70 | # Disables vulkan when compiling for UWP, since UWP only supports d3d |
| 71 | dawn_enable_vulkan = is_linux || is_chromeos || (is_win && !dawn_is_winuwp) || |
| 72 | is_fuchsia || is_android || dawn_use_swiftshader |
Ryan Harrison | d561448 | 2019-10-07 15:47:27 +0000 | [diff] [blame] | 73 | |
Austin Eng | 6ea362c | 2019-12-17 00:47:40 +0000 | [diff] [blame] | 74 | # Enables error injection for faking failures to native API calls |
| 75 | dawn_enable_error_injection = |
| 76 | is_debug || (build_with_chromium && use_fuzzing_engine) |
Corentin Wallez | f5f7ab1 | 2018-08-13 08:31:17 +0200 | [diff] [blame] | 77 | } |
Li, Hao | 0e1bef3 | 2019-11-07 12:13:27 +0000 | [diff] [blame] | 78 | |
| 79 | # GN does not allow reading a variable defined in the same declare_args(). |
| 80 | # Put them in two separate declare_args() when setting the value of one |
| 81 | # argument based on another. |
Corentin Wallez | 74cebd6 | 2019-11-26 18:21:51 +0000 | [diff] [blame] | 82 | declare_args() { |
Corentin Wallez | 0925720 | 2020-04-17 08:22:25 +0000 | [diff] [blame] | 83 | # Uses our built version of the Vulkan validation layers |
Corentin Wallez | 74cebd6 | 2019-11-26 18:21:51 +0000 | [diff] [blame] | 84 | dawn_enable_vulkan_validation_layers = |
Corentin Wallez | 0925720 | 2020-04-17 08:22:25 +0000 | [diff] [blame] | 85 | dawn_enable_vulkan && ((is_linux && !is_chromeos) || is_win || is_mac) |
| 86 | |
| 87 | # Uses our built version of the Vulkan loader on platforms where we can't |
| 88 | # assume to have one present at the system level. |
Loko Kung | 349062f | 2021-11-29 18:18:58 +0000 | [diff] [blame] | 89 | dawn_enable_vulkan_loader = |
| 90 | dawn_enable_vulkan && (is_mac || (is_linux && !is_android)) |
Li, Hao | 0e1bef3 | 2019-11-07 12:13:27 +0000 | [diff] [blame] | 91 | } |
Corentin Wallez | b31015b | 2020-04-10 08:20:10 +0000 | [diff] [blame] | 92 | |
陈俊嘉 | 02336e6 | 2021-04-23 02:16:12 +0000 | [diff] [blame] | 93 | # UWP only supports CoreWindow for windowing |
Corentin Wallez | b31015b | 2020-04-10 08:20:10 +0000 | [diff] [blame] | 94 | dawn_supports_glfw_for_windowing = |
陈俊嘉 | 02336e6 | 2021-04-23 02:16:12 +0000 | [diff] [blame] | 95 | (is_win && !dawn_is_winuwp) || (is_linux && !is_chromeos) || is_mac |
Stephen White | 21ce5d2 | 2021-05-17 18:04:48 +0000 | [diff] [blame] | 96 | |
Stephen White | 5d17ed6 | 2021-08-10 18:30:55 +0000 | [diff] [blame] | 97 | # Much of the GL backend code is shared, so define a convenience var. |
Stephen White | 21ce5d2 | 2021-05-17 18:04:48 +0000 | [diff] [blame] | 98 | dawn_enable_opengl = dawn_enable_opengles || dawn_enable_desktop_gl |