refactor: collapse dual-mode plumbing — the DOM port is the only WASM build

The canvas (wxUniversal) mode is gone (wxwidgets submodule); remove every
piece of side-by-side plumbing so there is exactly one build and one test
flow:

- scripts/build-wxuniversal-wasm.sh -> scripts/build-wx-wasm.sh; no
  --dom/--enable-universal; builds into build-wasm/wxwidgets
- build-wasm-test.sh: no DOM_BUILD / apps-dom rsync mirror / PORT=dom;
  apps build straight into tests/apps (Makefile.wasm PORT conditionals
  collapsed; wx.js + wx-dom.js always pre-js)
- docker/build.sh, build-kicad-target.sh, env.sh: WX_PORT / -dom /
  -universal suffixes removed; kicad builds to kicad-<app>, outputs to
  output/; wx.js/wx-dom.js copied from the real source path
  (/workspace/wxwidgets/build/wasm — the old build-wasm path never
  existed and silently failed)
- setup-kicad-wasm.sh: single target dir; the perl wx-dom.js injection is
  gone — the 7 checked-in kicad pages now reference wx-dom.js directly
- playwright configs serve apps/; fixtures drop the test-results/dom and
  logs/wxwidgets/dom namespacing; boot.spec asserts wxDomPort
  unconditionally; pcbnew.spec uses one reference image;
  appearance.spec assertions unconditional
- compare/update-baseline-screenshots.sh: --port removed
- tests/gal-regression/wasm/Makefile: links build-wasm/wxwidgets and
  carries wx-dom.js as a second pre-js — the gal-webgl suite (30 specs)
  now actually builds and runs here (it needed host-side boost+glm via
  scripts/deps; the bundle had been missing, timing the whole spec out)
- tests: clickCanvas() dispatches via page.mouse (DOM widgets
  legitimately cover the canvas; locator actionability refused the
  click); the comprehensive spec drives wxChoice through its native
  <select> (browser-owned popup cannot be coordinate-clicked)
- docs: README/CLAUDE.md/build.md script names and dirs;
  features/wx-dom-port README reframed (DOM is THE port), visual-notes
  bugs 26-28; FindwxWidgets.cmake config label drops 'wasmuniv'
- wxwidgets submodule -> 9dbacc9448 (DOM-only port, fork diff shrunk)

Gate: full wx e2e suite 292 passed / 1 skipped / 0 failed — first run
ever with the gal-webgl specs green (28 scenarios + load + sequential).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2026-06-12 10:18:16 +02:00
commit 7dc1bf27e0
32 changed files with 199 additions and 335 deletions

View file

