cMake: Add support for compiling against Qt6 (#7647)

Removes the BUILD_QT5 flag and adds a new FREECAD_QT_VERSION option,
which can be set to either "Auto" (default), 5, or 6. Auto detects which
version of Qt is installed on the system and chooses it. If both version
are installed, Qt5 is used.

Note that this DOES NOT implement compiling against Qt6, it only adds
the necessary cMake infrastructure to begin work on the source code
changes that will be required.
This commit is contained in:
Chris Hennes
2022-10-31 09:24:09 -05:00
committed by GitHub
parent b64d987ac1
commit 1fac3fead0
37 changed files with 595 additions and 662 deletions

View File

@@ -26,21 +26,22 @@ set(TechDrawLIBS
Import
)
if(BUILD_QT5)
if(FREECAD_QT_MAJOR_VERSION EQUAL 5)
include_directories(
${Qt5XmlPatterns_INCLUDE_DIRS}
${Qt5Concurrent_INCLUDE_DIRS}
${QtXmlPatterns_INCLUDE_DIRS}
)
set(QtXmlPatternsLib ${Qt5XmlPatterns_LIBRARIES})
list(APPEND TechDrawLIBS
${Qt5Concurrent_LIBRARIES}
)
else(BUILD_QT5)
include_directories(
${QT_QTXMLPATTERNS_INCLUDE_DIR}
)
set(QtXmlPatternsLib ${QT_QTXMLPATTERNS_LIBRARY})
endif(BUILD_QT5)
else()
# This is deprecated as of Qt 5.13, and removed in Qt 6
message(WARNING "TechDraw relies on the now-removed Qt XMLPatterns package, and must be refactored to compile against Qt6.")
endif()
include_directories(
${QtConcurrent_INCLUDE_DIRS}
)
set(QtXmlPatternsLib ${QtXmlPatterns_LIBRARIES})
list(APPEND TechDrawLIBS
${QtConcurrent_LIBRARIES}
)
link_directories(${OCC_LIBRARY_DIR})

View File

@@ -26,15 +26,14 @@ include_directories(
${XercesC_INCLUDE_DIRS}
)
if(BUILD_QT5)
if(FREECAD_QT_MAJOR_VERSION EQUAL 5)
include_directories(
${Qt5XmlPatterns_INCLUDE_DIRS}
${QtXmlPatterns_INCLUDE_DIRS}
)
else(BUILD_QT5)
include_directories(
${QT_QTXMLPATTERNS_INCLUDE_DIR}
)
endif(BUILD_QT5)
else()
# This is deprecated as of Qt 5.13, and removed in Qt 6
message(WARNING "TechDraw relies on the now-removed Qt XMLPatterns package, and must be refactored to compile against Qt6.")
endif()
# The XML files
set(TechDrawGui_XML_SRCS
@@ -47,11 +46,7 @@ set(TechDrawGui_LIBS
FreeCADGui
)
if(BUILD_QT5)
qt5_add_resources(TechDrawGui_SRCS Resources/TechDraw.qrc)
else()
qt4_add_resources(TechDrawGui_SRCS Resources/TechDraw.qrc)
endif()
qt_add_resources(TechDrawGui_SRCS Resources/TechDraw.qrc)
set(TechDrawGui_UIC_SRCS
DlgPageChooser.ui
@@ -90,12 +85,6 @@ set(TechDrawGui_UIC_SRCS
TaskComplexSection.ui
)
if(BUILD_QT5)
qt5_wrap_ui(TechDrawGui_UIC_HDRS ${TechDrawGui_UIC_SRCS})
else()
qt4_wrap_ui(TechDrawGui_UIC_HDRS ${TechDrawGui_UIC_SRCS})
endif()
SET(MRTE_SRCS
mrichtextedit.ui
mrichtextedit.cpp