Move dawn_wasm related default logic over to defaults.gni
As-is if an embedder does not explicitly define their own version of
these variables in their 'build_overrides/dawn.gni' they will hit
build errors, since the build files use these values unconditionally.
The correct place to define this default logic, so embedders don't
have to explicitly define them, is
'scripts/dawn_overrides_with_defaults.gni'
Change-Id: Ia37a024d77c42621ceca85cc9019f0d823418267
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/242014
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/build_overrides/dawn.gni b/build_overrides/dawn.gni
index 34ef168..b528890 100644
--- a/build_overrides/dawn.gni
+++ b/build_overrides/dawn.gni
@@ -57,14 +57,6 @@
dawn_dxc_dir = "//third_party/dxc"
dawn_dxheaders_dir = "//third_party/dxheaders"
-# Emscripten and emsdk dependencies are only needed when building for WASM.
-if (!defined(dawn_wasm)) {
- dawn_wasm = false
-}
-if (dawn_wasm) {
- dawn_emscripten_dir = "//third_party/emsdk/upstream/emscripten"
-}
-
# PartitionAlloc is an optional dependency.
# It does not fully support the MSVC compiler at the moment.
if (is_clang || !is_win) {
diff --git a/scripts/dawn_overrides_with_defaults.gni b/scripts/dawn_overrides_with_defaults.gni
index 2c6e43e..65b4b96 100644
--- a/scripts/dawn_overrides_with_defaults.gni
+++ b/scripts/dawn_overrides_with_defaults.gni
@@ -115,6 +115,16 @@
dawn_egl_registry_dir = "${dawn_root}/third_party/khronos/EGL-Registry"
}
+if (!defined(dawn_wasm)) {
+ dawn_wasm = false
+}
+
if (!defined(dawn_emscripten_dir)) {
- dawn_emscripten_dir = ""
+ # Emscripten and emsdk dependencies are only needed when building
+ # for WASM.
+ if (dawn_wasm) {
+ dawn_emscripten_dir = "//third_party/emsdk/upstream/emscripten"
+ } else {
+ dawn_emscripten_dir = ""
+ }
}