Skip to content

Commit

Permalink
properly detect and enable Qt6 WebEngine integration
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <[email protected]>
  • Loading branch information
mgallien committed Aug 26, 2024
1 parent 4233ea6 commit b574a16
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
6 changes: 1 addition & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,7 @@ if(BUILD_CLIENT)
endif()
endif()

if (APPLE)
option(BUILD_WITH_WEBENGINE "BUILD_WITH_WEBENGINE" OFF)
else ()
option(BUILD_WITH_WEBENGINE "BUILD_WITH_WEBENGINE" ON)
endif()
option(BUILD_WITH_WEBENGINE "BUILD_WITH_WEBENGINE" ON)

if (NOT DEFINED APPLICATION_ICON_NAME)
set(APPLICATION_ICON_NAME ${APPLICATION_SHORTNAME})
Expand Down
33 changes: 18 additions & 15 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include(ECMEnableSanitizers)

set(REQUIRED_QT_VERSION "5.15.0")
set(REQUIRED_QT_VERSION "6.5.0")

find_package(Qt${QT_MAJOR_VERSION}Core ${REQUIRED_QT_VERSION} CONFIG QUIET)
set_package_properties(Qt${QT_MAJOR_VERSION}Core PROPERTIES
Expand Down Expand Up @@ -38,34 +38,37 @@ find_package(Qt${QT_VERSION_MAJOR}Core5Compat ${REQUIRED_QT_VERSION} CONFIG QUIE
TYPE REQUIRED
)

find_package(Qt${QT_MAJOR_VERSION}WebEngineWidgets ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(NOT BUILD_WITH_WEBENGINE)
set_package_properties(Qt${QT_MAJOR_VERSION}WebEngineWidgets PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} WebEngineWidgets component."
find_package(Qt${QT_VERSION_MAJOR}WebEngineCore ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(APPLE)
set_package_properties(Qt${QT_VERSION_MAJOR}WebEngineCore PROPERTIES
DESCRIPTION "Qt${QT_VERSION_MAJOR} WebEngineCore component."
TYPE RECOMMENDED
)
else()
set_package_properties(Qt${QT_MAJOR_VERSION}WebEngineWidgets PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} WebEngineWidgets component."
set_package_properties(Qt${QT_VERSION_MAJOR}WebEngineCore PROPERTIES
DESCRIPTION "Qt${QT_VERSION_MAJOR} WebEngine component."
TYPE REQUIRED
)
endif()

find_package(Qt${QT_VERSION_MAJOR}WebEngineCore ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(APPLE)
set_package_properties(Qt${QT_VERSION_MAJOR}WebEngineCore PROPERTIES
DESCRIPTION "Qt${QT_VERSION_MAJOR} WebEngineCore component."
find_package(Qt${QT_MAJOR_VERSION}WebEngineWidgets ${REQUIRED_QT_VERSION} CONFIG QUIET)
if(NOT BUILD_WITH_WEBENGINE)
set_package_properties(Qt${QT_MAJOR_VERSION}WebEngineWidgets PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} WebEngineWidgets component."
TYPE RECOMMENDED
)
else()
set_package_properties(Qt${QT_VERSION_MAJOR}WebEngine PROPERTIES
DESCRIPTION "Qt${QT_VERSION_MAJOR} WebEngine component."
set_package_properties(Qt${QT_MAJOR_VERSION}WebEngineWidgets PROPERTIES
DESCRIPTION "Qt${QT_MAJOR_VERSION} WebEngineWidgets component."
TYPE REQUIRED
)
endif()

if(Qt${QT_MAJOR_VERSION}WebEngine_FOUND AND Qt${QT_MAJOR_VERSION}WebEngineWidgets_FOUND)
add_compile_definitions(WITH_WEBENGINE=1)
if(Qt${QT_MAJOR_VERSION}WebEngineCore_FOUND AND Qt${QT_MAJOR_VERSION}WebEngineWidgets_FOUND)
message(STATUS "Enable use of Qt6 WebEngine module")
add_compile_definitions(WITH_WEBENGINE=1)
else()
message(STATUS "Disable use of Qt6 WebEngine module")
endif()

get_target_property (QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
Expand Down

0 comments on commit b574a16

Please sign in to comment.