From e2652fc2a961a20bb7463c62e49dae69f6b958ef Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Fri, 24 Feb 2023 10:03:10 +0800 Subject: [PATCH] cmake: minor tweaks Fixes: #205 Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- CMakeLists.txt | 26 ++++++++++++++++++++------ src/core/framelessmanager.cpp | 7 +------ src/core/utils.cpp | 4 ---- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d80d883..076e375 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ option(FRAMELESSHELPER_ENABLE_CFGUARD "Enable Control Flow Guard (CFG)." ON) option(FRAMELESSHELPER_EXAMPLES_STANDALONE "Build the demo projects as standalone CMake projects." OFF) if(FRAMELESSHELPER_NO_BUNDLE_RESOURCE) - message(WARNING "Nothing will be embeded into FramelessHelper, the chrome buttons will have no icon.") + message(WARNING "Nothing will be embeded into the FramelessHelper library, the chrome buttons will have no icon.") endif() if(FRAMELESSHELPER_ENABLE_VCLTL AND NOT MSVC) @@ -81,6 +81,16 @@ get_commit_hash(RESULT PROJECT_VERSION_COMMIT) set(PROJECT_COMPILE_DATETIME "UNKNOWN") string(TIMESTAMP PROJECT_COMPILE_DATETIME UTC) +if(MINGW AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + message(WARNING "Your current toolchain is not officially supported by FramelessHelper.\n" + "Only LLVM-MinGW (https://github.com/mstorsjo/llvm-mingw) has partial support.") + set(FRAMELESSHELPER_ENABLE_SPECTRE OFF) + set(FRAMELESSHELPER_ENABLE_EHCONTGUARD OFF) + set(FRAMELESSHELPER_ENABLE_INTELCET OFF) + set(FRAMELESSHELPER_ENABLE_INTELJCC OFF) + set(FRAMELESSHELPER_ENABLE_CFGUARD OFF) +endif() + if(MSVC) if(FRAMELESSHELPER_ENABLE_VCLTL) include(cmake/VC-LTL.cmake) @@ -129,8 +139,8 @@ if(FRAMELESSHELPER_BUILD_EXAMPLES) endif() if(NOT FRAMELESSHELPER_NO_SUMMARY) - message("--------------------------- Compiler ----------------------------") - message("CMake version: ${CMAKE_VERSION}") + message("--------------------------- Toolchain ----------------------------") + message("CMake version: ${CMAKE_VERSION} (${CMAKE_COMMAND})") message("Host system: ${CMAKE_HOST_SYSTEM}") message("Host processor: ${CMAKE_HOST_SYSTEM_PROCESSOR}") #message("C compiler: ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER})") # Currently we are not using any C compilers. @@ -139,8 +149,12 @@ if(NOT FRAMELESSHELPER_NO_SUMMARY) message("C++ compiler version: ${CMAKE_CXX_COMPILER_VERSION}") message("Linker: ${CMAKE_LINKER}") message("Make program: ${CMAKE_MAKE_PROGRAM}") + message("Generator: ${CMAKE_GENERATOR}") message("Build type: ${CMAKE_BUILD_TYPE}") + message("Configuration types: ${CMAKE_CONFIGURATION_TYPES}") message("Install prefix: ${CMAKE_INSTALL_PREFIX}") + message("Prefix paths: ${CMAKE_PREFIX_PATH}") + message("Toolchain file: ${CMAKE_TOOLCHAIN_FILE}") message("------------------------------ Qt -------------------------------") set(__qt_inst_dir) if(DEFINED Qt6_DIR) @@ -152,15 +166,15 @@ if(NOT FRAMELESSHELPER_NO_SUMMARY) cmake_path(GET __qt_inst_dir PARENT_PATH __qt_inst_dir) cmake_path(GET __qt_inst_dir PARENT_PATH __qt_inst_dir) cmake_path(GET __qt_inst_dir PARENT_PATH __qt_inst_dir) - message("Qt install dir: ${__qt_inst_dir}") - message("Qt version: ${QT_VERSION}") + message("Qt SDK installation directory: ${__qt_inst_dir}") + message("Qt SDK version: ${QT_VERSION}") get_target_property(__qt_type Qt${QT_VERSION_MAJOR}::Core TYPE) if(__qt_type STREQUAL "STATIC_LIBRARY") set(__qt_type static) else() set(__qt_type shared) endif() - message("Qt library type: ${__qt_type}") + message("Qt SDK library type: ${__qt_type}") message("------------------------ FramelessHelper ------------------------") message("FramelessHelper version: ${PROJECT_VERSION}") message("FramelessHelper commit hash: ${PROJECT_VERSION_COMMIT}") diff --git a/src/core/framelessmanager.cpp b/src/core/framelessmanager.cpp index 3c6f715..3f6e3c7 100644 --- a/src/core/framelessmanager.cpp +++ b/src/core/framelessmanager.cpp @@ -344,12 +344,7 @@ void FramelessManagerPrivate::initialize() QStyleHints * const styleHints = QGuiApplication::styleHints(); Q_ASSERT(styleHints); if (styleHints) { -#if 0 // Unreleased 6.5 change. - connect(styleHints, &QStyleHints::colorSchemeChanged, this, [this](const Qt::ColorScheme colorScheme) -#else - connect(styleHints, &QStyleHints::appearanceChanged, this, [this](const Qt::Appearance colorScheme) -#endif - { + connect(styleHints, &QStyleHints::colorSchemeChanged, this, [this](const Qt::ColorScheme colorScheme){ Q_UNUSED(colorScheme); notifySystemThemeHasChangedOrNot(); }); diff --git a/src/core/utils.cpp b/src/core/utils.cpp index fb7278a..35316bc 100644 --- a/src/core/utils.cpp +++ b/src/core/utils.cpp @@ -282,11 +282,7 @@ QColor Utils::calculateSystemButtonBackgroundColor(const SystemButtonType button bool Utils::shouldAppsUseDarkMode() { #if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) -#if 0 // Unreleased 6.5 change. return (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark); -#else - return (QGuiApplication::styleHints()->appearance() == Qt::Appearance::Dark); -#endif #elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && !defined(FRAMELESSHELPER_CORE_NO_PRIVATE)) if (const QPlatformTheme * const theme = QGuiApplicationPrivate::platformTheme()) { return (theme->appearance() == QPlatformTheme::Appearance::Dark);