Warning, /frameworks/kirigami/KF6KirigamiMacros.cmake is written in an unsupported language. File is not indexed.
0001 include(CMakeParseArguments) 0002 include(ExternalProject) 0003 0004 0005 function(kirigami_package_breeze_icons) 0006 set(_multiValueArgs ICONS) 0007 cmake_parse_arguments(ARG "" "" "${_multiValueArgs}" ${ARGN} ) 0008 0009 if(NOT ARG_ICONS) 0010 message(FATAL_ERROR "No ICONS argument given to kirigami_package_breeze_icons") 0011 endif() 0012 0013 #include icons used by Kirigami components themselves 0014 set(ARG_ICONS ${ARG_ICONS} 0015 application-exit 0016 dialog-close 0017 dialog-error 0018 dialog-information 0019 dialog-positive 0020 dialog-warning 0021 edit-clear-locationbar-ltr 0022 edit-clear-locationbar-rtl 0023 edit-copy 0024 edit-delete-remove 0025 emblem-error 0026 emblem-information 0027 emblem-positive 0028 emblem-warning 0029 globe 0030 go-next 0031 go-next-symbolic 0032 go-next-symbolic-rtl 0033 go-previous 0034 go-previous-symbolic 0035 go-previous-symbolic-rtl 0036 go-up 0037 handle-sort 0038 mail-sent 0039 open-menu-symbolic 0040 overflow-menu-left 0041 overflow-menu-right 0042 overflow-menu 0043 password-show-off 0044 password-show-on 0045 tools-report-bug 0046 user 0047 view-left-new 0048 view-right-new 0049 view-left-close 0050 view-right-close 0051 ) 0052 0053 function(_find_breeze_icon icon varName) 0054 #HACKY 0055 SET(path "") 0056 file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/48/${icon}.svg ) 0057 0058 #search in other sizes as well 0059 if (path STREQUAL "") 0060 file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/32/${icon}.svg ) 0061 if (path STREQUAL "") 0062 file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/22/${icon}.svg ) 0063 if (path STREQUAL "") 0064 file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/16/${icon}.svg ) 0065 endif() 0066 endif() 0067 endif() 0068 if (path STREQUAL "") 0069 file(GLOB_RECURSE path ${_BREEZEICONS_DIR}/icons/*/symbolic/${icon}.svg ) 0070 endif() 0071 if (path STREQUAL "") 0072 return() 0073 endif() 0074 0075 list(LENGTH path _count_paths) 0076 if (_count_paths GREATER 1) 0077 message(WARNING "Found more than one version of '${icon}': ${path}") 0078 endif() 0079 list(GET path 0 path) 0080 get_filename_component(path "${path}" REALPATH) 0081 0082 SET(${varName} ${path} PARENT_SCOPE) 0083 endfunction() 0084 0085 if (BREEZEICONS_DIR AND NOT EXISTS ${BREEZEICONS_DIR}) 0086 message(FATAL_ERROR "BREEZEICONS_DIR variable does not point to existing dir: \"${BREEZEICONS_DIR}\"") 0087 endif() 0088 0089 set(_BREEZEICONS_DIR "${BREEZEICONS_DIR}") 0090 0091 #FIXME: this is a terrible hack 0092 if(NOT _BREEZEICONS_DIR) 0093 set(_BREEZEICONS_DIR "${CMAKE_BINARY_DIR}/breeze-icons/src/breeze-icons") 0094 0095 # replacement for ExternalProject_Add not yet working 0096 # first time config? 0097 if (NOT EXISTS ${_BREEZEICONS_DIR}) 0098 find_package(Git) 0099 execute_process(COMMAND ${GIT_EXECUTABLE} clone --depth 1 https://invent.kde.org/frameworks/breeze-icons.git ${_BREEZEICONS_DIR}) 0100 endif() 0101 0102 # external projects are only pulled at make time, not configure time 0103 # so this is too late to work with the _find_breeze_icon() method 0104 # _find_breeze_icon() would need to be turned into a target/command 0105 if (FALSE) 0106 ExternalProject_Add( 0107 breeze-icons 0108 PREFIX breeze-icons 0109 GIT_REPOSITORY https://invent.kde.org/frameworks/breeze-icons.git 0110 CONFIGURE_COMMAND "" 0111 BUILD_COMMAND "" 0112 INSTALL_COMMAND "" 0113 LOG_DOWNLOAD ON 0114 ) 0115 endif() 0116 endif() 0117 0118 message (STATUS "Found external breeze icons:") 0119 foreach(_iconName ${ARG_ICONS}) 0120 set(_iconPath "") 0121 _find_breeze_icon(${_iconName} _iconPath) 0122 message (STATUS ${_iconPath}) 0123 if (EXISTS ${_iconPath}) 0124 install(FILES ${_iconPath} DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami/breeze-internal/icons/ RENAME ${_iconName}.svg) 0125 endif() 0126 endforeach() 0127 0128 #generate an index.theme that qiconloader can understand 0129 file(WRITE ${CMAKE_BINARY_DIR}/index.theme "[Icon Theme]\nName=Breeze\nDirectories=icons\n[icons]\nSize=32\nType=Scalable") 0130 install(FILES ${CMAKE_BINARY_DIR}/index.theme DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/kirigami/breeze-internal/) 0131 endfunction()