From 58a383d212ae9d68979eb39bc24674ac6245640b Mon Sep 17 00:00:00 2001 From: berrux_dev Date: Fri, 18 Sep 2026 17:49:15 +0200 Subject: [PATCH] Adds manual Qt6 WebSockets import and availability macro --- qt6-after/qt6-migrated-legatus/CMakeLists.txt | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/qt6-after/qt6-migrated-legatus/CMakeLists.txt b/qt6-after/qt6-migrated-legatus/CMakeLists.txt index 6937cb80e..4b2cb9b07 100755 --- a/qt6-after/qt6-migrated-legatus/CMakeLists.txt +++ b/qt6-after/qt6-migrated-legatus/CMakeLists.txt @@ -100,7 +100,6 @@ include_directories(${CMAKE_SOURCE_DIR}/include/ExerciseEventManagement) include_directories(${CMAKE_BINARY_DIR}/Lts/Services/ExerciseManagement) include_directories(${CMAKE_SOURCE_DIR}/include/ExerciseManagement) include_directories(${CMAKE_BINARY_DIR}/Lts/Services/FileManagement) -include_directories(${CMAKE_SOURCE_DIR}/include/FileManagement) include_directories(${CMAKE_BINARY_DIR}/Lts/Services/NotificationManagement) include_directories(${CMAKE_SOURCE_DIR}/include/NotificationManagement) include_directories(${CMAKE_BINARY_DIR}/Lts/Services/ParticipantManagement) @@ -124,7 +123,6 @@ include_directories(${CMAKE_BINARY_DIR}/Lts/Common/LtsUtils/LtsUtilsCore) include_directories(${CMAKE_SOURCE_DIR}/Z/src/NGLLogger) include_directories(${CMAKE_SOURCE_DIR}/include/Viewer/SituationMap) include_directories(${CMAKE_SOURCE_DIR}/include/OperatorManagement) -include_directories(${CMAKE_SOURCE_DIR}/include/FileManagement) include_directories(${CMAKE_SOURCE_DIR}/forward-declarations) SET(CMAKE_CXX_STANDARD 17) SET(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -255,8 +253,11 @@ if(Qt6Core5Compat_FOUND) endif() # Find Qt6 core components first (without OpenGL which may not be available) +# WebSockets is required by the migrated services (FileManagement's THP script +# server uses QWebSocketServer; LtsWebSocket/httq enable their real websocket +# paths via QT6_WEBSOCKETS_AVAILABLE when the module is found). find_package(Qt6 6.2 COMPONENTS Concurrent Core LinguistTools Network - Multimedia Sql SerialPort Test Xml Positioning Svg QUIET) + Multimedia Sql SerialPort Test Xml Positioning Svg WebSockets QUIET) if(Qt6_FOUND) # Skip GUI find_package - it fails without OpenGL. We'll create manual targets below. @@ -450,6 +451,21 @@ if(NOT TARGET Qt6::OpenGL) message(STATUS "Created stub target for Qt6::OpenGL (library not available)") endif() +# Qt6::WebSockets - create manual target if not found (the container's Qt6 +# discovery takes the minimal path, so find_package never creates the +# component targets). The migrated FileManagement service (THP script +# server) needs the real module. +if(NOT TARGET Qt6::WebSockets AND EXISTS "${QT6_LIB_DIR}/libQt6WebSockets.so.6") + add_library(Qt6::WebSockets SHARED IMPORTED) + set_target_properties(Qt6::WebSockets PROPERTIES + IMPORTED_LOCATION "${QT6_LIB_DIR}/libQt6WebSockets.so.6" + INTERFACE_INCLUDE_DIRECTORIES "${QT6_INC_DIR}/QtWebSockets;${QT6_INC_DIR}" + INTERFACE_LINK_LIBRARIES "Qt6::Core;Qt6::Network" + ) + set(QT6_WEBSOCKETS_REAL_FOUND TRUE) + message(STATUS "Manually configured Qt6 WebSockets target") +endif() + # Stub Qt6::WebSockets target if not available (needed by LtsWebSocket, httq, etc.) if(NOT TARGET Qt6::WebSockets) add_library(Qt6::WebSockets INTERFACE IMPORTED) @@ -459,6 +475,14 @@ if(NOT TARGET Qt6::WebSockets) message(STATUS "Created stub target for Qt6::WebSockets (library not available)") endif() +# The real Qt6 WebSockets module is available (either via find_package or the +# manual import above): enable the real websocket code paths in httq, +# LtsWebSocket and the migrated services (they check this macro; without it +# they fall back to websocket-less operation). +if(Qt6WebSockets_FOUND OR QT6_WEBSOCKETS_REAL_FOUND) + add_compile_definitions(QT6_WEBSOCKETS_AVAILABLE) +endif() + MESSAGE(STATUS "Qt version is ${Qt6Core_VERSION}, GUI available: ${QT6_GUI_AVAILABLE}") #