@ -10,7 +10,6 @@ source "$(dirname "$0")/common/env.sh"
# ./build-wasm-test.sh # Incremental build (default)
# ./build-wasm-test.sh --clean # Clean build from scratch
# ./build-wasm-test.sh --debug # Build with debug symbols
# ./build-wasm-test.sh --dom # Build against the DOM port into tests/apps-dom
# ./build-wasm-test.sh menu # Build only the menu test
# ./build-wasm-test.sh --debug menu # Build menu test with debug symbols
@ -18,7 +17,6 @@ set -e
DEBUG_BUILD=0
CLEAN_BUILD=0
DOM_BUILD=0
TARGET=""
# Parse arguments
@ -27,8 +25,6 @@ for arg in "$@"; do
DEBUG_BUILD=1
elif [ "$arg" = "--clean" ]; then
CLEAN_BUILD=1
elif [ "$arg" = "--dom" ]; then
DOM_BUILD=1
elif [ "$arg" != "" ]; then
TARGET="$arg"
fi
@ -38,29 +34,8 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
TESTS_DIR="$PROJECT_ROOT/tests"
if [ "$DOM_BUILD" = "1" ]; then
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-dom"
# DOM apps build in a mirrored source tree so canvas and DOM bundles
# coexist; relative ../../ paths in Makefile.wasm resolve identically.
WASM_APP_DIR="$TESTS_DIR/apps-dom"
echo "Mirroring test app sources into apps-dom..."
# kicad/ is excluded: apps-dom/kicad is owned by
# tests/scripts/setup-kicad-wasm.sh (DOM bundles + injected pages) and
# apps/kicad only has the checked-in HTML — mirroring with --delete
# would wipe the synced multi-hundred-MB kicad artifacts.
rsync -a --delete \
--exclude 'kicad/' \
--exclude '*.o' --exclude '*.d' \
--exclude '*_test.html' --exclude '*_test.js' --exclude '*_test.wasm' \
--exclude '*_repro.html' --exclude '*_repro.js' --exclude '*_repro.wasm' \
--exclude '*.wasm.map' \
"$TESTS_DIR/apps/" "$WASM_APP_DIR/"
MAKE_PORT_ARGS="PORT=dom"
else
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-universal"
WASM_APP_DIR="$TESTS_DIR/apps"
MAKE_PORT_ARGS=""
fi
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets"
WASM_APP_DIR="$TESTS_DIR/apps"
STANDALONE_DIR="$WASM_APP_DIR/standalone"
echo "=== Building wxWidgets WASM Test Applications ==="
@ -80,7 +55,7 @@ echo "Test app dir: $WASM_APP_DIR"
# Verify wxWidgets is built
if [ ! -f "$BUILD_DIR/wx-config" ]; then
echo "ERROR: wxWidgets not built. Run build-wxuniversal-wasm.sh first"
echo "ERROR: wxWidgets not built. Run build-wx-wasm.sh first"
exit 1
fi
@ -120,9 +95,9 @@ fi
# Build (pass DEBUG flag if requested). App links are independent, so honor
# JOBS/PARALLEL_JOBS from env.sh (each emcc link is slow due to Asyncify).
if [ "$DEBUG_BUILD" = "1" ]; then
make -j"${JOBS:-1}" -f Makefile.wasm DEBUG=1 $MAKE_PORT_ARGS "$MAKE_TARGET"
make -j"${JOBS:-1}" -f Makefile.wasm DEBUG=1 "$MAKE_TARGET"
else
make -j"${JOBS:-1}" -f Makefile.wasm $MAKE_PORT_ARGS "$MAKE_TARGET"
make -j"${JOBS:-1}" -f Makefile.wasm "$MAKE_TARGET"
fi
echo ""

View file

