From a1d6d8f7259ade901a87b33edbef8b31bffb5e26 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Fri, 6 Feb 2015 11:31:19 +0000 Subject: Document when modules were added to ECM. --- modules/ECMInstallIcons.cmake | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules/ECMInstallIcons.cmake') diff --git a/modules/ECMInstallIcons.cmake b/modules/ECMInstallIcons.cmake index 19d44d36..34d5a485 100644 --- a/modules/ECMInstallIcons.cmake +++ b/modules/ECMInstallIcons.cmake @@ -59,6 +59,8 @@ # # With this syntax, the file ``hi22-actions-menu_new.png`` would be installed # into ``/hicolor/22x22/actions/menu_new.png`` +# +# Since pre-1.0.0. #============================================================================= # Copyright 2014 Alex Merry -- cgit v1.2.1 From 19353c9857d1e26c6508c2fc7dd530e6ee0ef316 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Sat, 14 Mar 2015 12:44:49 +0000 Subject: Warn about icon filenames with leading characters. Through a quirk of implementation, old-style icon filenames are accepted by the new-style ecm_install_icons function. It's too late to change it now, as that would break existing projects, but we can warn about it. REVIEW: 122941 --- modules/ECMInstallIcons.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules/ECMInstallIcons.cmake') diff --git a/modules/ECMInstallIcons.cmake b/modules/ECMInstallIcons.cmake index 34d5a485..79dc5150 100644 --- a/modules/ECMInstallIcons.cmake +++ b/modules/ECMInstallIcons.cmake @@ -223,8 +223,9 @@ function(ecm_install_icons) endif() foreach(icon ${ARG_ICONS}) + get_filename_component(filename "${icon}" NAME) string(REGEX MATCH "([0-9sc]+)\\-([a-z]+)\\-([^/]+)\\.([a-z]+)$" - _dummy "${icon}") + complete_match "${filename}") set(size "${CMAKE_MATCH_1}") set(group "${CMAKE_MATCH_2}") set(name "${CMAKE_MATCH_3}") @@ -234,6 +235,12 @@ function(ecm_install_icons) elseif(NOT size STREQUAL "sc" AND NOT size GREATER 0) message(WARNING "${icon} size (${size}) is invalid - ignoring") else() + if (NOT complete_match STREQUAL filename) + # We can't stop accepting filenames with leading characters, + # because that would break existing projects, so just warn + # about them instead. + message(AUTHOR_WARNING "\"${icon}\" has characters before the size; it should be renamed to \"${size}-${group}-${name}.${ext}\"") + endif() if(NOT _ECM_ICON_GROUP_${group}) message(WARNING "${icon} group (${group}) is not recognized") endif() -- cgit v1.2.1 From 12908eafb494ed32a96a5573f0446cc1528265ca Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Sat, 12 Sep 2015 14:20:25 +0200 Subject: Update GTK icon cache when installing icons. Despite the name, Qt is also using this, and it considerably speeds up icon lookup. REVIEW: 125192 --- modules/ECMInstallIcons.cmake | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/ECMInstallIcons.cmake') diff --git a/modules/ECMInstallIcons.cmake b/modules/ECMInstallIcons.cmake index 79dc5150..920c9490 100644 --- a/modules/ECMInstallIcons.cmake +++ b/modules/ECMInstallIcons.cmake @@ -186,7 +186,9 @@ endmacro() # Updates the mtime of the icon theme directory, so caches that # watch for changes to the directory will know to update. +# If present, this also runs gtk-update-icon-cache (which despite the name is also used by Qt). function(_ecm_update_iconcache installdir theme) + find_program(GTK_UPDATE_ICON_CACHE_EXECUTABLE NAMES gtk-update-icon-cache) # We don't always have touch command (e.g. on Windows), so instead # create and delete a temporary file in the theme dir. install(CODE " @@ -194,6 +196,10 @@ function(_ecm_update_iconcache installdir theme) if (NOT DESTDIR_VALUE) file(WRITE \"${installdir}/${theme}/temp.txt\" \"update\") file(REMOVE \"${installdir}/${theme}/temp.txt\") + set(HAVE_GTK_UPDATE_ICON_CACHE_EXEC ${GTK_UPDATE_ICON_CACHE_EXECUTABLE}) + if (HAVE_GTK_UPDATE_ICON_CACHE_EXEC) + execute_process(COMMAND ${GTK_UPDATE_ICON_CACHE_EXECUTABLE} -q -t -i . WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/${installdir}/${theme}\") + endif () endif (NOT DESTDIR_VALUE) ") endfunction() -- cgit v1.2.1 From fb7b8eea7d91772f989d5b060c86df20f2ebdb66 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Wed, 14 Oct 2015 12:10:31 +0100 Subject: Fix ECMInstallIconsTest. ECMInstallIcons now updates the theme cache if gtk-update-icon-cache is available, producing files the test hadn't been expecting.. Updating the test revealed that the old-style ecm_install_icons call only updated the hicolor cache, and not any of the other themes. REVIEW: 125631 --- modules/ECMInstallIcons.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'modules/ECMInstallIcons.cmake') diff --git a/modules/ECMInstallIcons.cmake b/modules/ECMInstallIcons.cmake index 920c9490..8db486e7 100644 --- a/modules/ECMInstallIcons.cmake +++ b/modules/ECMInstallIcons.cmake @@ -111,6 +111,8 @@ macro(_ecm_install_icons_v1 _defaultpath) set(_l10n_SUBDIR ".") endif(_lang) + set(_themes) + # first the png icons file(GLOB _icons *.png) foreach (_current_ICON ${_icons} ) @@ -123,6 +125,7 @@ macro(_ecm_install_icons_v1 _defaultpath) set(_theme_GROUP ${_ECM_ICON_THEME_${_type}}) if( _theme_GROUP) + list(APPEND _themes "${_theme_GROUP}") _ECM_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake ${_defaultpath}/${_theme_GROUP}/${_size}x${_size} ${_group} ${_current_ICON} ${_name} ${_l10n_SUBDIR}) @@ -141,6 +144,7 @@ macro(_ecm_install_icons_v1 _defaultpath) set(_theme_GROUP ${_ECM_ICON_THEME_${_type}}) if( _theme_GROUP) + list(APPEND _themes "${_theme_GROUP}") _ECM_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake ${_defaultpath}/${_theme_GROUP}/${_size}x${_size} ${_group} ${_current_ICON} ${_name} ${_l10n_SUBDIR}) @@ -158,13 +162,17 @@ macro(_ecm_install_icons_v1 _defaultpath) set(_theme_GROUP ${_ECM_ICON_THEME_${_type}}) if( _theme_GROUP) + list(APPEND _themes "${_theme_GROUP}") _ECM_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake ${_defaultpath}/${_theme_GROUP}/scalable ${_group} ${_current_ICON} ${_name} ${_l10n_SUBDIR}) endif( _theme_GROUP) endforeach (_current_ICON) - _ecm_update_iconcache("${_defaultpath}" hicolor) + list(REMOVE_DUPLICATES _themes) + foreach(_theme ${_themes}) + _ecm_update_iconcache("${_defaultpath}" "${_theme}") + endforeach() endmacro() -- cgit v1.2.1 From 21629f651a6a5d9d977be03fd9f98417c4fa27ae Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Tue, 3 Nov 2015 12:00:44 +0000 Subject: Warn instead of error if ecm_install_icons finds no icons. The V1 syntax of ecm_install_icons searched for icons by globbing files with a particular naming pattern. If there were no such icons, this used to do nothing, but silently. Commit fb7b8eea7d accidentally made this an error. More sensible would be to make it a warning. BUG: 354610 REVIEW: 125931 --- modules/ECMInstallIcons.cmake | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'modules/ECMInstallIcons.cmake') diff --git a/modules/ECMInstallIcons.cmake b/modules/ECMInstallIcons.cmake index 8db486e7..549ebe19 100644 --- a/modules/ECMInstallIcons.cmake +++ b/modules/ECMInstallIcons.cmake @@ -169,10 +169,14 @@ macro(_ecm_install_icons_v1 _defaultpath) endif( _theme_GROUP) endforeach (_current_ICON) - list(REMOVE_DUPLICATES _themes) - foreach(_theme ${_themes}) - _ecm_update_iconcache("${_defaultpath}" "${_theme}") - endforeach() + if (_themes) + list(REMOVE_DUPLICATES _themes) + foreach(_theme ${_themes}) + _ecm_update_iconcache("${_defaultpath}" "${_theme}") + endforeach() + else() + message(AUTHOR_WARNING "No suitably-named icons found") + endif() endmacro() -- cgit v1.2.1