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 /KF5KirigamiMacros.cmake | |
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 'KF5KirigamiMacros.cmake')
-rw-r--r-- | KF5KirigamiMacros.cmake | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/KF5KirigamiMacros.cmake b/KF5KirigamiMacros.cmake deleted file mode 100644 index 175db954..00000000 --- a/KF5KirigamiMacros.cmake +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | |||
2 | include(CMakeParseArguments) | ||
3 | include(ExternalProject) | ||
4 | find_package(Git) | ||
5 | |||
6 | |||
7 | function(kirigami_package_breeze_icons) | ||
8 | set(_multiValueArgs ICONS) | ||
9 | cmake_parse_arguments(ARG "" "" "${_multiValueArgs}" ${ARGN} ) | ||
10 | |||
11 | if(NOT ARG_ICONS) | ||
12 | message(FATAL_ERROR "No ICONS argument given to kirigami_package_breeze_icons") | ||
13 | endif() | ||
14 | |||
15 | #include icons used by Kirigami components themselves | ||
16 | set(ARG_ICONS ${ARG_ICONS} go-next go-previous handle-left handle-right) | ||
17 | |||
18 | function(_find_breeze_icon icon varName) | ||
19 | #HACKY | ||
20 | SET(path "") | ||
21 | file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/48/${icon}.svg ) | ||
22 | |||
23 | #seach in other sizes as well | ||
24 | if (NOT EXISTS ${path}) | ||
25 | file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/32/${icon}.svg ) | ||
26 | if (NOT EXISTS ${path}) | ||
27 | file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/24/${icon}.svg ) | ||
28 | if (NOT EXISTS ${path}) | ||
29 | file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/22/${icon}.svg ) | ||
30 | endif() | ||
31 | endif() | ||
32 | endif() | ||
33 | if (NOT EXISTS ${path}) | ||
34 | return() | ||
35 | endif() | ||
36 | |||
37 | get_filename_component(path "${path}" REALPATH) | ||
38 | |||
39 | SET(${varName} ${path} PARENT_SCOPE) | ||
40 | endfunction() | ||
41 | |||
42 | if (BREEZEICONS_DIR AND NOT EXISTS ${BREEZEICONS_DIR}) | ||
43 | message(FATAL_ERROR "BREEZEICONS_DIR variable does not point to existing dir: \"${BREEZEICONS_DIR}\"") | ||
44 | endif() | ||
45 | |||
46 | set(_BREEZEICONS_DIR "${BREEZEICONS_DIR}") | ||
47 | |||
48 | #FIXME: this is a terrible hack | ||
49 | if(NOT _BREEZEICONS_DIR) | ||
50 | set(_BREEZEICONS_DIR "${CMAKE_BINARY_DIR}/breeze-icons/src/breeze-icons") | ||
51 | |||
52 | # replacement for ExternalProject_Add not yet working | ||
53 | # first time config? | ||
54 | if (NOT EXISTS ${_BREEZEICONS_DIR}) | ||
55 | execute_process(COMMAND ${GIT_EXECUTABLE} clone --depth 1 git://anongit.kde.org/breeze-icons.git ${_BREEZEICONS_DIR}) | ||
56 | endif() | ||
57 | |||
58 | # external projects are only pulled at make time, not configure time | ||
59 | # so this is too late to work with the _find_breeze_icon() method | ||
60 | # _find_breeze_icon() would need to be turned into a target/command | ||
61 | if (FALSE) | ||
62 | ExternalProject_Add( | ||
63 | breeze-icons | ||
64 | PREFIX breeze-icons | ||
65 | GIT_REPOSITORY git://anongit.kde.org/breeze-icons.git | ||
66 | CONFIGURE_COMMAND "" | ||
67 | BUILD_COMMAND "" | ||
68 | INSTALL_COMMAND "" | ||
69 | LOG_DOWNLOAD ON | ||
70 | ) | ||
71 | endif() | ||
72 | endif() | ||
73 | |||
74 | message (STATUS "Found external breeze icons:") | ||
75 | foreach(_iconName ${ARG_ICONS}) | ||
76 | set(_iconPath "") | ||
77 | _find_breeze_icon(${_iconName} _iconPath) | ||
78 | message (STATUS ${_iconPath}) | ||
79 | if (EXISTS ${_iconPath}) | ||
80 | install(FILES ${_iconPath} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami/icons/ RENAME ${_iconName}.svg) | ||
81 | endif() | ||
82 | |||
83 | endforeach() | ||
84 | endfunction() | ||
85 | |||