@ -1,5 +1,6 @@
#!/bin/bash
# Build wxWidgets with wxUniversal for WebAssembly
# Build wxWidgets for WebAssembly (the DOM port: widgets are real HTML
# elements; owner-drawn widgets render into per-window canvas islands)
# Redirect all output to a log file (re-execs script with redirection)
source "$(dirname "$0")/common/logging.sh"
@ -20,10 +21,8 @@ source "$(dirname "$0")/common/stages.sh"
# ghcr.io/vslavik/bakefile:0.2 bakefile_gen
#
# Usage:
# ./build-wxuniversal-wasm.sh # Incremental build (default)
# ./build-wxuniversal-wasm.sh --clean # Clean build from scratch
# ./build-wxuniversal-wasm.sh --dom # Build the DOM port (native widgets,
# # no wxUniversal) into build-wasm/wxwidgets-dom
# ./build-wx-wasm.sh # Incremental build (default)
# ./build-wx-wasm.sh --clean # Clean build from scratch
set -e
@ -31,34 +30,19 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
WX_SOURCE="$PROJECT_ROOT/wxwidgets"
# Parse arguments: --clean, --no-clean (default; kept for the kicad
# pipeline's explicit call) and/or --dom, in any order. WX_PORT=dom env is
# equivalent to --dom so the flavor can flow through the docker pipeline.
# Parse arguments: --clean or --no-clean (default; kept for the kicad
# pipeline's explicit call), in any order.
CLEAN_BUILD=0
DOM_BUILD=0
[ "${WX_PORT:-}" = "dom" ] && DOM_BUILD=1
for arg in "$@"; do
case "$arg" in
--clean) CLEAN_BUILD=1 ;;
--no-clean) CLEAN_BUILD=0 ;;
--dom) DOM_BUILD=1 ;;
*) echo "Unknown argument: $arg"; exit 1 ;;
esac
done
if [ "$DOM_BUILD" = "1" ]; then
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-dom"
# Native (non-universal) widget set: controls are real DOM elements.
UNIVERSAL_FLAG=""
# Tooltips are DOM title attributes (wx/wasm/tooltip.h).
PORT_EXTRA_FLAGS=""
WXLIB_PREFIX="libwx_wasmu"
else
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-universal"
UNIVERSAL_FLAG="--enable-universal"
PORT_EXTRA_FLAGS=""
WXLIB_PREFIX="libwx_wasmunivu"
fi
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets"
WXLIB_PREFIX="libwx_wasmu"
# Use our config.sub wrapper for autoconf projects
# CONFIG_SHELL is critical: nested configures (pcre, etc.) do SHELL=${CONFIG_SHELL-/bin/sh}
@ -72,7 +56,7 @@ export AUTOM4TE="$SCRIPT_DIR/config/autom4te-wrapper.sh"
# Use JOBS from env.sh if set, otherwise use all available cores
JOBS="${JOBS:-$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)}"
echo "=== Building wxWidgets wxUniversal for WASM ==="
echo "=== Building wxWidgets for WASM ==="
echo "Project root: $PROJECT_ROOT"
echo "Build dir: $BUILD_DIR"
echo "wxWidgets source: $WX_SOURCE"
@ -130,7 +114,6 @@ if [ $NEEDS_CONFIGURE -eq 1 ]; then
# Configure with emconfigure
# Key flags based on wxWidgets-wasm:
# --host=emscripten Host system (detected via config.sub)
# --enable-universal Use wxUniversal (draws widgets directly)
# --disable-shared Build static libraries
# --with-opengl Enable OpenGL/WebGL support
# --enable-exceptions Enable C++ exceptions (needed for KiCad debug builds)
@ -183,8 +166,6 @@ if [ $NEEDS_CONFIGURE -eq 1 ]; then
emconfigure "$WX_SOURCE/configure" \
--host=emscripten \
--without-subdirs \
${UNIVERSAL_FLAG} \
${PORT_EXTRA_FLAGS} \
--disable-shared \
--with-opengl \
--enable-exceptions \

View file

@ -31,7 +31,7 @@ export STUBS_DIR="$PROJECT_ROOT/stubs"
export CMAKE_MODULES="$PROJECT_ROOT/cmake"
# wxWidgets build location
export WX_BUILD="$BUILD_ROOT/wxwidgets-universal"
export WX_BUILD="$BUILD_ROOT/wxwidgets"
# Emscripten settings
export EMSDK_QUIET=1

View file

@ -8,25 +8,8 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
# --port dom compares the DOM-port artifacts (WX_PORT=dom test runs) against
# their own baseline set; canvas paths are the default and stay unchanged.
PORT=""
ARGS=()
while [ $# -gt 0 ]; do
case "$1" in
--port) PORT="$2"; shift 2 ;;
*) ARGS+=("$1"); shift ;;
esac
done
set -- "${ARGS[@]+"${ARGS[@]}"}"
if [ "$PORT" = "dom" ]; then
BASELINE_DIR="$PROJECT_ROOT/tests/baseline-screenshots-dom"
TEST_RESULTS_DIR="$PROJECT_ROOT/tests/test-results/dom"
else
BASELINE_DIR="$PROJECT_ROOT/tests/baseline-screenshots"
TEST_RESULTS_DIR="$PROJECT_ROOT/tests/test-results"
fi
BASELINE_DIR="$PROJECT_ROOT/tests/baseline-screenshots"
TEST_RESULTS_DIR="$PROJECT_ROOT/tests/test-results"
# Check if directories exist
if [ ! -d "$BASELINE_DIR" ]; then

