cmake: Clean up icon-related build options
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 5 Jun 2018 21:20:58 +0000 (23:20 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 15 Jun 2018 23:30:32 +0000 (01:30 +0200)
Remove -DWITH_BREEZE, -DWITH_BREEZE_DARK and -DWITH_OXYGEN options
from CMake. Instead, provide two new options that should make things
a bit clearer:

-DWITH_BUNDLED_ICONS now controls if bundled icon themes should be
    installed/embedded. Defaults to ON to ensure that required
    icons are available unless explicitly disabled (e.g. by a
    package maintainer, who should then make sure that a dependency
    to Breeze/Oxygen exists).
    Disabling this option saves less than 2 MB of disk space.

-DWITH_OXYGEN_ICONS controls whether the Oxygen icon theme should
    still be supported. This affects both the Oxygen-themed
    Quassel-specific icons and the bundled icon theme. Defaults to
    OFF when building against Qt5, ON for Qt4.

Adapt code accordingly, and update INSTALL.

CMakeLists.txt
INSTALL
icons/CMakeLists.txt
src/common/main.cpp

index 946b677..5668fcf 100644 (file)
@@ -71,23 +71,19 @@ else()
     add_feature_info(WITH_KDE WITH_KDE "Integrate with the KDE Frameworks runtime environment")
 endif()
 
-cmake_dependent_option(WITH_BREEZE "Install Breeze icon theme (usually shipped with KDE)" ON "NOT WITH_KDE" OFF)
-cmake_dependent_option(WITH_BREEZE_DARK "Install Dark Breeze icon theme (usually shipped with KDE)" ON "NOT WITH_KDE" OFF)
-cmake_dependent_option(WITH_OXYGEN "Install Oxygen icon theme (usually shipped with KDE)" OFF "NOT WITH_KDE" OFF)
-if (NOT WITH_KDE)
-    add_feature_info(WITH_BREEZE WITH_BREEZE "Install Breeze icon theme")
-    add_feature_info(WITH_BREEZE_DARK WITH_BREEZE_DARK "Install Dark Breeze icon theme")
-    add_feature_info(WITH_OXYGEN WITH_OXYGEN "Install Oxygen icon theme")
-endif()
+# Icon theme support. By default, install the Breeze icon theme (may be disabled if a system installation is present)
+option(WITH_BUNDLED_ICONS "Install required icons from the Breeze icon theme" ON)
+add_feature_info(WITH_BUNDLED_ICONS WITH_BUNDLED_ICONS "Install required icons from the Breeze icon theme")
 
-if (WITH_OXYGEN)
-    add_definitions(-DWITH_OXYGEN)
-endif()
-if (WITH_BREEZE)
-    add_definitions(-DWITH_BREEZE)
+# For Qt4, always support Oxygen
+cmake_dependent_option(WITH_OXYGEN_ICONS "Support the Oxygen icon theme (KDE4)" OFF "USE_QT5" ON)
+add_feature_info(WITH_OXYGEN_ICONS WITH_OXYGEN_ICONS "Support the Oxygen icon theme (KDE4)" OFF)
+
+if (WITH_BUNDLED_ICONS)
+    add_definitions(-DWITH_BUNDLED_ICONS)
 endif()
-if (WITH_BREEZE_DARK)
-    add_definitions(-DWITH_BREEZE_DARK)
+if (WITH_OXYGEN_ICONS)
+    add_definitions(-DWITH_OXYGEN_ICONS)
 endif()
 
 # For this, the feature info is added after we know if QtWebkit is installed
diff --git a/INSTALL b/INSTALL
index 3429f24..1ad90c3 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -72,33 +72,33 @@ summary of all that after its run, so we'll just mention the most important
 options here:
 
 -DWANT_(CORE|QTCLIENT|MONO)=(ON|OFF)
-    Allow to choose which Quassel binaries to build.
+    Choose which Quassel binaries to build.
 
--DUSE_QT5=ON
-    Build against Qt5 instead of the default Qt4. Note that you should empty
-    your build directory when switching between Qt versions, otherwise weird
-    things may happen.
+-DUSE_QT4=ON
+    Build against the deprecated Qt4 instead of the default Qt5. Note that you
+    should empty your build directory when switching between Qt versions,
+    otherwise weird things may happen.
 
 -DWITH_KDE=ON
     Enable integration into KDE4 (with Qt4) or KDE Frameworks (with Qt5).
 
--DWITH_BREEZE=(ON|OFF)
-    Install the parts of the Breeze icon theme Quassel uses. Breeze is the default
-    icon theme for Plasma 5, and thus already available on systems where Plasma is
-    installed. By default, WITH_BREEZE is ON iff WITH_KDE is OFF. If you are
-    sure that you have the icon set already installed on your system regardless,
-    use this option to disable installing the bundled icons.
-
--DWITH_BREEZE_DARK=(ON|OFF)
-    Alternative icon theme to Breeze, optimized for dark desktop themes.
-    By default, WITH_BREEZE_DARK is OFF.
-
--DWITH_OXYGEN=(ON|OFF)
-    Alternative icon theme to Breeze. Oxygen was the default theme in KDE 4, and
-    also the bundled icon theme in Quassel before version 0.13.
-    By default, WITH_OXYGEN is OFF.
-
--DWITH_WEBENGINE=(ON|OFF)
+-DWITH_BUNDLED_ICONS=ON
+    Quassel requires a number of icons that are part of the KDE/Plasma icon themes
+    Breeze and Oxygen, but are generally not supported by other themes. In order
+    to avoid missing icons, Quassel bundles the subset of icons it uses from the
+    afforementioned themes, and uses that as a fallback if the system theme does
+    not provide a required icon.
+    If it is ensured that Breeze and/or Oxygen are installed on your system (e.g.
+    through package dependencies), this option can be turned off to save less
+    than 2 MB of disk space.
+
+-DWITH_OXYGEN_ICONS=(ON|OFF)
+    Support the Oxygen icon theme. Oxygen was the default theme in KDE 4, and
+    also the bundled icon theme in Quassel before version 0.13. Since the move
+    to Qt5, the more modern Breeze icon theme is preferred, and thus Oxygen
+    is disabled by default when building against Qt5.
+
+-DWITH_WEBENGINE=ON
     Use WebEngine for showing previews of webpages linked in the chat. Requires
     the QtWebEngine module to be available, and increases the client's RAM usage
     by *a lot* if enabled at runtime. Only available for Qt5. The default is ON.
index 7703853..7f3f6a2 100644 (file)
@@ -1,6 +1,10 @@
 # Install icons
 
 if (WANT_MONO OR WANT_QTCLIENT)
+    if (NOT WITH_BUNDLED_ICONS AND NOT WITH_OXYGEN_ICONS)
+        message(WARNING "Not including bundled icon themes. Ensure that the Breeze or Oxygen icon theme is installed!")
+    endif()
+
     set(BUNDLED_ICON_THEME_DIR ${CMAKE_SOURCE_DIR}/3rdparty/icons)
 
     if (EMBED_DATA)
@@ -8,38 +12,39 @@ if (WANT_MONO OR WANT_QTCLIENT)
         message(STATUS "Embedding Quassel-specific icons")
         list(APPEND ICON_RCS ${CMAKE_CURRENT_SOURCE_DIR}/breeze_icons.qrc)
         list(APPEND ICON_RCS ${CMAKE_CURRENT_SOURCE_DIR}/breeze_dark_icons.qrc)
-        list(APPEND ICON_RCS ${CMAKE_CURRENT_SOURCE_DIR}/oxygen_icons.qrc)
+        if (WITH_OXYGEN_ICONS)
+            list(APPEND ICON_RCS ${CMAKE_CURRENT_SOURCE_DIR}/oxygen_icons.qrc)
+        endif()
 
-        if (WITH_BREEZE)
+        if (WITH_BUNDLED_ICONS)
             message(STATUS "Embedding bundled Breeze icon theme")
             list(APPEND ICON_RCS ${BUNDLED_ICON_THEME_DIR}/breeze_icon_theme.qrc)
-        endif()
-        if (WITH_BREEZE_DARK)
-            message(STATUS "Embedding bundled Breeze Dark icon theme")
             list(APPEND ICON_RCS ${BUNDLED_ICON_THEME_DIR}/breeze_dark_icon_theme.qrc)
-        endif()
-        if (WITH_OXYGEN)
-            message(STATUS "Embedding bundled Oxygen icon theme")
-            list(APPEND ICON_RCS ${BUNDLED_ICON_THEME_DIR}/oxygen_icon_theme.qrc)
+            if (WITH_OXYGEN_ICONS)
+                message(STATUS "Embedding bundled Oxygen icon theme")
+                list(APPEND ICON_RCS ${BUNDLED_ICON_THEME_DIR}/oxygen_icon_theme.qrc)
+            endif()
         endif()
 
     else()
         # Always install quassel-specific icons
-        install(DIRECTORY breeze breeze-dark oxygen DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
+        install(DIRECTORY breeze breeze-dark DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
+        if (WITH_OXYGEN_ICONS)
+            install(DIRECTORY oxygen DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
+        endif()
 
         # Install bundled icon themes into our data dir (instead of CMAKE_INSTALL_ICONDIR) to avoid conflicts
         # with themes provided by the system
-        if (WITH_BREEZE)
+        if (WITH_BUNDLED_ICONS)
             message(STATUS "Installing bundled Breeze icon theme")
-            install(DIRECTORY ${BUNDLED_ICON_THEME_DIR}/breeze DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
-        endif()
-        if (WITH_BREEZE_DARK)
-            message(STATUS "Installing bundled Breeze Dark icon theme")
-            install(DIRECTORY ${BUNDLED_ICON_THEME_DIR}/breeze-dark DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
-        endif()
-        if (WITH_OXYGEN)
-            message(STATUS "Installing bundled Oxygen icon theme")
-            install(DIRECTORY ${BUNDLED_ICON_THEME_DIR}/oxygen DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
+            install(DIRECTORY   ${BUNDLED_ICON_THEME_DIR}/breeze
+                                ${BUNDLED_ICON_THEME_DIR}/breeze-dark
+                    DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons
+            )
+            if (WITH_OXYGEN_ICONS)
+                message(STATUS "Installing bundled Oxygen icon theme")
+                install(DIRECTORY ${BUNDLED_ICON_THEME_DIR}/oxygen DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
+            endif()
         endif()
     endif()
 
index dfed01e..6a36e54 100644 (file)
@@ -108,16 +108,16 @@ int main(int argc, char **argv)
     Q_INIT_RESOURCE(data);
     Q_INIT_RESOURCE(breeze_icons);
     Q_INIT_RESOURCE(breeze_dark_icons);
+#  ifdef WITH_OXYGEN_ICONS
     Q_INIT_RESOURCE(oxygen_icons);
-#   ifdef WITH_BREEZE
+#  endif
+#  ifdef WITH_BUNDLED_ICONS
       Q_INIT_RESOURCE(breeze_icon_theme);
-#   endif
-#   ifdef WITH_BREEZE_DARK
       Q_INIT_RESOURCE(breeze_dark_icon_theme);
-#   endif
-#   ifdef WITH_OXYGEN
+#   ifdef WITH_OXYGEN_ICONS
       Q_INIT_RESOURCE(oxygen_icon_theme);
 #   endif
+#  endif
 # endif
 #endif