X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=icons%2FCMakeLists.txt;h=35eae344aa3ab50a069ebd804779df265e3da750;hp=c28de2eaee47f1be5c21a47dec4c07a44cdea59f;hb=e6217df3a59b911d2c449d2a7b997a799d233ed4;hpb=392367381225027246e8c765a7c3b7e5bf186ee2 diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index c28de2ea..35eae344 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -1,11 +1,73 @@ -# Build and/or install icons according to global settings +# Install icons -if(QUASSEL_ICONS MATCHES "External") - install(DIRECTORY hicolor DESTINATION ${ICON_INSTALL_DIR}) -else(QUASSEL_ICONS MATCHES "External") - set(CLIENT_DEPS ${CLIENT_DEPS} hicolor.qrc) -endif(QUASSEL_ICONS MATCHES "External") +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() -if(OXYGEN_ICONS MATCHES "Builtin") - set(CLIENT_DEPS ${CLIENT_DEPS} oxygen.qrc) -endif(OXYGEN_ICONS MATCHES "Builtin") + set(BUNDLED_ICON_THEME_DIR ${CMAKE_SOURCE_DIR}/3rdparty/icons) + + # Always embed a hicolor fallback containing the most important (e.g. tray) icons. + # The .qrc contains aliases, so it's best to keep this manually written rather than autogenerated. + quassel_add_module(Resource::HicolorIcons STATIC) + target_sources(${TARGET} PRIVATE hicolor_icons.qrc) + set_target_properties(${TARGET} PROPERTIES AUTOMOC OFF AUTOUIC OFF) + + if (EMBED_DATA) + # Always embed quassel-specific icons + message(STATUS "Embedding Quassel-specific icons") + set(patterns breeze*/*.svg) + if (WITH_OXYGEN_ICONS) + list(APPEND patterns oxygen/*.png) + endif() + quassel_add_resource(Icons PREFIX icons PATTERNS ${patterns}) + + if (WITH_BUNDLED_ICONS) + message(STATUS "Embedding bundled Breeze icon theme") + set(patterns breeze*/*.svg breeze*/index.theme) + if (WITH_OXYGEN_ICONS) + message(STATUS "Embedding bundled Oxygen icon theme") + list(APPEND patterns oxygen/*.png oxygen/index.theme) + endif() + endif() + quassel_add_resource(IconThemes PREFIX icons PATTERNS ${patterns} BASEDIR ${BUNDLED_ICON_THEME_DIR}) + + else() + # Always install quassel-specific 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_BUNDLED_ICONS) + message(STATUS "Installing bundled Breeze icon theme") + 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() + + # Application icon + if (HAVE_KDE OR (UNIX AND NOT APPLE)) + # hicolor contains the application icon in all relevant sizes + install(DIRECTORY hicolor DESTINATION ${CMAKE_INSTALL_ICONDIR}) + + if (Qt5Core_VERSION VERSION_LESS 5.5.0) + # Qt < 5.5 doesn't seem to correctly load icons from injected themes + # Install Quassel-specific ones from Oxygen into hicolor as fallback + install(DIRECTORY oxygen/ DESTINATION ${CMAKE_INSTALL_ICONDIR}/hicolor) + endif() + + # For a system install, also copy to pixmaps + if (CMAKE_INSTALL_PREFIX STREQUAL "/usr") + install(FILES hicolor/48x48/apps/quassel.png DESTINATION /usr/share/pixmaps) + endif() + endif() +endif()