View file

@ -75,17 +75,9 @@ source "${SCRIPT_DIR}/../common/stages.sh"
KICAD_DIR="${PROJECT_ROOT}/kicad"
WASM_LAYER="${PROJECT_ROOT}/wasm"
# WX_PORT=dom links against the DOM (non-universal) wxWidgets build and
# keeps its KiCad build tree separate from the canvas one.
if [ "${WX_PORT:-}" = "dom" ]; then
KICAD_BUILD="${BUILD_ROOT}/kicad-${APP_NAME}-dom"
KICAD_STAMP="${BUILD_ROOT}/stamps/kicad-${APP_NAME}-dom.stamp"
WX_BUILD="${BUILD_ROOT}/wxwidgets-dom"
else
KICAD_BUILD="${BUILD_ROOT}/kicad-${APP_NAME}"
KICAD_STAMP="${BUILD_ROOT}/stamps/kicad-${APP_NAME}.stamp"
WX_BUILD="${BUILD_ROOT}/wxwidgets-universal"
fi
KICAD_BUILD="${BUILD_ROOT}/kicad-${APP_NAME}"
KICAD_STAMP="${BUILD_ROOT}/stamps/kicad-${APP_NAME}.stamp"
WX_BUILD="${BUILD_ROOT}/wxwidgets"
# Parse arguments - incremental build by default (optimized for development)
NO_CLEAN=1
@ -167,7 +159,7 @@ if [ $FULL_CLEAN -eq 1 ]; then
log_info "Full clean: removing all stamps and build directories..."
rm -rf "${STAMPS_DIR}"/*
rm -rf "${BUILD_ROOT}/deps"/*
rm -rf "${BUILD_ROOT}/wxwidgets-universal"
rm -rf "${BUILD_ROOT}/wxwidgets"
rm -rf "${BUILD_ROOT}/stubs"
rm -rf "${KICAD_BUILD}"
rm -rf "${SYSROOT}"/*
@ -196,7 +188,7 @@ fi
# Step 4: Build wxWidgets (incremental - only recompiles changed files)
kw_stage wxwidgets
log_info "Building wxWidgets..."
"${SCRIPT_DIR}/../build-wxuniversal-wasm.sh" --no-clean
"${SCRIPT_DIR}/../build-wx-wasm.sh" --no-clean
log_info "Building KiCad ${APP_NAME} ${KICAD_VERSION} for WASM..."

View file

@ -7,30 +7,22 @@
# Usage:
# ./update-baseline-screenshots.sh # Only copy NEW screenshots
# ./update-baseline-screenshots.sh --all # Copy new + significantly different
# ./update-baseline-screenshots.sh --port dom # Same, for the DOM-port baseline set
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TESTS_DIR="$SCRIPT_DIR/../tests"
COPY_ALL=0
PORT=""
THRESHOLD=5 # Percent threshold for "significant" difference
while [ $# -gt 0 ]; do
case "$1" in
--all) COPY_ALL=1; shift ;;
--port) PORT="$2"; shift 2 ;;
*) shift ;;
esac
done
if [ "$PORT" = "dom" ]; then
SOURCE_DIR="$TESTS_DIR/test-results/dom"
DEST_DIR="$TESTS_DIR/baseline-screenshots-dom"
else
SOURCE_DIR="$TESTS_DIR/test-results"
DEST_DIR="$TESTS_DIR/baseline-screenshots"
fi
SOURCE_DIR="$TESTS_DIR/test-results"
DEST_DIR="$TESTS_DIR/baseline-screenshots"
if [ $COPY_ALL -eq 1 ]; then
echo "Mode: Copy NEW + SIGNIFICANTLY DIFFERENT screenshots"