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:
parent
c6716e6b60
commit
bbeef6d20e
23 changed files with 691 additions and 149 deletions
57
wasm/editor/CMakeLists.txt
Normal file
57
wasm/editor/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
# Merged pcbnew+eeschema WASM editor (editor-unification Part 2).
|
||||
#
|
||||
# ONE executable links BOTH kifaces; the editor frame (PCB / Footprint / Schematic /
|
||||
# Symbol) is chosen at runtime by single_top.cpp's --frame flag. Added from the kicad
|
||||
# fork's top-level CMakeLists.txt via add_subdirectory( ${KICAD_WASM_LAYER}/editor )
|
||||
# when EMSCRIPTEN AND KICAD_WASM_MERGED_EDITOR — after eeschema/ and pcbnew/, so both
|
||||
# kifaces' CACHE INTERNAL library lists exist here.
|
||||
#
|
||||
# Collision handling (see KICAD_WASM_PCB_SIDE_RENAMES in the fork's top-level
|
||||
# CMakeLists.txt and docs/features/editor-unification/): the PCB-side targets compile
|
||||
# with per-engine symbol renames; each kiface gets its own KIFACE_GETTER name; the
|
||||
# plain Kiface() the shared common/ code falls back to is defined here
|
||||
# (merged_kiface_dispatch.cpp).
|
||||
#
|
||||
# The standalone pcbnew/eeschema targets still exist in this (option-ON) tree but are
|
||||
# not intended to be built here: their kiface objects carry the merged renames, and
|
||||
# their single_top TUs still bind the un-renamed KIFACE_GETTER — build them from their
|
||||
# own (option-OFF) per-app trees as before.
|
||||
|
||||
include_directories( BEFORE ${INC_BEFORE} )
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/common
|
||||
${CMAKE_SOURCE_DIR}/common/dialogs
|
||||
${INC_AFTER}
|
||||
)
|
||||
|
||||
add_executable( kicad_editor
|
||||
${CMAKE_SOURCE_DIR}/common/single_top.cpp
|
||||
merged_kiface_dispatch.cpp
|
||||
)
|
||||
|
||||
# TOP_FRAME is only the DEFAULT frame (no --frame given). No PGM_DATA_FILE_EXT: the
|
||||
# runtime extension map in single_top.cpp covers all four frames. No BUILD_KIWAY_DLL:
|
||||
# static kiface linking (matches the per-app WASM executables). KICAD_MERGED_KIFACES
|
||||
# selects single_top.cpp's dual-getter registration branch.
|
||||
set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PCB_EDITOR;KICAD_MERGED_KIFACES"
|
||||
)
|
||||
|
||||
# Both kifaces' full library sets (exported CACHE INTERNAL by pcbnew/ and eeschema/).
|
||||
# The overlap (common, kicommon, gal, ...) is deduped; generator-expression entries
|
||||
# (native-only pads_common/pcm) are inert strings that evaluate to nothing here.
|
||||
set( KICAD_EDITOR_LIBS ${PCBNEW_KIFACE_LIBRARIES} ${EESCHEMA_KIFACE_LIBRARIES} )
|
||||
list( REMOVE_DUPLICATES KICAD_EDITOR_LIBS )
|
||||
|
||||
target_link_libraries( kicad_editor PRIVATE ${KICAD_EDITOR_LIBS} )
|
||||
|
||||
# Same link shape as the standalone pcbnew WASM executable: allow-multiple-definition
|
||||
# for the wx/KiCad dupes, and --whole-archive pcbcommon so RTTI-only-referenced
|
||||
# vtables/typeinfo are pulled in.
|
||||
target_link_options( kicad_editor PRIVATE
|
||||
"LINKER:--allow-multiple-definition"
|
||||
"LINKER:--whole-archive"
|
||||
"$<TARGET_FILE:pcbcommon>"
|
||||
"LINKER:--no-whole-archive"
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,--cref,-Map=kicad_editor.map>
|
||||
)
|
||||
Loading…
Reference in a new issue