From a72c7ed149f18db6c93c3d7f7257c5e62f3cf004 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Fri, 19 Jun 2020 18:06:09 +0200 Subject: [PATCH] Add qt quick compiler and fix windows cmd opening in release --- ScreenPlay/CMakeLists.txt | 15 ++++++++++++++- ScreenPlayWallpaper/CMakeLists.txt | 11 +++++++++++ ScreenPlayWidget/CMakeLists.txt | 11 +++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 21adcbf8..4defa638 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -8,7 +8,7 @@ set(CMAKE_AUTOMOC ON) find_package( Qt5 COMPONENTS Quick - QML + QuickCompiler Widgets Gui WebEngine @@ -58,10 +58,23 @@ set(headers app.h src/util.h src/create.h) + + + + set(resources Resources.qrc) +if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + qtquick_compiler_add_resources(${resources}) +endif() + + add_executable(${PROJECT_NAME} ${src} ${headers} ${resources}) +# Disable console window on Windows +# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows +set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true) + target_compile_definitions(${PROJECT_NAME} PRIVATE "GIT_VERSION=${GIT_VERSION}") target_link_libraries(${PROJECT_NAME} diff --git a/ScreenPlayWallpaper/CMakeLists.txt b/ScreenPlayWallpaper/CMakeLists.txt index 552a3122..0c505e1f 100644 --- a/ScreenPlayWallpaper/CMakeLists.txt +++ b/ScreenPlayWallpaper/CMakeLists.txt @@ -10,6 +10,7 @@ find_package( Widgets Gui WebEngine + QuickCompiler REQUIRED) @@ -43,8 +44,18 @@ set( headers src/basewindow.h) set(resources SPWResources.qrc) + +if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + qtquick_compiler_add_resources(${resources}) +endif() + + add_executable(${PROJECT_NAME} ${src} ${headers} ${src_plattform} ${headers_plattform} ${resources}) +# Disable console window on Windows +# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows +set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true) + target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick diff --git a/ScreenPlayWidget/CMakeLists.txt b/ScreenPlayWidget/CMakeLists.txt index 5563c1da..8c17eb7f 100644 --- a/ScreenPlayWidget/CMakeLists.txt +++ b/ScreenPlayWidget/CMakeLists.txt @@ -8,6 +8,7 @@ find_package( COMPONENTS Quick Widgets Gui + QuickCompiler WebEngine REQUIRED) @@ -20,8 +21,18 @@ set(headers set(resources SPWidgetResources.qrc) +if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + qtquick_compiler_add_resources(${resources}) +endif() + + add_executable(${PROJECT_NAME} ${src} ${headers} ${resources}) +# Disable console window on Windows +# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows +set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true) + + target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Quick