Initial support for compilation on Qt6

This commit is contained in:
Sigurd Pettersen 2024-01-12 10:52:34 +01:00
parent 5993914276
commit 0dccff3867
4 changed files with 32 additions and 16 deletions

View File

@ -53,7 +53,8 @@ add_subdirectory(LibUtilities)
option(CEE_BUILD_GUI_QT "Build GUI library for Qt" ON)
if (CEE_BUILD_GUI_QT)
option(CEE_USE_QT5 "Use Qt5" ON)
option(CEE_USE_QT6 "Use Qt6" OFF)
option(CEE_USE_QT5 "Use Qt5" OFF)
add_subdirectory(LibGuiQt)
endif()
@ -77,9 +78,11 @@ if (CEE_BUILD_TEST_APPS)
add_subdirectory(Tests/SnippetsBasis)
if (CEE_BUILD_GUI_QT)
add_subdirectory(TestApps/Qt/QtMinimal_deprecated)
add_subdirectory(TestApps/Qt/QtMultiView_deprecated)
add_subdirectory(TestApps/Qt/QtSnippetRunner)
if (CEE_USE_QT5)
add_subdirectory(TestApps/Qt/QtMinimal_deprecated)
add_subdirectory(TestApps/Qt/QtMultiView_deprecated)
add_subdirectory(TestApps/Qt/QtSnippetRunner)
endif()
endif()
if (WIN32)

View File

@ -15,31 +15,43 @@ endif()
find_package(OpenGL)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets OpenGL)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
if (CEE_USE_QT6)
find_package(Qt6 COMPONENTS REQUIRED Core Gui Widgets OpenGLWidgets)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets )
elseif (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets OpenGL)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
else()
message(FATAL_ERROR "No supported Qt version selected for build")
endif()
set(CEE_HEADER_FILES
cvfqtBasicAboutDialog.h
cvfqtGLWidget.h
cvfqtMouseState.h
cvfqtOpenGLWidget.h
cvfqtPerformanceInfoHud.h
cvfqtUtils.h
cvfqtCvfBoundQGLContext_deprecated.h
cvfqtGLWidget_deprecated.h
)
set(CEE_SOURCE_FILES
cvfqtBasicAboutDialog.cpp
cvfqtGLWidget.cpp
cvfqtMouseState.cpp
cvfqtOpenGLWidget.cpp
cvfqtPerformanceInfoHud.cpp
cvfqtUtils.cpp
cvfqtCvfBoundQGLContext_deprecated.cpp
cvfqtGLWidget_deprecated.cpp
)
if (CEE_USE_QT5)
set(CEE_HEADER_FILES ${CEE_HEADER_FILES} cvfqtGLWidget.h)
set(CEE_SOURCE_FILES ${CEE_SOURCE_FILES} cvfqtGLWidget.cpp)
set(CEE_HEADER_FILES ${CEE_HEADER_FILES} cvfqtCvfBoundQGLContext_deprecated.h)
set(CEE_SOURCE_FILES ${CEE_SOURCE_FILES} cvfqtCvfBoundQGLContext_deprecated.cpp)
set(CEE_HEADER_FILES ${CEE_HEADER_FILES} cvfqtGLWidget_deprecated.h)
set(CEE_SOURCE_FILES ${CEE_SOURCE_FILES} cvfqtGLWidget_deprecated.cpp)
endif()
add_library(${PROJECT_NAME} ${CEE_HEADER_FILES} ${CEE_SOURCE_FILES})

View File

@ -255,8 +255,7 @@ void BasicAboutDialog::create()
// Library version
if (m_showLibraryVersion)
{
QString ver;
ver.sprintf("%s.%s%s-%s", CVF_MAJOR_VERSION, CVF_MINOR_VERSION, CVF_SPECIAL_BUILD, CVF_BUILD_NUMBER);
QString ver = QString("%1.%2%3-%4").arg(CVF_MAJOR_VERSION).arg(CVF_MINOR_VERSION).arg(CVF_SPECIAL_BUILD).arg(CVF_BUILD_NUMBER);
addStringPairToVerInfoLayout("Library ver.: ", ver, verInfoLayout, insertRow++);
}

View File

@ -4,8 +4,10 @@ project(LibGuiQt_UnitTests)
find_package(OpenGL)
# Qt
if (CEE_USE_QT5)
if (CEE_USE_QT6)
find_package(Qt6 COMPONENTS REQUIRED Core Gui Widgets OpenGLWidgets)
set(QT_LIBRARIES Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets )
elseif (CEE_USE_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets OpenGL)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
else()