Files
gcs-nf/Plugins/ToolsUI/CMakeLists.txt
T
hm e7cf44504c feat: Service Registry + Bridge 解耦架构 + 全工程代码清理
## 架构升级:Service Registry + Bridge 模式

- 新增 PluginSDK/IPluginServices.h:10 个纯虚服务接口(IDataProvider/ILinkProvider/...)
- 新增 MavLinkServiceBridge:单 QObject 实现全部服务,隔离 MavLinkNode 依赖
- 升级 PluginManifest:支持 plugin.json 的 provides/consumes 声明式依赖
- 实现 ExtensionHost::autoWire():元对象自省自动连接信号槽
- 集成到 AppController:initModules() 中创建桥接器并注册到 ServiceRegistry
- CockpitPlugin 演示服务发现:initialize() 中通过 PluginContext 查找服务

## 代码清理

- Plugins/opmap:~280 行死代码(waypointsetting 100行注释块/tilematrix 54行/等27个文件)
- Plugins/MavLinkNode:~200 行 GBK 乱码注释翻译为 UTF-8 + 12 行注释死代码
- Plugins/ToolsUI:~222 行死代码(ECU.cpp 82行/INS.cpp 113行/Parse/ToolsUI 等)
- StatusUI/Setting/MissionUI:~65 行注释死代码
- Cockpit/leftladder.cpp:10 处 GBK 乱码翻译为中文
- 清理头文件注释掉的 #include(19 处)、空 if-else 分支、注释变量声明

## 编译验证

- [100%] Built target GCS 零错误
- 运行时 timeout 3s 正常退出,无崩溃
2026-06-01 09:46:36 +08:00

132 lines
3.9 KiB
CMake

# ToolsUI ? ??????????? / DLL?
# ?????????????????????? widget ???
file(GLOB TOOLS_CORE_SOURCES
*.cpp *.h *.ui
)
file(GLOB TOOLS_DIAGRAM_SOURCES
Diagram/*.cpp Diagram/*.h Diagram/*.ui
)
file(GLOB TOOLS_DLINK_SOURCES
DlinkMonitor/*.cpp DlinkMonitor/*.h DlinkMonitor/*.ui
DlinkMonitor/SerialPortDialog/*.cpp DlinkMonitor/SerialPortDialog/*.h DlinkMonitor/SerialPortDialog/*.ui
)
file(GLOB TOOLS_ECU_SOURCES
ECU/*.cpp ECU/*.h ECU/*.ui
)
file(GLOB TOOLS_INS_SOURCES
INS/*.cpp INS/*.h INS/*.ui
)
file(GLOB TOOLS_GEAR_SOURCES
LandingGear_AJ500/*.c LandingGear_AJ500/*.cpp LandingGear_AJ500/*.h LandingGear_AJ500/*.ui
)
file(GLOB TOOLS_POWER_SOURCES
PowerSystem/*.cpp PowerSystem/*.h PowerSystem/*.ui
)
file(GLOB TOOLS_RC_SOURCES
RemoteControl/*.cpp RemoteControl/*.h RemoteControl/*.ui
)
file(GLOB TOOLS_SENSER_SOURCES
Senser/*.cpp Senser/*.h Senser/*.ui
)
file(GLOB TOOLS_SERVO_SOURCES
ServoSystem/*.cpp ServoSystem/*.h ServoSystem/*.ui
)
file(GLOB TOOLS_EVTOL_SOURCES
evtol/*.cpp evtol/*.h evtol/*.ui
)
file(GLOB TOOLS_INDEX0_SOURCES
tools_Index0/*.cpp tools_Index0/*.h tools_Index0/*.ui
tools_Index0/MAVLinkInspector/*.cc tools_Index0/MAVLinkInspector/*.h tools_Index0/MAVLinkInspector/*.ui
)
file(GLOB TOOLS_INDEX1_SOURCES
tools_Index1/*.cpp tools_Index1/*.h tools_Index1/*.ui
)
file(GLOB TOOLS_INDEX2_SOURCES
tools_Index2/*.cpp tools_Index2/*.h tools_Index2/*.ui
)
file(GLOB TOOLS_INDEX3_SOURCES
tools_Index3/*.cpp tools_Index3/*.h tools_Index3/*.ui
)
file(GLOB TOOLS_INDEX4_SOURCES
tools_Index4/*.cpp tools_Index4/*.h tools_Index4/*.ui
)
add_library(ToolsUIPlugin SHARED
${TOOLS_CORE_SOURCES}
${TOOLS_DIAGRAM_SOURCES}
${TOOLS_DLINK_SOURCES}
${TOOLS_ECU_SOURCES}
${TOOLS_INS_SOURCES}
${TOOLS_GEAR_SOURCES}
${TOOLS_POWER_SOURCES}
${TOOLS_RC_SOURCES}
${TOOLS_SENSER_SOURCES}
${TOOLS_SERVO_SOURCES}
${TOOLS_EVTOL_SOURCES}
${TOOLS_INDEX0_SOURCES}
${TOOLS_INDEX1_SOURCES}
${TOOLS_INDEX2_SOURCES}
${TOOLS_INDEX3_SOURCES}
${TOOLS_INDEX4_SOURCES}
)
target_include_directories(ToolsUIPlugin PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Diagram
${CMAKE_CURRENT_SOURCE_DIR}/DlinkMonitor
${CMAKE_CURRENT_SOURCE_DIR}/DlinkMonitor/SerialPortDialog
${CMAKE_CURRENT_SOURCE_DIR}/ECU
${CMAKE_CURRENT_SOURCE_DIR}/INS
${CMAKE_CURRENT_SOURCE_DIR}/LandingGear_AJ500
${CMAKE_CURRENT_SOURCE_DIR}/PowerSystem
${CMAKE_CURRENT_SOURCE_DIR}/RemoteControl
${CMAKE_CURRENT_SOURCE_DIR}/Senser
${CMAKE_CURRENT_SOURCE_DIR}/ServoSystem
${CMAKE_CURRENT_SOURCE_DIR}/evtol
${CMAKE_CURRENT_SOURCE_DIR}/tools_Index0
${CMAKE_CURRENT_SOURCE_DIR}/tools_Index0/MAVLinkInspector
${CMAKE_CURRENT_SOURCE_DIR}/tools_Index1
${CMAKE_CURRENT_SOURCE_DIR}/tools_Index2
${CMAKE_CURRENT_SOURCE_DIR}/tools_Index3
${CMAKE_CURRENT_SOURCE_DIR}/tools_Index4
${CMAKE_SOURCE_DIR}/Plugins
${CMAKE_SOURCE_DIR}/PluginSDK
${CMAKE_SOURCE_DIR}/App
${CMAKE_SOURCE_DIR}/App/Plugins
${CMAKE_SOURCE_DIR}/App/core
${CMAKE_SOURCE_DIR}/App/core/math
)
target_link_libraries(ToolsUIPlugin PUBLIC
PluginSDK
ComponentUI
Core
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::SerialPort
)
set_target_properties(ToolsUIPlugin PROPERTIES PREFIX "" SUFFIX ".dll" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/plugins/ToolsUI" WINDOWS_EXPORT_ALL_SYMBOLS ON LINK_FLAGS "-Wl,--export-all-symbols")
add_custom_command(TARGET ToolsUIPlugin POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/plugin.json"
"${CMAKE_BINARY_DIR}/bin/plugins/ToolsUI/plugin.json"
)