Skip to content

Commit 28f19a9

Browse files
committed
feat(build): qt6 port + qml / qt3d removal
This is a port from Qt 5 to Qt 6. Included: - Use new Qt 6 VCPKG and Qt 6 docker image - Updated many dependencies due to VCPKG update - Removed QML, Qt3D Also: - Removed deprecated boost::asio::io_service - Fixed rare race condition in worker_asio - Fixed selector - Fixed http post test - Fixed video_controls GUI tests - Fixed cardinal layout main title - Sequencer widget reimplementation - Removed CMake warnings and deprecated code
1 parent 805fa74 commit 28f19a9

File tree

218 files changed

+1514
-7545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

218 files changed

+1514
-7545
lines changed

.gitlab-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ stages:
77

88
include:
99
- project: "sight/sight-gitlab"
10-
ref: 8d212bf32b05fbf1dcf714d70fc870995723392c
10+
ref: cedfea7a6437cb7c31e6cac1ca58e6428e9cb2cc
1111
file: "/.templates/deploy.yml"
1212
- project: "sight/sight-gitlab"
13-
ref: 8d212bf32b05fbf1dcf714d70fc870995723392c
13+
ref: cedfea7a6437cb7c31e6cac1ca58e6428e9cb2cc
1414
file: "/.templates/build.yml"
1515

1616
lint:ubuntu-24.04:

CMakeLists.txt

+22-15
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@ cmake_policy(SET CMP0063 NEW)
1212
cmake_policy(SET CMP0057 NEW)
1313
# Use new policy to use CMAKE_CXX_STANDARD in try_compile() macro
1414
cmake_policy(SET CMP0067 NEW)
15-
# Use old policy for Documentation to add cache variables and find VTK documentation dependent packages.
16-
# (Needed for doxygen..)
17-
cmake_policy(SET CMP0106 OLD)
1815
# Use new policy for CMAKE_MSVC_DEBUG_INFORMATION_FORMAT
1916
cmake_policy(SET CMP0141 NEW)
20-
# Use old policy for now because of openCV
21-
cmake_policy(SET CMP0146 OLD)
2217

23-
if(${CMAKE_VERSION} VERSION_GREATER "3.25.0")
24-
# Transform the ``DEPFILE`` after running the custom command for Ninja generator.
25-
cmake_policy(SET CMP0116 OLD)
18+
if(${CMAKE_VERSION} VERSION_GREATER "3.31.0")
19+
# Use new policy for removed FindBoost module
20+
cmake_policy(SET CMP0167 NEW)
21+
# Use new policy for empty string variable after a single-value keyword
22+
cmake_policy(SET CMP0174 NEW)
23+
# Use new policy for normalized install() DESTINATION paths
24+
cmake_policy(SET CMP0177 NEW)
25+
else()
26+
# Use old policy for Documentation to add cache variables and find VTK documentation dependent packages.
27+
# (Needed for doxygen..)
28+
cmake_policy(SET CMP0106 OLD)
2629
endif()
2730

2831
# On Windows, if the user doesn't specify a value,
@@ -44,7 +47,7 @@ endif()
4447

4548
project(
4649
sight
47-
VERSION 24.0.0
50+
VERSION 25.0.0
4851
DESCRIPTION "Surgical Image Guidance and Healthcare Toolkit"
4952
HOMEPAGE_URL "https://git.ircad.fr/sight/sight"
5053
)
@@ -69,8 +72,14 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/build/flags.cmake)
6972
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/build/macros.cmake)
7073
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/build/linux/modules)
7174

75+
# We need to find Qt6 before ITK/VTK, otherwise they find Qt5 and CMake fails with a cryptic
76+
# "Targets not yet defined: Qt::XXXXPrivate", even if we don't use ITK-Qt or VTK-Qt extensions
77+
if(UNIX)
78+
find_package(Qt6 CONFIG QUIET COMPONENTS Core Gui Widgets OpenGL)
79+
endif()
80+
7281
# We find VTK to know its version so we can enable PCL or not
73-
find_package(VTK CONFIG QUIET REQUIRED)
82+
find_package(VTK CONFIG QUIET)
7483

7584
########################################################################################################################
7685
# User options
@@ -109,10 +118,6 @@ if(SIGHT_ENABLE_CLANG_TIDY)
109118
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
110119
endif()
111120

