Brings up KiCad's pagelayout_editor (drawing-sheet editor) in the browser, to roughly the same "boots, canvas visible, partially usable in-session" level as the existing pcbnew/eeschema/calculator ports. Build: - docker/build.sh: add pl_editor to the unified app dispatch (case, subdir map, all-loop). - scripts/kicad/build-kicad-target.sh: add pl_editor to the case; upstream target name pl_editor under source subdir pagelayout_editor. - scripts/kicad/build-pl_editor.sh: 7-line thin wrapper matching the pcbnew/eeschema/calculator pattern. - tests/scripts/setup-kicad-wasm.sh: copy_app pl_editor. App glue: - wasm/stubs/nl_pl_editor_plugin_stub.cpp: no-op SpaceMouse plugin so pl_editor_frame.cpp's NL_PL_EDITOR_PLUGIN symbols resolve. Mirrors nl_pcbnew_plugin_stub.cpp. - tests/apps/kicad/pl_editor.html: browser shell. preRun creates /home/kicad and FS.chdir there so file dialogs land somewhere friendly instead of MEMFS root (/dev/, /proc/, etc.). E2E coverage: - tests/kicad/pl_editor.spec.ts: 5 tests — smoke (canvas, no abort), wizard, File menu has Open/Save As, file-dialog folder-navigation regression, canvas + toolbar metrics. - tests/e2e/filedialog-folder-nav.spec.ts: wxWidgets-level twin of the regression test (exercises the underlying widget directly via the standalone filedialog_test app). Submodule bumps: - kicad → feature/pl-editor (WASM gating in pagelayout_editor's CMakeLists + navlib stub). - wxwidgets → feature/pl-editor (wxGenericFileDialog::OnOk navigates into selected directories; wasm/mouse.cpp emits wxEVT_LEFT_DCLICK via timestamp-based double-click detection — the latter benefits every wxWidgets-WASM app). See features/pl-editor/ for the design doc + per-repo diff patches. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
194 lines
6.4 KiB
Diff
194 lines
6.4 KiB
Diff
diff --git a/pagelayout_editor/CMakeLists.txt b/pagelayout_editor/CMakeLists.txt
|
|
index f287e5368a..dfc01a9b9c 100644
|
|
--- a/pagelayout_editor/CMakeLists.txt
|
|
+++ b/pagelayout_editor/CMakeLists.txt
|
|
@@ -77,55 +77,103 @@ add_executable( pl_editor WIN32 MACOSX_BUNDLE
|
|
${PL_EDITOR_RESOURCES}
|
|
)
|
|
|
|
-set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES
|
|
- COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PL_EDITOR;PGM_DATA_FILE_EXT=\"kicad_wks\";BUILD_KIWAY_DLL"
|
|
- )
|
|
-target_link_libraries( pl_editor
|
|
- kicommon
|
|
- ${wxWidgets_LIBRARIES}
|
|
- )
|
|
+if( EMSCRIPTEN )
|
|
+ # WASM: Static kiface linking - don't define BUILD_KIWAY_DLL
|
|
+ set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES
|
|
+ COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PL_EDITOR;PGM_DATA_FILE_EXT=\"kicad_wks\""
|
|
+ )
|
|
+else()
|
|
+ set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES
|
|
+ COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PL_EDITOR;PGM_DATA_FILE_EXT=\"kicad_wks\";BUILD_KIWAY_DLL"
|
|
+ )
|
|
+endif()
|
|
+
|
|
+if( NOT EMSCRIPTEN )
|
|
+ # Native: minimal link, kiface loaded dynamically
|
|
+ target_link_libraries( pl_editor
|
|
+ kicommon
|
|
+ ${wxWidgets_LIBRARIES}
|
|
+ )
|
|
+endif()
|
|
+# WASM linking is done after PL_EDITOR_KIFACE_LIBRARIES is defined
|
|
|
|
target_link_options( pl_editor PRIVATE
|
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,--cref,-Map=pl_editor.map>
|
|
)
|
|
|
|
-# the main pl_editor program, in DSO form.
|
|
-add_library( pl_editor_kiface MODULE
|
|
+# the main pl_editor program, in OBJECT form so it can be statically linked on WASM.
|
|
+add_library( pl_editor_kiface_objects OBJECT
|
|
pl_editor.cpp
|
|
${PL_EDITOR_SRCS}
|
|
${DIALOGS_SRCS}
|
|
${PL_EDITOR_EXTRA_SRCS}
|
|
)
|
|
-target_link_libraries( pl_editor_kiface
|
|
- gal
|
|
- common
|
|
- core
|
|
- ${wxWidgets_LIBRARIES}
|
|
+
|
|
+target_link_libraries( pl_editor_kiface_objects
|
|
+ PRIVATE
|
|
+ common
|
|
+ core
|
|
+ ${wxWidgets_LIBRARIES}
|
|
)
|
|
+
|
|
+add_library( pl_editor_kiface MODULE )
|
|
+
|
|
set_target_properties( pl_editor_kiface PROPERTIES
|
|
OUTPUT_NAME pl_editor
|
|
PREFIX ${KIFACE_PREFIX}
|
|
SUFFIX ${KIFACE_SUFFIX}
|
|
)
|
|
|
|
-set_source_files_properties( pl_editor.cpp PROPERTIES
|
|
- # The KIFACE is in pcbnew.cpp, export it:
|
|
- COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
|
- )
|
|
+if( EMSCRIPTEN )
|
|
+ # WASM: Static linking - don't define BUILD_KIWAY_DLL
|
|
+ set_source_files_properties( pl_editor.cpp PROPERTIES
|
|
+ COMPILE_DEFINITIONS "COMPILING_DLL"
|
|
+ )
|
|
+else()
|
|
+ set_source_files_properties( pl_editor.cpp PROPERTIES
|
|
+ # The KIFACE is in pl_editor.cpp, export it:
|
|
+ COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
|
+ )
|
|
+endif()
|
|
|
|
target_link_options( pl_editor_kiface PRIVATE
|
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,--cref,-Map=_pl_editor.kiface.map>
|
|
)
|
|
|
|
-# if building pl_editor, then also build pl_editor_kiface if out of date.
|
|
-add_dependencies( pl_editor pl_editor_kiface )
|
|
-
|
|
message( STATUS "Including 3Dconnexion SpaceMouse navigation support in pagelayout editor" )
|
|
add_subdirectory( navlib )
|
|
|
|
-target_link_libraries( pl_editor_kiface pl_editor_navlib)
|
|
+set( PL_EDITOR_KIFACE_LIBRARIES
|
|
+ pl_editor_kiface_objects
|
|
+ pl_editor_navlib
|
|
+ kicommon
|
|
+ kiplatform
|
|
+ common
|
|
+ gal
|
|
+ core
|
|
+ ${wxWidgets_LIBRARIES}
|
|
+ )
|
|
+
|
|
+# WASM: Link kiface objects directly into pl_editor executable (static linking)
|
|
+if( EMSCRIPTEN )
|
|
+ target_link_libraries( pl_editor
|
|
+ PRIVATE
|
|
+ ${PL_EDITOR_KIFACE_LIBRARIES}
|
|
+ )
|
|
+ target_link_options( pl_editor PRIVATE
|
|
+ "LINKER:--allow-multiple-definition"
|
|
+ )
|
|
+endif()
|
|
+
|
|
+target_link_libraries( pl_editor_kiface
|
|
+ PRIVATE
|
|
+ ${PL_EDITOR_KIFACE_LIBRARIES}
|
|
+ )
|
|
+
|
|
+# if building pl_editor, then also build pl_editor_kiface if out of date.
|
|
+add_dependencies( pl_editor pl_editor_kiface )
|
|
|
|
-add_dependencies( pl_editor_kiface pl_editor_navlib)
|
|
+add_dependencies( pl_editor_kiface pl_editor_navlib )
|
|
|
|
# these 2 binaries are a matched set, keep them together:
|
|
if( APPLE )
|
|
diff --git a/pagelayout_editor/navlib/CMakeLists.txt b/pagelayout_editor/navlib/CMakeLists.txt
|
|
index ad3c388736..89e94e6abb 100644
|
|
--- a/pagelayout_editor/navlib/CMakeLists.txt
|
|
+++ b/pagelayout_editor/navlib/CMakeLists.txt
|
|
@@ -1,25 +1,36 @@
|
|
|
|
-add_library(pl_editor_navlib STATIC
|
|
- "nl_pl_editor_plugin.cpp"
|
|
- "nl_pl_editor_plugin_impl.cpp"
|
|
-)
|
|
+# WASM: 3D mouse support not available, use stubs
|
|
+if( EMSCRIPTEN )
|
|
+ add_library(pl_editor_navlib STATIC
|
|
+ "${CMAKE_SOURCE_DIR}/../wasm/stubs/nl_pl_editor_plugin_stub.cpp"
|
|
+ )
|
|
+ target_include_directories(pl_editor_navlib PRIVATE
|
|
+ ${CMAKE_SOURCE_DIR}/pagelayout_editor
|
|
+ ${CMAKE_SOURCE_DIR}/include
|
|
+ )
|
|
+else()
|
|
+ add_library(pl_editor_navlib STATIC
|
|
+ "nl_pl_editor_plugin.cpp"
|
|
+ "nl_pl_editor_plugin_impl.cpp"
|
|
+ )
|
|
|
|
-# pl_editor_navlib depends on make_lexer outputs in common
|
|
-add_dependencies( pl_editor_navlib common )
|
|
+ # pl_editor_navlib depends on make_lexer outputs in common
|
|
+ add_dependencies( pl_editor_navlib common )
|
|
|
|
-# Find the 3DxWare SDK component 3DxWare::NlClient
|
|
-# find_package(TDxWare_SDK 4.0 REQUIRED COMPONENTS 3DxWare::Navlib)
|
|
-target_compile_definitions(pl_editor_navlib PRIVATE
|
|
- $<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_DEFINITIONS>
|
|
-)
|
|
-target_compile_options(pl_editor_navlib PRIVATE
|
|
- $<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_OPTIONS>
|
|
-)
|
|
-target_include_directories(pl_editor_navlib PRIVATE
|
|
- $<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_INCLUDE_DIRECTORIES>
|
|
- $<TARGET_PROPERTY:pl_editor_kiface,INCLUDE_DIRECTORIES>
|
|
-)
|
|
-target_link_libraries(pl_editor_navlib
|
|
- $<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
|
|
- 3DxWare::Navlib
|
|
-)
|
|
+ # Find the 3DxWare SDK component 3DxWare::NlClient
|
|
+ # find_package(TDxWare_SDK 4.0 REQUIRED COMPONENTS 3DxWare::Navlib)
|
|
+ target_compile_definitions(pl_editor_navlib PRIVATE
|
|
+ $<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_DEFINITIONS>
|
|
+ )
|
|
+ target_compile_options(pl_editor_navlib PRIVATE
|
|
+ $<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_COMPILE_OPTIONS>
|
|
+ )
|
|
+ target_include_directories(pl_editor_navlib PRIVATE
|
|
+ $<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_INCLUDE_DIRECTORIES>
|
|
+ $<TARGET_PROPERTY:pl_editor_kiface,INCLUDE_DIRECTORIES>
|
|
+ )
|
|
+ target_link_libraries(pl_editor_navlib
|
|
+ $<TARGET_PROPERTY:3DxWare::Navlib,INTERFACE_LINK_LIBRARIES>
|
|
+ 3DxWare::Navlib
|
|
+ )
|
|
+endif()
|