From 0ab4e2e42fb79c45f65849950272d37ab54f80a3 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Fri, 25 Jun 2021 12:06:43 +0200 Subject: [PATCH] Fix Qt 5 compilation --- ScreenPlay/CMakeLists.txt | 5 +++-- ScreenPlay/main.cpp | 3 ++- ScreenPlayWallpaper/CMakeLists.txt | 6 +++--- ScreenPlayWallpaper/main.cpp | 3 ++- ScreenPlayWidget/CMakeLists.txt | 6 +++--- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 53eb6952..fcbf9871 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -6,12 +6,12 @@ set(CMAKE_AUTOMOC ON) find_package( QT NAMES Qt6 Qt5 - COMPONENTS Quick Widgets Gui LinguistTools WebSockets + COMPONENTS Quick Widgets Gui LinguistTools WebSockets WebEngine QuickCompiler REQUIRED) find_package( Qt${QT_VERSION_MAJOR} - COMPONENTS Quick Widgets Gui LinguistTools WebSockets + COMPONENTS Quick Widgets Gui LinguistTools WebSockets WebEngine QuickCompiler REQUIRED) message(STATUS "[PROJECT] QT_VERSION_MAJOR = ${QT_VERSION_MAJOR}") @@ -106,6 +106,7 @@ target_link_libraries( Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::WebSockets + Qt${QT_VERSION_MAJOR}::WebEngine ScreenPlaySDK ScreenPlayUtil benchmark::benchmark diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index 2808d062..4062c117 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #ifdef Q_OS_WIN #include #endif @@ -45,7 +46,7 @@ int main(int argc, char* argv[]) { - + QtWebEngine::initialize(); QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); diff --git a/ScreenPlayWallpaper/CMakeLists.txt b/ScreenPlayWallpaper/CMakeLists.txt index c16aee18..024ee309 100644 --- a/ScreenPlayWallpaper/CMakeLists.txt +++ b/ScreenPlayWallpaper/CMakeLists.txt @@ -5,11 +5,11 @@ set(CMAKE_AUTORCC ON) set(CMAKE_AUTOMOC ON) find_package( QT NAMES Qt6 Qt5 - COMPONENTS Quick Widgets Gui + COMPONENTS Quick Widgets Gui WebEngine QuickCompiler REQUIRED) find_package( Qt${QT_VERSION_MAJOR} - COMPONENTS Quick Widgets Gui WebEngine + COMPONENTS Quick Widgets Gui WebEngine QuickCompiler REQUIRED) if(WIN32) @@ -27,7 +27,7 @@ set(src main.cpp src/basewindow.cpp) set(headers src/basewindow.h) if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - set(resources SPWResources.qrc) + qt_add_resources(resources SPWResources.qrc) else() qtquick_compiler_add_resources(resources SPWResources.qrc) endif() diff --git a/ScreenPlayWallpaper/main.cpp b/ScreenPlayWallpaper/main.cpp index 5e4414cd..2227a9d2 100644 --- a/ScreenPlayWallpaper/main.cpp +++ b/ScreenPlayWallpaper/main.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include "ScreenPlayUtil/util.h" @@ -19,6 +19,7 @@ int main(int argc, char* argv[]) { //QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); + QtWebEngine::initialize(); QApplication app(argc, argv); diff --git a/ScreenPlayWidget/CMakeLists.txt b/ScreenPlayWidget/CMakeLists.txt index dd21044f..14376f4a 100644 --- a/ScreenPlayWidget/CMakeLists.txt +++ b/ScreenPlayWidget/CMakeLists.txt @@ -5,11 +5,11 @@ set(CMAKE_AUTORCC ON) set(CMAKE_AUTOMOC ON) find_package( QT NAMES Qt6 Qt5 - COMPONENTS Quick Widgets Gui + COMPONENTS Quick Widgets Gui WebEngine QuickCompiler REQUIRED) find_package( Qt${QT_VERSION_MAJOR} - COMPONENTS Quick Widgets Gui WebEngine + COMPONENTS Quick Widgets Gui WebEngine QuickCompiler REQUIRED) set(src main.cpp src/widgetwindow.cpp) @@ -17,7 +17,7 @@ set(src main.cpp src/widgetwindow.cpp) set(headers src/widgetwindow.h) if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - set(resources SPWidgetResources.qrc) + qt_add_resources(resources SPWidgetResources.qrc) else() qtquick_compiler_add_resources(resources SPWidgetResources.qrc) endif()