112-
# QML_IMPORT_PATH allows qtCreator to find the qml modules created in our modules
113-
set(QML_IMPORT_PATH "" CACHE STRING "Path of the Qml modules." FORCE)
114-
mark_as_advanced(QML_IMPORT_PATH)
115-
116121
if(CMAKE_CONFIGURATION_TYPES)
117122
set(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "List of supported configurations." FORCE)
118123
endif()
@@ -210,14 +215,16 @@ sight_configure_pch()
210215

211216
add_subdirectory(libs)
212217
add_subdirectory(modules)
213-
add_subdirectory(configs)
214218
add_subdirectory(activities)
219+
add_subdirectory(configs)
215220
add_subdirectory(utils)
216221
add_subdirectory(apps)
222+
217223
if(SIGHT_BUILD_EXAMPLES)
218224
add_subdirectory(tutorials)
219225
add_subdirectory(examples)
220226
endif()
227+
221228
add_subdirectory(3rd-party)
222229

223230
########################################################################################################################

activities/viz/negato/rc/configurations/2d_negato.xml

-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<param name="patient_name" default="" />
88
<!-- axial, frontal, sagittal -->
99
<param name="orientation" default="axial" />
10-
<param name="CrossTypeChannel" default="crossTypeChannel" />
1110
<param name="PickingChannel" default="pickingChannel" />
1211
</parameters>
1312
<config>
@@ -148,10 +147,6 @@
148147
<backends enable="all" mode="best" />
149148
</service>
150149

151-
<connect channel="${CrossTypeChannel}">
152-
<slot>MPRNegato/set_cross_scale</slot>
153-
</connect>
154-
155150
<connect channel="${PickingChannel}">
156151
<signal>pickerInteractorAdp/picked</signal>
157152
</connect>

activities/viz/negato/rc/configurations/2d_negato_with_tf.xml

-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
<param name="patient_name" default="" />
99
<!-- axial, frontal, sagittal -->
1010
<param name="orientation" default="axial" />
11-
<param name="CrossTypeChannel" default="crossTypeChannel" />
1211
<param name="PickingChannel" default="pickingChannel" />
1312
</parameters>
1413
<config>
@@ -136,10 +135,6 @@
136135
<slot>multiDistances/create_distance</slot>
137136
</connect>
138137

139-
<connect channel="${CrossTypeChannel}">
140-
<slot>MPRNegato/set_cross_scale</slot>
141-
</connect>
142-
143138
<connect channel="${PickingChannel}">
144139
<signal>pickerInteractor/picked</signal>
145140
</connect>

activities/viz/negato/rc/configurations/2d_visualization.xml

-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
<key name="image" uid="${imageSeries}" />
5050
</inout>
5151
<parameter replace="WID_PARENT" by="view_negato1" />
52-
<parameter replace="CrossTypeChannel" by="crossTypeChannel" />
5352
<parameter replace="PickingChannel" by="pickerChannel" />
5453
<parameter replace="orientation" by="axial" />
5554
</service>
@@ -60,7 +59,6 @@
6059
<key name="image" uid="${imageSeries}" />
6160
</inout>
6261
<parameter replace="WID_PARENT" by="view_negato2" />
63-
<parameter replace="CrossTypeChannel" by="crossTypeChannel" />
6462
<parameter replace="PickingChannel" by="pickerChannel" />
6563
<parameter replace="orientation" by="frontal" />
6664
</service>
@@ -71,7 +69,6 @@
7169
<key name="image" uid="${imageSeries}" />
7270
</inout>
7371
<parameter replace="WID_PARENT" by="view_negato3" />
74-
<parameter replace="CrossTypeChannel" by="crossTypeChannel" />
7572
<parameter replace="PickingChannel" by="pickerChannel" />
7673
<parameter replace="orientation" by="sagittal" />
7774
</service>

