feat(wasm): kicad_editor — merge the pcbnew+eeschema kifaces into ONE bundle (Part 2)

All four editors (PCB / Footprint / Schematic / Symbol) are now runtime --frame
choices of a single kicad_editor.wasm (178 MB at -O1 vs 147+82 separate; shared
wx/common/boost linked once). One editor per page load, as before; frames pcb /
fpedit / sch / symedit.

- wasm/editor/: the merged executable target (single_top + both kiface library sets,
  whole-archive pcbcommon) + the safety-net focus-walk Kiface() dispatch TU. Gated by
  KICAD_WASM_MERGED_EDITOR (kicad submodule bump carries the fork side: per-engine
  Kiface/getter binding + ODR renames + dual-kiface launcher).
- wasm/bindings/: per-editor collab entries renamed pcbCollab*/schCollab* (JS names
  unchanged); duplicate kicadOpenFile/kicadCollabOnSave + shared-name registrations
  guarded behind KICAD_MERGED_EMBIND; new kicad_editor_embind.cpp registers each
  shared JS name once, dispatching on the live frame.
- Build: kicad_editor app (build wrapper, target case arms, 3-object embind compile
  with the ABI-critical flags, STUB_APP=pcbnew); docker/build.sh "all" =
  kicad_editor calculator pl_editor gerbview (pcbnew/eeschema stay as explicit debug
  apps); scripts/kicad/audit-merged-symbols.sh = repeatable ODR-collision audit (run
  on kicad bumps).
- Frontend: Bundle type (bundle ≠ tool); TOOL_BUNDLE maps all four editors to
  kicad_editor; explicit --frame tokens for pcbnew (pcb) and eeschema (sch); publish
  list = the 4 real bundles.
- Tests/CI: five harnesses load kicad_editor.js with explicit frame tokens;
  PCBNEW_FAMILY_SPECS renamed BIG_MODULE_SPECS + the 8 eeschema-family specs (they
  now boot the merged module — SpiderMonkey x86 CI OOM routing); frame-runtime spec
  covers all four frames from the one bundle.

Validated so far: frame-runtime 4/4 (each frame boots with the right title, no
aborts, no duplicate embind registration); 24-spec merged-module regression green;
3D raytracer renders. Known pre-existing failure: 3d-viewer title-bar drag deadlock,
fixed on main by 7630c7e (2N+8 pthread pre-warm) — picked up by the follow-up rebase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Istvan Matejcsok 2026-07-02 14:48:11 +02:00
commit bbeef6d20e
23 changed files with 691 additions and 149 deletions

View file

@ -154,6 +154,11 @@
var Module = {
thisProgram: '/usr/bin/eeschema', // Fake absolute path for argv[0] (KiCad DEBUG check)
// The schematic editor is served by the merged kicad_editor bundle (editor-
// unification Part 2): load kicad_editor.js below and select FRAME_SCH at
// runtime.
arguments: ['--frame=sch'],
preRun: [createCanvas, writeResources, seedKicadConfig],
postRun: [],
@ -209,6 +214,7 @@
<!-- wxWidgets WASM glue code (defines getConfigEntryLength, etc.) -->
<script src="wx.js"></script>
<script src="wx-dom.js"></script>
<script async src="eeschema.js"></script>
<!-- Schematic editor = merged kicad_editor bundle + --frame=sch (editor-unification Part 2). -->
<script async src="kicad_editor.js"></script>
</body>
</html>

View file

@ -108,8 +108,9 @@
var Module = {
thisProgram: '/usr/bin/footprint_editor', // argv[0] for KiCad's DEBUG check
// The footprint editor is served by the pcbnew bundle (editor-unification):
// load pcbnew.js below and select FRAME_FOOTPRINT_EDITOR at runtime.
// The footprint editor is served by the merged kicad_editor bundle (editor-
// unification Part 2): load kicad_editor.js below and select
// FRAME_FOOTPRINT_EDITOR at runtime.
arguments: ['--frame=fpedit'],
preRun: [createCanvas, writeResources, seedKicadConfig],
@ -147,7 +148,7 @@
<!-- wxWidgets WASM glue code (defines getConfigEntryLength, etc.) -->
<script src="wx.js"></script>
<script src="wx-dom.js"></script>
<!-- Footprint editor = pcbnew bundle + --frame=fpedit (editor-unification). -->
<script async src="pcbnew.js"></script>
<!-- Footprint editor = merged kicad_editor bundle + --frame=fpedit (editor-unification Part 2). -->
<script async src="kicad_editor.js"></script>
</body>
</html>

View file

@ -158,6 +158,11 @@
var Module = {
thisProgram: '/usr/bin/pcbnew', // Fake absolute path for argv[0] (KiCad DEBUG check)
// The PCB editor is served by the merged kicad_editor bundle (editor-
// unification Part 2): load kicad_editor.js below and select
// FRAME_PCB_EDITOR at runtime.
arguments: ['--frame=pcb'],
preRun: [createCanvas, writeResources, seedKicadConfig],
postRun: [],
@ -213,6 +218,7 @@
<!-- wxWidgets WASM glue code (defines getConfigEntryLength, etc.) -->
<script src="wx.js"></script>
<script src="wx-dom.js"></script>
<script async src="pcbnew.js"></script>
<!-- PCB editor = merged kicad_editor bundle + --frame=pcb (editor-unification Part 2). -->
<script async src="kicad_editor.js"></script>
</body>
</html>

View file

@ -123,6 +123,11 @@
var Module = {
thisProgram: '/usr/bin/pcbnew', // Fake absolute path for argv[0] (KiCad DEBUG check)
// The PCB editor is served by the merged kicad_editor bundle (editor-
// unification Part 2): load kicad_editor.js below and select
// FRAME_PCB_EDITOR at runtime.
arguments: ['--frame=pcb'],
preRun: [createCanvas, writeResources],
postRun: [],
@ -178,6 +183,7 @@
<!-- wxWidgets WASM glue code (defines getConfigEntryLength, etc.) -->
<script src="wx.js"></script>
<script src="wx-dom.js"></script>
<script async src="pcbnew.js"></script>
<!-- PCB editor = merged kicad_editor bundle + --frame=pcb (editor-unification Part 2). -->
<script async src="kicad_editor.js"></script>
</body>
</html>

View file

@ -147,8 +147,9 @@
var Module = {
thisProgram: '/usr/bin/symbol_editor', // Fake absolute path for argv[0] (KiCad DEBUG check)
// The symbol editor is served by the eeschema bundle (editor-unification):
// load eeschema.js below and select FRAME_SCH_SYMBOL_EDITOR at runtime.
// The symbol editor is served by the merged kicad_editor bundle (editor-
// unification Part 2): load kicad_editor.js below and select
// FRAME_SCH_SYMBOL_EDITOR at runtime.
arguments: ['--frame=symedit'],
preRun: [createCanvas, writeResources, seedKicadConfig],
@ -206,7 +207,7 @@
<!-- wxWidgets WASM glue code (defines getConfigEntryLength, etc.) -->
<script src="wx.js"></script>
<script src="wx-dom.js"></script>
<!-- Symbol editor = eeschema bundle + --frame=symedit (editor-unification). -->
<script async src="eeschema.js"></script>
<!-- Symbol editor = merged kicad_editor bundle + --frame=symedit (editor-unification Part 2). -->
<script async src="kicad_editor.js"></script>
</body>
</html>