First pass at a web interface#163
Conversation
…sm targets without breaking "bazel build --config=wasm //..."
from: values = {"cpu": "wasm"}
to: constraint_values = ["@platforms//cpu:wasm32"]
This makes select()s in CPPVARIABLES.bzl choose the wasm branch consistently across host OSes (including Windows runners), so /std:c++20 won’t leak into wasm compiles.
There was a problem hiding this comment.
Pull request overview
First pass at a browser-based DDS demo: a static HTML/JS UI that calls CalcDDtablePBN via an Emscripten-built WASM module embedded as base64 so the page works over both file:// and HTTP. Also restructures the existing WASM build plumbing — moves wasm_cc_binary example targets into a new //examples/wasm package, replaces the --config=wasm flow with wasm_cc_binary's platform transition, factors shared Emscripten link flags into wasm_compat.bzl, and removes the now-unused wasm_sources filegroups.
Changes:
- New
web/package:dds_mvp.html/.css/.jsUI,dds_mvp_wasm.cppC entry point,BUILD.bazel, and Python/shell helpers (update_wasm.sh,gen_wasm_bin_js.py,patch_mvp_wasm.py,verify_wasm_js.py). - WASM build refactor:
//:build_wasmswitched toconstraint_values,--config=wasmremoved from.bazelrc, examples WASM rules moved to//examples/wasm, CI updated, docs rewritten. system.cppgets an Emscripten branch returning a conservative 512MB-of-KB / 1-core hardware report;examples/calc_dd_table_pbn.cppadds__WASM__to its threading guard.
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| web/dds_mvp.html | New demo page; input grid, result table, script tags. |
| web/dds_mvp.css | Styles for the input grid. |
| web/dds_mvp.js | UI logic; loads WASM module and calls dds_mvp_calc_table. |
| web/dds_mvp_wasm.cpp | Emscripten entry point wrapping CalcDDtablePBN. |
| web/BUILD.bazel | Builds dds_mvp_wasm via wasm_cc_binary. |
| web/update_wasm.sh | Local script: build, copy artifacts, base64-embed, patch, verify. |
| web/gen_wasm_bin_js.py | Generates base64 wasm-bytes JS file. |
| web/patch_mvp_wasm.py | Patches isFileURI line in Emscripten output. |
| web/verify_wasm_js.py | Sanity-checks wasm compiles under Node. |
| .bazelrc | Removes build:wasm profile. |
| BUILD.bazel | build_wasm config_setting now uses platform constraints. |
| wasm_compat.bzl | Shared WASM_LINKOPTS. |
| wasm/BUILD.bazel | Empty package marker. |
| examples/BUILD.bazel | Drops old wasm filegroups; aliases all_examples_wasm. |
| examples/wasm/BUILD.bazel | New home for wasm_cc_binary example targets. |
| examples/calc_dd_table_pbn.cpp | Adds __WASM__ to threading guard. |
| library/src/**/BUILD.bazel | Removes obsolete wasm_sources filegroups. |
| library/src/system/system.cpp | Emscripten-specific hardware-info fallback. |
| library/tests/**/BUILD.bazel | Whitespace-only changes. |
| docs/wasm_build.md | Docs rewritten for the new flow. |
| .github/workflows/ci_wasm.yml | Drops --config=wasm; new target/output paths. |
debug_build_windows now requires: cpu = x64_windows compilation_mode = dbg That prevents Windows-native flags from applying to wasm transition builds (cpu=wasm), including //web:dds_mvp_wasm_cc.
.bazelrc had: build:windows --cxxopt=/std:c++20 build:windows --host_cxxopt=/std:c++20 Those options are too broad and can bleed into wasm builds on Windows hosts, which is exactly why emcc saw /std:c++20. Removed those two lines and left Windows C++ standard selection to CPPVARIABLES.bzl (//:build_windows selects), which keeps native Windows builds on C++20 without contaminating wasm transitions.
…o old for designated initializers), causing error C7555. Fixed by: loading DDS_CPPOPTS from CPPVARIABLES.bzl and applying copts = DDS_CPPOPTS to both tests in that file: solve_board_test and analyse_play_consistency_test
library/src/init.cpp uses stringstream (and i/o manipulators like setw, left, right) in GetDDSInfo, but didn’t include the required standard headers directly. Added #include <sstream> #include <iomanip> to library/src/init.cpp. That should resolve the CI wasm compile error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
…dows CI path. Changed library/src/solve_board.cpp to use std::thread + explicit join() instead of std::jthread in solve_all_boards_n(). Before: std::vector<std::jthread> After: std::vector<std::thread> and a join loop
|
Thanks for looking at this so quickly!
I'm dealing with the Windows WASM errors one by one. It's awkward that I
have to push to github to test. I could start up a PC emulator on my Mac,
but I've been too lazy to do that so far.
This PR is built on top of the previous WASM one. If it's OK with you, I'll
make the fixes here and not cherry-pick them back.
…On Tue, Jun 02, 2026 at 10:00 AM, Martin Nygren ***@***.***> wrote:
Assigned #163 <#163> to @tameware
<https://github.com/tameware>.
—
Reply to this email directly, view it on GitHub
<#163?email_source=notifications&email_token=ABC4PYCAYZPVVDU4EX7SXHD452CRTA5CNFSNUABQM5UWIORPF5TWS5BNNB2WEL2JONZXKZKFOZSW45CON52GSZTJMNQXI2LPNYXTENRSGI2TMNBTGUYDFJTSMVQXG33OUZQXG43JM5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#event-26225643502>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABC4PYDKLAT2MBZ22TLYZ63452CRTAVCNFSM6AAAAACZWHX2C2VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMRWGIZDKNRUGM2TAMQ>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
loadDdsModule() now clears ddsModulePromise inside .catch(...) before rethrowing, so later calls can retry. Removed the no-op .then((module) => ...) block entirely. Now a transient createDdsModule(...) failure won’t permanently poison future attempts.
|
Everything builds successfully now, but I'm stlll working on implementing Copilot's suggestions. I tried to turn the PR into a draft, but I was not successful. I'll post another comment when it's ready for human review. |
|
Aha! I see I was successful, I just didn't know it. It's a draft - perfect. |
…: line and exits with code 2 when arguments are missing.
See it in action at https://tameware.com/adam/bridge/dds/dds_mvp.html