From 37ba2693117f6fdcf04079c24e0f4361b856c704 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Wed, 20 Jul 2022 13:06:31 +0200 Subject: [PATCH] add option to forcibly bundle icon themes, enable for appimage build --- CMakeLists.txt | 2 ++ resources/desktop/com.github.rssguard.appdata.xml | 2 +- .../scripts/github-actions/build-linux-mac.sh | 2 +- src/librssguard/CMakeLists.txt | 14 ++++++++++++-- src/librssguard/definitions/definitions.h | 7 ++++++- 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e77c0fb8f..8463f31ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ # BUILD_WITH_QT6 - Build either with Qt 6 or Qt 5. # NO_UPDATE_CHECK - Disable automatic checking for new application updates. # IS_FLATPAK_BUILD - Set to "ON" when building RSS Guard with Flatpak. +# FORCE_BUNDLE_ICONS - Forcibly bundles icons into executables. # USE_WEBENGINE - if specified, then QtWebEngine module for internal web browser is used. # Otherwise simple text component is used and some features will be disabled. # Default value is "false". If QtWebEngine is installed during compilation, then @@ -110,6 +111,7 @@ option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GCC/Clang only) option(REVISION_FROM_GIT "Get revision using `git rev-parse`" ON) option(NO_UPDATE_CHECK "Disable automatic checking for new application updates" OFF) option(IS_FLATPAK_BUILD "Set to 'ON' when building RSS Guard with Flatpak." OFF) +option(FORCE_BUNDLE_ICONS "Forcibly bundle icon themes into RSS Guard." OFF) # Import Qt libraries. set(QT6_MIN_VERSION 6.3.0) diff --git a/resources/desktop/com.github.rssguard.appdata.xml b/resources/desktop/com.github.rssguard.appdata.xml index 19bb614e4..0fce873e9 100644 --- a/resources/desktop/com.github.rssguard.appdata.xml +++ b/resources/desktop/com.github.rssguard.appdata.xml @@ -26,7 +26,7 @@ https://github.com/sponsors/martinrotter - + none diff --git a/resources/scripts/github-actions/build-linux-mac.sh b/resources/scripts/github-actions/build-linux-mac.sh index 327b99eb7..bc945a9a9 100755 --- a/resources/scripts/github-actions/build-linux-mac.sh +++ b/resources/scripts/github-actions/build-linux-mac.sh @@ -54,7 +54,7 @@ git_tag=$(git describe --tags $(git rev-list --tags --max-count=1)) git_revision=$(git rev-parse --short HEAD) mkdir rssguard-build && cd rssguard-build -cmake .. -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_BUILD_TYPE="MinSizeRel" -DCMAKE_INSTALL_PREFIX="$prefix" -DREVISION_FROM_GIT="ON" -DBUILD_WITH_QT6="$BUILD_WITH_QT6" -DUSE_WEBENGINE="$webengine" -DFEEDLY_CLIENT_ID="$FEEDLY_CLIENT_ID" -DFEEDLY_CLIENT_SECRET="$FEEDLY_CLIENT_SECRET" -DGMAIL_CLIENT_ID="$GMAIL_CLIENT_ID" -DGMAIL_CLIENT_SECRET="$GMAIL_CLIENT_SECRET" -DINOREADER_CLIENT_ID="$INOREADER_CLIENT_ID" -DINOREADER_CLIENT_SECRET="$INOREADER_CLIENT_SECRET" +cmake .. -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DFORCE_BUNDLE_ICONS="ON" -DCMAKE_BUILD_TYPE="MinSizeRel" -DCMAKE_INSTALL_PREFIX="$prefix" -DREVISION_FROM_GIT="ON" -DBUILD_WITH_QT6="$BUILD_WITH_QT6" -DUSE_WEBENGINE="$webengine" -DFEEDLY_CLIENT_ID="$FEEDLY_CLIENT_ID" -DFEEDLY_CLIENT_SECRET="$FEEDLY_CLIENT_SECRET" -DGMAIL_CLIENT_ID="$GMAIL_CLIENT_ID" -DGMAIL_CLIENT_SECRET="$GMAIL_CLIENT_SECRET" -DINOREADER_CLIENT_ID="$INOREADER_CLIENT_ID" -DINOREADER_CLIENT_SECRET="$INOREADER_CLIENT_SECRET" cmake --build . cmake --install . --prefix "$prefix" diff --git a/src/librssguard/CMakeLists.txt b/src/librssguard/CMakeLists.txt index d6f57f79b..6a7ea25f4 100644 --- a/src/librssguard/CMakeLists.txt +++ b/src/librssguard/CMakeLists.txt @@ -517,8 +517,7 @@ set(GMAIL_CLIENT_SECRET "" CACHE STRING "GMail client secret") set(INOREADER_CLIENT_ID "" CACHE STRING "Inoreader client ID") set(INOREADER_CLIENT_SECRET "" CACHE STRING "Inoreader client secret") -# Bundle icons on some platforms which do not provide system-wide icon themes. -if(APPLE OR WIN32 OR OS2) +if(APPLE OR WIN32 OR OS2 OR FORCE_BUNDLE_ICONS) qt_add_resources(SOURCES ${CMAKE_SOURCE_DIR}/resources/icons.qrc) endif() @@ -530,6 +529,17 @@ endif() add_library(rssguard SHARED ${SOURCES} ${QM_FILES}) +# Bundle icons on some platforms which do not provide system-wide icon themes. +if(FORCE_BUNDLE_ICONS) + target_compile_definitions(rssguard + PRIVATE + + FORCE_BUNDLE_ICONS + ) + + message(STATUS "Forcibly bundling icon themes.") +endif() + # Add OAuth services definitions. if(NOT FEEDLY_CLIENT_ID STREQUAL "" AND NOT FEEDLY_CLIENT_SECRET STREQUAL "") target_compile_definitions(rssguard diff --git a/src/librssguard/definitions/definitions.h b/src/librssguard/definitions/definitions.h index fe00d12a8..0670b7f04 100644 --- a/src/librssguard/definitions/definitions.h +++ b/src/librssguard/definitions/definitions.h @@ -217,9 +217,14 @@ #define APP_SKIN_METADATA_FILE "metadata.xml" #define APP_STYLE_DEFAULT "Fusion" -#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) +#if defined(FORCE_BUNDLE_ICONS) +// Forcibly bundle icons. +#define APP_THEME_DEFAULT "Breeze" +#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) +// DO NOT icons on Linux. #define APP_THEME_DEFAULT "" #else +// Bundle icons otherwise. #define APP_THEME_DEFAULT "Breeze" #endif