blob: cc2899a73ee029e3cab97e1d7c5f8b14ef6361b5 [file] [log] [blame]
Corentin Wallezf5f7ab12018-08-13 08:31:17 +02001# 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 Eng6ea362c2019-12-17 00:47:40 +000015import("//build_overrides/build.gni")
16
17if (build_with_chromium) {
18 import("//build/config/sanitizers/sanitizers.gni")
Corentin Walleza7278452020-10-15 14:30:23 +000019 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 Eng6ea362c2019-12-17 00:47:40 +000027}
28
Corentin Wallezf5f7ab12018-08-13 08:31:17 +020029declare_args() {
Stephen White77fcdf72021-01-11 15:52:12 +000030 dawn_use_angle = true
31
Austin Engeb1ca452020-01-25 02:14:39 +000032 # 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
41declare_args() {
Corentin Wallezf5f7ab12018-08-13 08:31:17 +020042 # Enable Dawn's ASSERTs even in release builds
43 dawn_always_assert = false
44
Corentin Wallez03f64292019-01-12 17:26:49 +000045 # 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 Wallezf5f7ab12018-08-13 08:31:17 +020050 # 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 Ho0ebd54c2019-08-13 22:45:14 +000062 dawn_enable_opengl = is_linux && !is_chromeos
Corentin Wallezf5f7ab12018-08-13 08:31:17 +020063
64 # Enables the compilation of Dawn's Vulkan backend
Hidehiko Abe948b3a02020-09-11 02:24:16 +000065 dawn_enable_vulkan = is_linux || is_chromeos || is_win || is_fuchsia ||
66 is_android || dawn_use_swiftshader
Ryan Harrisond5614482019-10-07 15:47:27 +000067
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 Harrison4f3811c2020-05-07 21:15:55 +000072 # compiler, since it is a sub-class of it.
Ryan Harrisond5614482019-10-07 15:47:27 +000073 dawn_enable_cross_reflection = false
Corentin Wallez74cebd62019-11-26 18:21:51 +000074
Austin Eng6ea362c2019-12-17 00:47:40 +000075 # 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 Wallez3a1746e2020-01-15 13:14:12 +000078
Ryan Harrisonc4c4ff92020-07-28 21:57:18 +000079 # 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 Wallezf5f7ab12018-08-13 08:31:17 +020082}
Li, Hao0e1bef32019-11-07 12:13:27 +000083
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 Wallez74cebd62019-11-26 18:21:51 +000087declare_args() {
Corentin Wallez09257202020-04-17 08:22:25 +000088 # Uses our built version of the Vulkan validation layers
Corentin Wallez74cebd62019-11-26 18:21:51 +000089 dawn_enable_vulkan_validation_layers =
Corentin Wallez09257202020-04-17 08:22:25 +000090 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, Hao0e1bef32019-11-07 12:13:27 +000095}
Corentin Wallezb31015b2020-04-10 08:20:10 +000096
97dawn_supports_glfw_for_windowing =
98 is_win || (is_linux && !is_chromeos) || is_mac