feat(wasm): unify editor builds — footprint/symbol editors via runtime --frame

The footprint and symbol editors are no longer separate WASM bundles: the frontend loads the parent pcbnew/eeschema bundle and passes --frame=fpedit / --frame=symedit (TOOL_BUNDLE + TOOL_FRAME -> Module.arguments in boot). Drops the two duplicate build+deploy targets and their wrapper scripts + vestigial embind; adds low-level harnesses (footprint_editor.html, symbol_editor.html) and a runtime-frame spec. Bumps the kicad submodule to the runtime --frame launcher.

The frame-runtime spec is listed in PCBNEW_FAMILY_SPECS so CI routes it to the chromium-ci (V8) project — its footprint case boots the pcbnew module, which OOMs SpiderMonkey on x86 CI. Includes the editor-unification dossier (research docs 01-04 + the as-built implementation record 05).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Istvan Matejcsok 2026-07-01 17:39:42 +02:00
commit c6716e6b60
22 changed files with 1066 additions and 103 deletions

View file

@ -29,13 +29,15 @@ import {
// --- tools & per-file rules ---------------------------------------------------
// Tools served to the browser editor. sym_convert is a node CLI, not served.
// Bundles served to the browser editor. symbol_editor / footprint_editor are NOT
// separate bundles: they are the eeschema / pcbnew bundle booted with a runtime
// --frame flag (editor-unification), so they publish nothing of their own. The
// frontend maps them onto their parent bundle via TOOL_BUNDLE. sym_convert is a
// node CLI, not served.
const TOOLS = [
"pcbnew",
"eeschema",
"pl_editor",
"symbol_editor",
"footprint_editor",
"gerbview",
"calculator",
];

View file

@ -1,9 +0,0 @@
#!/bin/bash
# Build KiCad Footprint Editor for WebAssembly.
# Thin wrapper around build-kicad-target.sh — see that script for options.
# (The footprint editor is the pcbnew kiface launched at FRAME_FOOTPRINT_EDITOR,
# like symbol_editor is the eeschema kiface at FRAME_SCH_SYMBOL_EDITOR.)
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
exec "${SCRIPT_DIR}/build-kicad-target.sh" footprint_editor "$@"

View file

@ -31,7 +31,7 @@
set -e
if [ -z "$1" ]; then
echo "Error: missing <app> argument (pcbnew | eeschema | calculator | pl_editor | symbol_editor | gerbview)" >&2
echo "Error: missing <app> argument (pcbnew | eeschema | calculator | pl_editor | gerbview)" >&2
exit 1
fi
APP_NAME="$1"
@ -42,7 +42,8 @@ shift
# Most apps share all three names; the exceptions:
# - calculator: target+subdir are both pcb_calculator (OUTPUT_NAME=calculator)
# - pl_editor: subdir is pagelayout_editor (upstream source dir name)
# - symbol_editor: served by the eeschema kiface, so it builds in eeschema/
# The footprint/symbol editors have no target of their own — the pcbnew/eeschema
# bundle opens them at runtime via single_top.cpp's --frame flag.
case "$APP_NAME" in
pcbnew|eeschema|gerbview)
KICAD_TARGET="$APP_NAME"
@ -56,15 +57,6 @@ case "$APP_NAME" in
KICAD_TARGET="pcb_calculator"
KICAD_SUBDIR="pcb_calculator"
;;
symbol_editor)
KICAD_TARGET="symbol_editor"
KICAD_SUBDIR="eeschema"
;;
footprint_editor)
# served by the pcbnew kiface, so it builds in pcbnew/ (like symbol_editor in eeschema/)
KICAD_TARGET="footprint_editor"
KICAD_SUBDIR="pcbnew"
;;
sym_convert)
# Standalone .lib -> .kicad_sym converter (node CLI). Its add_executable
# lives in eeschema/CMakeLists.txt (gated by KICAD_SYM_CONVERTER_WASM), so
@ -73,33 +65,23 @@ case "$APP_NAME" in
KICAD_SUBDIR="eeschema"
;;
*)
echo "Error: unknown app '$APP_NAME' (expected: pcbnew | eeschema | calculator | pl_editor | symbol_editor | footprint_editor | gerbview | sym_convert)" >&2
echo "Error: unknown app '$APP_NAME' (expected: pcbnew | eeschema | calculator | pl_editor | gerbview | sym_convert)" >&2
exit 1
;;
esac
# Which app's embind bindings to compile + link. Most apps use their own; the
# symbol_editor is the eeschema kiface launched at a different TOP_FRAME and has
# no embind of its own, so it reuses eeschema's — whose bindings (kicadCollabOnSave
# et al.) the shared kiface objects reference. Without this the symbol_editor link
# fails with "undefined symbol: kicadCollabOnSave" (the placeholder defines nothing).
# sym_convert CLI links the eeschema kiface objects, which reference eeschema's
# embind symbols (kicadCollabOnSave et al.) — reuse eeschema's embind object.
case "$APP_NAME" in
symbol_editor) EMBIND_APP="eeschema" ;;
footprint_editor) EMBIND_APP="pcbnew" ;;
# sym_convert links the eeschema kiface objects, which reference eeschema's
# embind symbols (kicadCollabOnSave et al.) — reuse eeschema's embind object.
sym_convert) EMBIND_APP="eeschema" ;;
*) EMBIND_APP="$APP_NAME" ;;
esac
# Which app's WASM stub libraries (scripting/frame placeholders) to link. Like
# EMBIND_APP, the footprint_editor reuses pcbnew's: it links the pcbnew kiface
# objects, which reference pcbnew's action-plugin scripting symbols
# (pcbnewGetScriptsSearchPaths et al., defined in pcbnew_scripting_stub.cpp).
# Which app's WASM stub libraries (scripting/frame placeholders) to link.
# sym_convert links the eeschema kiface objects, so it needs eeschema's frame
# stub (eeschema_frame_stub.cpp).
case "$APP_NAME" in
footprint_editor) STUB_APP="pcbnew" ;;
# sym_convert links the eeschema kiface objects, so it needs eeschema's
# frame stub (eeschema_frame_stub.cpp) like symbol_editor does.
sym_convert) STUB_APP="eeschema" ;;
*) STUB_APP="$APP_NAME" ;;
esac
@ -519,8 +501,8 @@ if [ -f "${EMBIND_SRC}" ]; then
# ${KICAD_BUILD}/common by make_lexer custom commands on the pcbcommon target).
# On a fresh build dir they don't exist until make runs — build pcbcommon first.
# No wasted work: the app target depends on pcbcommon anyway; incremental no-op.
# Guard on EMBIND_APP (not APP_NAME) so footprint_editor — whose embind IS
# pcbnew's — also pre-builds pcbcommon.
# Guard on EMBIND_APP (not APP_NAME) so any app whose embind IS pcbnew's also
# pre-builds pcbcommon.
if [ "${EMBIND_APP}" = "pcbnew" ]; then
log_info "Pre-building pcbcommon so generated lexer headers exist for the embind compile..."
emmake make -j${JOBS} pcbcommon

View file

@ -1,7 +0,0 @@
#!/bin/bash
# Build KiCad Symbol Editor for WebAssembly.
# Thin wrapper around build-kicad-target.sh — see that script for options.
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
exec "${SCRIPT_DIR}/build-kicad-target.sh" symbol_editor "$@"