[wasm] Enable tint to build with Emscripten in cmake.
This CL updates the cmake files to allow Emscripten to build Tint.
Bug: 365376505
Change-Id: Id888b15249c8db096f7e1d4cfde35413186d76b2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/211815
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ef7a60..a2578b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -245,14 +245,19 @@
option(TINT_BUILD_TESTS "Build tests" ON)
option(TINT_BUILD_AS_OTHER_OS "Override OS detection to force building of *_other.cc files" OFF)
+if (DAWN_ENABLE_EMSCRIPTEN)
+ # Skip tint tests in emscripten build
+ set(TINT_BUILD_TESTS OFF)
+ # Skip GLSL validation in Emscripten
+ set(TINT_BUILD_GLSL_VALIDATOR OFF)
+endif()
+
option(TINT_BUILD_TINTD "Build the WGSL language server" OFF)
option(TINT_ENABLE_BREAK_IN_DEBUGGER "Enable tint::debugger::Break()" OFF)
option(TINT_CHECK_CHROMIUM_STYLE "Check for [chromium-style] issues during build" OFF)
option(TINT_RANDOMIZE_HASHES "Randomize the hash seed value to detect non-deterministic output" OFF)
-# We don't build Tint when building with Emscripten so silence these messages.
-if (NOT ${DAWN_ENABLE_EMSCRIPTEN})
message(STATUS "Tint build SPIR-V reader: ${TINT_BUILD_SPV_READER}")
message(STATUS "Tint build WGSL reader: ${TINT_BUILD_WGSL_READER}")
message(STATUS "Tint build GLSL writer: ${TINT_BUILD_GLSL_WRITER}")
@@ -276,7 +281,6 @@
message(STATUS "Tint build checking [chromium-style]: ${TINT_CHECK_CHROMIUM_STYLE}")
message(STATUS "Tint randomize hashes: ${TINT_RANDOMIZE_HASHES}")
message(STATUS "")
-endif()
set_if_not_defined(DAWN_THIRD_PARTY_DIR "${Dawn_SOURCE_DIR}/third_party" "Directory in which to find third-party dependencies.")
@@ -466,11 +470,8 @@
set(BUILD_SHARED_LIBS 0)
add_subdirectory(src/utils)
+add_subdirectory(src/tint)
-# Only build Tint when we are not building under Emscripten.
-if (NOT ${DAWN_ENABLE_EMSCRIPTEN})
- add_subdirectory(src/tint)
-endif()
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_SAVED})
if (DAWN_ENABLE_D3D11 OR DAWN_ENABLE_D3D12 OR DAWN_ENABLE_METAL OR DAWN_ENABLE_NULL OR DAWN_ENABLE_DESKTOP_GL OR DAWN_ENABLE_OPENGLES OR DAWN_ENABLE_VULKAN OR DAWN_ENABLE_EMSCRIPTEN)
diff --git a/src/emdawnwebgpu/README.md b/src/emdawnwebgpu/README.md
index 8de7ccf..efd6491 100644
--- a/src/emdawnwebgpu/README.md
+++ b/src/emdawnwebgpu/README.md
@@ -35,6 +35,9 @@
Note this must be a source checkout of Emscripten,
not emsdk's `upstream/emscripten` release, which excludes necessary tools.
+
+- Make sure you run the `./bootstrap` in the `emscripten` folder to make sure node is setup.
+
## Building Dawn Emscripten bindings with GN
- Set up a Dawn GN build, with `dawn_emscripten_dir` in the GN args set to point to
@@ -60,4 +63,4 @@
# The resulting html files can then be served and viewed in a compatible Browser.
-```
\ No newline at end of file
+```