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()
|