cmake: Build Windows icon resource again
[quassel.git] / icons / CMakeLists.txt
1 # Install icons
2
3 if (WANT_MONO OR WANT_QTCLIENT)
4     if (NOT WITH_BUNDLED_ICONS AND NOT WITH_OXYGEN_ICONS)
5         message(WARNING "Not including bundled icon themes. Ensure that the Breeze or Oxygen icon theme is installed!")
6     endif()
7
8     set(BUNDLED_ICON_THEME_DIR ${CMAKE_SOURCE_DIR}/3rdparty/icons)
9
10     # Always embed a hicolor fallback containing the most important (e.g. tray) icons.
11     # The .qrc contains aliases, so it's best to keep this manually written rather than autogenerated.
12     quassel_add_module(Resource::HicolorIcons)
13     target_sources(${TARGET} PRIVATE hicolor_icons.qrc)
14     set_target_properties(${TARGET} PROPERTIES AUTOMOC OFF AUTOUIC OFF)
15
16     if (EMBED_DATA)
17         # Always embed quassel-specific icons
18         message(STATUS "Embedding Quassel-specific icons")
19         set(patterns breeze*/*.svg)
20         if (WITH_OXYGEN_ICONS)
21             list(APPEND patterns oxygen/*.png)
22         endif()
23         quassel_add_resource(Icons PREFIX icons PATTERNS ${patterns})
24
25         if (WITH_BUNDLED_ICONS)
26             message(STATUS "Embedding bundled Breeze icon theme")
27             set(patterns breeze*/*.svg breeze*/index.theme)
28             if (WITH_OXYGEN_ICONS)
29                 message(STATUS "Embedding bundled Oxygen icon theme")
30                 list(APPEND patterns oxygen/*.png oxygen/index.theme)
31             endif()
32         endif()
33         quassel_add_resource(IconThemes PREFIX icons PATTERNS ${patterns} BASEDIR ${BUNDLED_ICON_THEME_DIR})
34
35     else()
36         # Always install quassel-specific icons
37         install(DIRECTORY breeze breeze-dark DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
38         if (WITH_OXYGEN_ICONS)
39             install(DIRECTORY oxygen DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
40         endif()
41
42         # Install bundled icon themes into our data dir (instead of CMAKE_INSTALL_ICONDIR) to avoid conflicts
43         # with themes provided by the system
44         if (WITH_BUNDLED_ICONS)
45             message(STATUS "Installing bundled Breeze icon theme")
46             install(DIRECTORY   ${BUNDLED_ICON_THEME_DIR}/breeze
47                                 ${BUNDLED_ICON_THEME_DIR}/breeze-dark
48                     DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons
49             )
50             if (WITH_OXYGEN_ICONS)
51                 message(STATUS "Installing bundled Oxygen icon theme")
52                 install(DIRECTORY ${BUNDLED_ICON_THEME_DIR}/oxygen DESTINATION ${CMAKE_INSTALL_DATADIR}/quassel/icons)
53             endif()
54         endif()
55     endif()
56
57     # Application icon
58     if (HAVE_KDE OR (UNIX AND NOT APPLE))
59         # hicolor contains the application icon in all relevant sizes
60         install(DIRECTORY hicolor DESTINATION ${CMAKE_INSTALL_ICONDIR})
61
62         if (Qt5Core_VERSION VERSION_LESS 5.5.0)
63             # Qt < 5.5 doesn't seem to correctly load icons from injected themes
64             # Install Quassel-specific ones from Oxygen into hicolor as fallback
65             install(DIRECTORY oxygen/ DESTINATION ${CMAKE_INSTALL_ICONDIR}/hicolor)
66         endif()
67
68         # For a system install, also copy to pixmaps
69         if (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
70             install(FILES hicolor/48x48/apps/quassel.png DESTINATION /usr/share/pixmaps)
71         endif()
72     endif()
73 endif()