diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-04 07:51:39 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-04-04 15:19:55 +0200 |
commit | f57648811a9883c0b99bfc1550a3a926001f13b5 (patch) | |
tree | 1506c4b780724f5b2bd48e3de83d93da2af46ec5 /icons/CMakeLists.txt | |
parent | c080af579c4a692a071c03a81482ceba9f5b9114 (diff) | |
download | kube-f57648811a9883c0b99bfc1550a3a926001f13b5.tar.gz kube-f57648811a9883c0b99bfc1550a3a926001f13b5.zip |
Install icons as our own theme based on breeze.
We're not following the system theme, so the icons shouldn't either.
And on other platforms than linux we anyways have to roll our own
solution.
Diffstat (limited to 'icons/CMakeLists.txt')
-rw-r--r-- | icons/CMakeLists.txt | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index 72c1e219..45a9718d 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt | |||
@@ -2,7 +2,92 @@ find_package(ECM 0.0.8 REQUIRED NO_MODULE) | |||
2 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) | 2 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) |
3 | 3 | ||
4 | include(ECMInstallIcons) | 4 | include(ECMInstallIcons) |
5 | include(KDEInstallDirs) | ||
5 | 6 | ||
7 | function(copy_breeze_icons) | ||
8 | set(_multiValueArgs ICONS) | ||
9 | cmake_parse_arguments(ARG "" "" "${_multiValueArgs}" ${ARGN} ) | ||
10 | set(_BREEZEICONS_DIR ${CMAKE_CURRENT_BINARY_DIR}/breeze) | ||
11 | |||
12 | function(_copy_breeze_icon icon) | ||
13 | SET(paths "") | ||
14 | #breeze only ships svgs anyways | ||
15 | #change icons to * to also get icons-dark | ||
16 | file(GLOB_RECURSE paths ${_BREEZEICONS_DIR}/icons/*/*/${icon}.svg ) | ||
17 | |||
18 | #We cannot copy symlinks unless the target is there, so copy non-symlinks first | ||
19 | foreach(path ${paths}) | ||
20 | file(RELATIVE_PATH _rel_path ${_BREEZEICONS_DIR} ${path}) | ||
21 | set(_target_path ${CMAKE_CURRENT_SOURCE_DIR}/breeze/${_rel_path}) | ||
22 | get_filename_component(_target_dir ${_target_path} DIRECTORY) | ||
23 | if (NOT EXISTS ${_target_path} AND NOT IS_SYMLINK ${path}) | ||
24 | message("Copying icon ${path} to ${_target_dir}") | ||
25 | file(COPY ${path} DESTINATION ${_target_dir}) | ||
26 | endif() | ||
27 | endforeach() | ||
28 | #Now copy symlinks | ||
29 | foreach(path ${paths}) | ||
30 | file(RELATIVE_PATH _rel_path ${_BREEZEICONS_DIR} ${path}) | ||
31 | set(_target_path ${CMAKE_CURRENT_SOURCE_DIR}/breeze/${_rel_path}) | ||
32 | get_filename_component(_target_dir ${_target_path} DIRECTORY) | ||
33 | if (NOT EXISTS ${_target_path} AND IS_SYMLINK ${path}) | ||
34 | message("Copying icon symlink ${path} to ${_target_dir}") | ||
35 | file(COPY ${path} DESTINATION ${_target_dir}) | ||
36 | endif() | ||
37 | endforeach() | ||
38 | |||
39 | endfunction() | ||
40 | |||
41 | #Fetch the icons | ||
42 | if (NOT EXISTS ${_BREEZEICONS_DIR}) | ||
43 | message("Cloning into ${_BREEZEICONS_DIR}") | ||
44 | execute_process(COMMAND ${GIT_EXECUTABLE} clone --depth 1 git://anongit.kde.org/breeze-icons.git ${_BREEZEICONS_DIR}) | ||
45 | endif() | ||
46 | |||
47 | #Copy the icons we want | ||
48 | foreach(_iconName ${ARG_ICONS}) | ||
49 | message (STATUS ${_iconName}) | ||
50 | _copy_breeze_icon(${_iconName}) | ||
51 | endforeach() | ||
52 | #Copy the license file | ||
53 | file(COPY ${_BREEZEICONS_DIR}/COPYING-ICONS DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/breeze/) | ||
54 | endfunction() | ||
55 | |||
56 | |||
57 | |||
58 | # Run this function if you want to updated the icons | ||
59 | # Warning: some icon names are symlinks and you'll thus need to copy the actual icon as well. If copying fails with some weird errors that's typically the problem | ||
60 | if (FALSE) | ||
61 | #file(REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/breeze/) | ||
62 | copy_breeze_icons(ICONS | ||
63 | application-menu | ||
64 | dialog-cancel | ||
65 | dialog-ok | ||
66 | document-decrypt | ||
67 | document-edit | ||
68 | document-encrypt | ||
69 | edit-delete | ||
70 | edit-find | ||
71 | edit-undo | ||
72 | error | ||
73 | folder | ||
74 | im-user | ||
75 | mail-mark-important | ||
76 | mail-mark-unread-new | ||
77 | mail-reply-sender | ||
78 | network-disconnect | ||
79 | view-refresh | ||
80 | ) | ||
81 | endif() | ||
82 | |||
83 | |||
84 | #Install kube icons | ||
6 | ecm_install_icons(ICONS sc-apps-kube_icon.svg 256-apps-kube_icon.png DESTINATION share/icons) | 85 | ecm_install_icons(ICONS sc-apps-kube_icon.svg 256-apps-kube_icon.png DESTINATION share/icons) |
7 | ecm_install_icons(ICONS sc-apps-kube_symbol.svg DESTINATION share/icons) | 86 | ecm_install_icons(ICONS sc-apps-kube_symbol.svg DESTINATION share/icons) |
8 | ecm_install_icons(ICONS sc-apps-kube_logo.svg DESTINATION share/icons) | 87 | ecm_install_icons(ICONS sc-apps-kube_logo.svg DESTINATION share/icons) |
88 | |||
89 | install(DIRECTORY | ||
90 | breeze/icons/places | ||
91 | breeze/icons/actions | ||
92 | DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/kube) | ||
93 | install(FILES breeze/icons/index.theme DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/kube) | ||