apps/sight_viewer/test/uit/test.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/************************************************************************
22
*
3-
* Copyright (C) 2022-2024 IRCAD France
3+
* Copyright (C) 2022-2025 IRCAD France
44
*
55
* This file is part of Sight.
66
*
@@ -62,6 +62,9 @@ void test::open_file(
6262
// Fill the file dialog, tap PATH
6363
helper::file_dialog::fill(_tester, _path);
6464

65+
// Ensure the image loading is started, otherwise it will hang the test.
66+
QTest::qWait(1000);
67+
6568
if(_format == "DICOM" || _format == "Nifti or Inr images")
6669
{
6770
// The Show/hide volume button becomes enabled when the image effectively shows up.

cmake/build/download_deps.cmake

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ if(WIN32)
4040
endif()
4141

4242
if(NOT SIGHT_DEPS_PACKAGE)
43-
set(SIGHT_DEPS_PACKAGE "${SIGHT_DEPS_BASENAME}-c9fd19ca")
43+
set(SIGHT_DEPS_PACKAGE "${SIGHT_DEPS_BASENAME}-05c97253")
4444
endif()
4545

4646
if(NOT SIGHT_DEPS_ARCHIVE)
4747
set(SIGHT_DEPS_ARCHIVE "${SIGHT_DEPS_PACKAGE}.7z")
4848
endif()
4949

5050
if(NOT SIGHT_DEPS_PUBLIC_URL)
51-
set(SIGHT_DEPS_PUBLIC_URL "https://cloud.ircad.fr/s/eJSsTCkjtitymFD/download")
51+
set(SIGHT_DEPS_PUBLIC_URL "https://cloud.ircad.fr/s/59cbTgwnnLYWrfA/download")
5252
endif()
5353

5454
if(NOT SIGHT_DEPS_ARCHIVE_HASH)
55-
set(SIGHT_DEPS_ARCHIVE_HASH "01285f0d8c71828417d3de76dad2f0d52ad2406fa2b2f65c40b0088b72d45d2a")
55+
set(SIGHT_DEPS_ARCHIVE_HASH "7B60B8D49BF7BD108AEE96A4F8D1D6BBA3D4F6C241D185746079E99A965A73E4")
5656
endif()
5757

5858
# By default, we avoid to download binary packages inside the build tree on windows

cmake/build/flags.cmake

+5-6
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,14 @@ add_compile_definitions("$<$<CONFIG:MinSizeRel,Release,RelWithDebInfo>:NDEBUG>")
105105

106106
# Add a global definition to silence a windows warning when using boost, saying _WIN32_WINNT is not defined.
107107
# Beware this must match the value used to compile BOOST, otherwise libraries that uses Boost::Log will NOT link.
108-
add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:WINVER=0x0601>")
109-
add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:_WIN32_WINNT=0x0601>")
110-
add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:BOOST_USE_WINAPI_VERSION=0x0601>")
108+
add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:_WIN32_WINNT=0x0A00>")
111109

112110
# Avoid conflicts with std::min / std::max when including windows.h
113111
add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:NOMINMAX>")
114112

115113
# Suppress MSVC specific warnings
116114
add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:_ENABLE_EXTENDED_ALIGNED_STORAGE>")
117115

118-
# We need this because of OgreUTFString.h, which is removed in more recent Ogre versions
119-
add_compile_definitions("$<$<CXX_COMPILER_ID:MSVC>:_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING>")
120-
121116
#
122117
# Options: Warnings
123118
#
@@ -302,6 +297,10 @@ if(MSVC)
302297
# CMAKE_MSVC_DEBUG_INFORMATION_FORMAT doesn't always work
303298
replace_flags("/Z[iI]" "/Z7")
304299

300+
# Force source file encoding to UTF-8 to ignore changes from dependencies like Qt6, which may break PCH or CCache
301+
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<COMPILE_LANGUAGE:C,CXX>>:/utf-8>")
302+
add_compile_options("$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<COMPILE_LANGUAGE:CUDA>>:-Xcompiler=-utf-8>")
303+
305304
# On MSVC, we want different optimizations depending on the target
306305
# CMake does allow us to override CXX_FLAGS, so we reset them here and
307306
# restore them later, modified or not, in restore_cxx_flags()

cmake/build/macros.cmake

+1-13
Original file line numberDiff line numberDiff line change
@@ -1286,26 +1286,14 @@ function(sight_create_package_targets SIGHT_COMPONENTS SIGHT_IMPORTED_COMPONENTS
12861286

12871287
# Add a fixup target for every app
12881288
if(WIN32)
1289-
1290-
# Determine if we need to copy Qml plugins
1291-
find_target_dependencies(${APP} "${SIGHT_COMPONENTS};${SIGHT_IMPORTED_COMPONENTS}" DEPENDS_FOR_QML)
1292-
foreach(DEP ${DEPENDS_FOR_QML})
1293-
get_target_property(LINKED_DEPENDS ${DEP} LINK_LIBRARIES)
1294-
if("${DEP}" MATCHES "sight::module_ui_qt" OR "${LINKED_DEPENDS}" MATCHES "Qml")
1295-
set(QML_SOURCE_DIR "${Qt5_DIR}/../../..$<$<CONFIG:Debug>:/debug>/qml")
1296-
break()
1297-
endif()
1298-
endforeach()
1299-
13001289
list(APPEND DEPENDS ${IMPORTED_DEPENDS})
13011290
list(REMOVE_DUPLICATES DEPENDS)
13021291
add_custom_target(
13031292
${APP}_install_plugins
13041293
${CMAKE_COMMAND}
13051294
-DDEPENDS="${DEPENDS}"
13061295
-DBUILD_TYPE=${CMAKE_BUILD_TYPE}
1307-
-DQT_PLUGINS_SOURCE_DIR="${Qt5_DIR}/../../..$<$<CONFIG:Debug>:/debug>/plugins"
1308-
-DQML_SOURCE_DIR="${QML_SOURCE_DIR}"
1296+
-DQT_PLUGINS_SOURCE_DIR="${Qt6_DIR}/../..$<$<CONFIG:Debug>:/debug>/Qt6/plugins"
13091297
-DQT_DESTINATION="${CMAKE_INSTALL_BINDIR}/.."
13101298
-DOGRE_PLUGIN_DIR="${OGRE_PLUGIN_DIR}"
13111299
-DCMAKE_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}"

cmake/build/sightConfig.cmake.in

+15-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ cmake_minimum_required (VERSION 3.18)
33
# Use new policy to use CMAKE_CXX_STANDARD in trysight_compile() macro
44
cmake_policy(SET CMP0067 NEW)
55

6+
if(${CMAKE_VERSION} VERSION_GREATER "3.31.0")
7+
# Use new policy for removed FindBoost module
8+
cmake_policy(SET CMP0167 NEW)
9+
# Use new policy for empty string variable after a single-value keyword
10+
cmake_policy(SET CMP0174 NEW)
11+
# Use new policy for normalized install() DESTINATION paths
12+
cmake_policy(SET CMP0177 NEW)
13+
endif()
14+
15+
# We need to find Qt6 before ITK/VTK, otherwise they find Qt5 and CMake fails with a cryptic
16+
# "Targets not yet defined: Qt::XXXXPrivate", even if we don't use ITK-Qt or VTK-Qt extensions
17+
if(UNIX)
18+
find_package(Qt6 CONFIG QUIET COMPONENTS Core Gui Widgets OpenGL)
19+
endif()
20+
621
set(FW_BUILD_EXTERNAL 1)
722

823
include(GNUInstallDirs)
@@ -37,7 +52,6 @@ if(NOT SIGHT_CONFIGURED)
3752
COPYONLY
3853
)
3954
endif()
40-
4155

4256
set(FW_INSTALL_PATH_SUFFIX "${PROJECT_NAME}")
4357
set(FWCONFIG_PACKAGE_LOCATION lib/cmake/${PROJECT_NAME})

cmake/install/windows/install_plugins.cmake

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@ cmake_policy(SET CMP0057 NEW)
22

33
include(GNUInstallDirs)
44

5-
# install all Qt5 plugins
5+
# install all Qt6 plugins
66
if(${DEPENDS} MATCHES "_qt")
77
message(STATUS "Install Qt plugins from '${QT_PLUGINS_SOURCE_DIR}'")
88
file(INSTALL DESTINATION ${CMAKE_INSTALL_PREFIX}/${QT_DESTINATION} TYPE DIRECTORY FILES ${QT_PLUGINS_SOURCE_DIR})
99
endif()
10-
if(QML_SOURCE_DIR)
11-
message(STATUS "Install Qml plugins from '${QML_SOURCE_DIR}'")
12-
file(INSTALL DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR} TYPE DIRECTORY FILES ${QML_SOURCE_DIR})
13-
endif()
1410

1511
if(${DEPENDS} MATCHES "viz_scene3d ")
1612
if("${BUILD_TYPE}" STREQUAL "Debug")

cmake/install/windows/windows_fixup.cmake.in

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ cmake_policy(SET CMP0053 NEW)
44

55
include(@FWCMAKE_INSTALL_FILES_DIR@/helper.cmake)
66

7-
# Find all *.dll in /bin, Qt5 plugins and Ogre plugins
7+
# Find all *.dll in /bin, Qt6 plugins and Ogre plugins
88
file(GLOB_RECURSE MODULES "@CMAKE_INSTALL_PREFIX@/@SIGHT_MODULE_LIB_PREFIX@/*@CMAKE_SHARED_LIBRARY_SUFFIX@")
99
file(GLOB_RECURSE QT_PLUGINS "@CMAKE_INSTALL_PREFIX@/plugins/*@CMAKE_SHARED_LIBRARY_SUFFIX@")
10-
file(GLOB_RECURSE QML_PLUGINS "@CMAKE_INSTALL_PREFIX@/qml/*@CMAKE_SHARED_LIBRARY_SUFFIX@")
1110
file(GLOB_RECURSE OGRE_PLUGINS "@CMAKE_INSTALL_PREFIX@/ogreplugins/*@CMAKE_SHARED_LIBRARY_SUFFIX@")
1211

1312
include(BundleUtilities)
1413

15-
list(APPEND LIBS ${MODULES} ${QT_PLUGINS} ${QML_PLUGINS} ${OGRE_PLUGINS})
14+
list(APPEND LIBS ${MODULES} ${QT_PLUGINS} ${OGRE_PLUGINS})
1615
# Also add modules from the SDK
1716
if(@FW_BUILD_EXTERNAL@)
1817

examples/core/ex_activities/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ add_dependencies(
2121
module_data
2222
)
2323

24-
# Allow dark theme via module_ui_qt
24+
# Allow noctura theme via module_ui_qt
2525
module_param(
26-
module_ui_qt PARAM_LIST resource stylesheet PARAM_VALUES sight::module::ui::qt/flatdark.rcc
27-
sight::module::ui::qt/flatdark.qss
26+
module_ui_qt PARAM_LIST resource stylesheet touch_friendly PARAM_VALUES sight::module::ui::qt/noctura.rcc
27+
sight::module::ui::qt/noctura.qss true
2828
)
2929

3030
# Main application's configuration to launch

examples/ui/ex_collapsible_section/CMakeLists.txt

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
sight_add_target(ex_collapsible_section TYPE APP)
22

3-
add_dependencies(ex_collapsible_section sightrun module_app module_ui module_ui_qt module_service)
4-
find_package(Qt5 QUIET COMPONENTS Core Gui Widgets REQUIRED)
5-
target_link_libraries(ex_collapsible_section PUBLIC ui Qt5::Core Qt5::Gui Qt5::Widgets)
3+
find_package(Qt6 QUIET COMPONENTS Widgets REQUIRED)
4+
target_link_libraries(${SIGHT_TARGET} PRIVATE Qt6::Widgets)
5+
set_target_properties(${SIGHT_TARGET} PROPERTIES AUTOMOC TRUE)
6+
target_compile_definitions(${SIGHT_TARGET} PUBLIC "QT_NO_KEYWORDS")
67

7-
target_link_libraries(ex_collapsible_section PUBLIC service ui_qt)
8+
target_link_libraries(${SIGHT_TARGET} PUBLIC service ui_qt)
9+
10+
add_dependencies(${SIGHT_TARGET} sightrun module_app module_ui module_ui_qt module_service)
811

912
# Main application's configuration to launch
1013
module_param(module_app PARAM_LIST config PARAM_VALUES ex_collapsible_section_app_cfg)

libs/__/activity/extension/activity.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/************************************************************************
22
*
3-
* Copyright (C) 2009-2024 IRCAD France
3+
* Copyright (C) 2009-2025 IRCAD France
44
* Copyright (C) 2012-2020 IHU Strasbourg
55
*
66
* This file is part of Sight.
@@ -84,9 +84,13 @@ activity_requirement::activity_requirement(const config_t& _config) :
8484
description(_config.get<std::string>("desc", "")),
8585
validator(_config.get<std::string>("validator", "")),
8686
min_occurs(_config.get<unsigned int>("<xmlattr>.minOccurs", 1)),
87-
max_occurs(_config.get<unsigned int>("<xmlattr>.maxOccurs", 1)),
88-
object_config(_config.get_child("config", config_t()))
87+
max_occurs(_config.get<unsigned int>("<xmlattr>.maxOccurs", 1))
8988
{
89+
if(const auto& optional = _config.get_child_optional("config"); optional)
90+
{
91+
object_config = *optional;
92+
}
93+
9094
for(const auto& v : boost::make_iterator_range(_config.equal_range("key")))
9195
{
9296
keys.emplace_back(v.second);

0 commit comments

Comments
 (0)