设备监控

This commit is contained in:
flower_linux
2026-03-19 10:47:26 +08:00
parent 91a3361d1f
commit 903c349e1d
48 changed files with 820 additions and 100 deletions

View File

@@ -31,6 +31,7 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
# 查找Qt6守护进程只需要 Core/DBus/Network/SerialPort/Sql
find_package(Qt6 6.5 REQUIRED COMPONENTS Core SerialPort Network Sql DBus)
include(CheckIncludeFileCXX)
# 检测编译平台
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
@@ -77,8 +78,19 @@ qt_add_executable(softbus_daemon
# device bus: tree & capabilities
src/device_bus/tree/DeviceTreeModel.h
src/device_bus/tree/DeviceTreeModel.cpp
src/device_bus/capabilities/DriverCapabilityProvider.h
src/device_bus/capabilities/DriverCapabilityProvider.cpp
# device bus: monitor
src/device_bus/monitor/DeviceEvent.h
src/device_bus/monitor/IDeviceMonitor.h
src/device_bus/monitor/DeviceMonitorService.h
src/device_bus/monitor/DeviceMonitorService.cpp
src/device_bus/monitor/UdevDeviceMonitor.h
src/device_bus/monitor/UdevDeviceMonitor.cpp
src/device_bus/monitor/NetlinkDeviceMonitor.h
src/device_bus/monitor/NetlinkDeviceMonitor.cpp
src/device_bus/monitor/WindowsDeviceMonitor.h
src/device_bus/monitor/WindowsDeviceMonitor.cpp
# device bus: facade & manager
src/device_bus/DeviceBus.h
@@ -114,6 +126,27 @@ target_link_libraries(softbus_daemon
Qt6::Network
)
# Platform-specific deps
if(UNIX AND NOT APPLE)
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(UDEV QUIET libudev)
endif()
if(UDEV_FOUND)
target_include_directories(softbus_daemon PRIVATE ${UDEV_INCLUDE_DIRS})
target_link_directories(softbus_daemon PRIVATE ${UDEV_LIBRARY_DIRS})
target_link_libraries(softbus_daemon PRIVATE ${UDEV_LIBRARIES})
else()
# Fallback: rely on system linker search path
target_link_libraries(softbus_daemon PRIVATE udev)
endif()
endif()
if(WIN32)
target_link_libraries(softbus_daemon PRIVATE setupapi iphlpapi user32 advapi32)
endif()
add_subdirectory(plugins)