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

@@ -7,20 +7,13 @@ include_directories(
${ZLIB_INCLUDE_DIR}
)
if(BUILD_QT5)
include_directories(
${Qt5Network_INCLUDE_DIRS}
)
set(Web_LIBS
FreeCADApp
${Qt5Network_LIBRARIES}
)
else()
set(Web_LIBS
FreeCADApp
${QT_LIBRARIES}
)
endif()
include_directories(
${QtNetwork_INCLUDE_DIRS}
)
set(Web_LIBS
FreeCADApp
${QtNetwork_LIBRARIES}
)
SET(Web_SRCS
AppWeb.cpp

View File

@@ -7,7 +7,7 @@ set(Web_Scripts
)
if(BUILD_GUI)
if(Qt5WebEngineWidgets_FOUND OR Qt5WebKitWidgets_FOUND OR QT_QTWEBKIT_FOUND)
if(QtWebEngineWidgets_FOUND)
add_subdirectory(Gui)
list (APPEND Web_Scripts InitGui.py)
endif()

View File

@@ -7,28 +7,17 @@ include_directories(
${XercesC_INCLUDE_DIRS}
)
if (Qt5WebEngineWidgets_FOUND)
if (QtWebEngineWidgets_FOUND)
add_definitions(-DQTWEBENGINE)
elseif(Qt5WebKitWidgets_FOUND OR QT_QTWEBKIT_FOUND) # Qt5 and Qt4
add_definitions(-DQTWEBKIT)
endif()
set(WebGui_LIBS
FreeCADGui
)
if(BUILD_QT5)
if(Qt5WebEngineWidgets_FOUND)
include_directories(${Qt5WebEngineWidgets_INCLUDE_DIRS})
list(APPEND WebGui_LIBS ${Qt5WebEngineWidgets_LIBRARIES})
else()
include_directories(${Qt5WebKitWidgets_INCLUDE_DIRS})
list(APPEND WebGui_LIBS ${Qt5WebKitWidgets_LIBRARIES})
endif()
qt5_add_resources(Web_QRC_SRCS Resources/Web.qrc)
else()
qt4_add_resources(Web_QRC_SRCS Resources/Web.qrc)
endif()
include_directories(${QtWebEngineWidgets_INCLUDE_DIRS})
list(APPEND WebGui_LIBS ${QtWebEngineWidgets_LIBRARIES})
qt_add_resources(Web_QRC_SRCS Resources/Web.qrc)
SET(WebGui_SRCS
${Web_QRC_SRCS}
@@ -40,8 +29,8 @@ SET(WebGui_SRCS
Workbench.h
BrowserView.h
BrowserView.cpp
CookieJar.cpp # QWebkit only
CookieJar.h # QWebkit only
CookieJar.cpp
CookieJar.h
)
SET(WebGuiIcon_SVG