From 6f02af814f099325458e14aff4f1ac83d31385dc Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sun, 16 Jul 2023 08:34:11 +0200 Subject: xW: store the largest program icon in PNG format This shaves off about half a megabyte. --- xW/CMakeLists.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'xW') diff --git a/xW/CMakeLists.txt b/xW/CMakeLists.txt index eb374b9..9ae439e 100644 --- a/xW/CMakeLists.txt +++ b/xW/CMakeLists.txt @@ -45,11 +45,16 @@ function (icon_to_png name svg size output_dir output) COMMENT "Generating ${name} ${_dimensions} application icon" VERBATIM) endfunction () -function (icon_for_win32 pngs ico) +function (icon_for_win32 ico pngs pngs_raw) + set (_raws) + foreach (png ${pngs_raw}) + list (APPEND _raws "--raw=${png}") + endforeach () + find_program (icotool_EXECUTABLE icotool ${find_program_REQUIRE}) add_custom_command (OUTPUT ${ico} - COMMAND ${icotool_EXECUTABLE} -c -o ${ico} ${pngs} - DEPENDS ${pngs} + COMMAND ${icotool_EXECUTABLE} -c -o ${ico} ${_raws} -- ${pngs} + DEPENDS ${pngs} ${pngs_raw} COMMENT "Generating Windows program icon" VERBATIM) endfunction () @@ -57,13 +62,16 @@ endfunction () set (icon_ico_list) foreach (icon xW xW-highlighted) set (icon_png_list) - foreach (icon_size 16 32 48 256) + foreach (icon_size 16 32 48) icon_to_png (${icon} ${PROJECT_SOURCE_DIR}/${icon}.svg ${icon_size} ${PROJECT_BINARY_DIR}/icons icon_png) list (APPEND icon_png_list ${icon_png}) endforeach () + icon_to_png (${icon} ${PROJECT_SOURCE_DIR}/${icon}.svg + 256 ${PROJECT_BINARY_DIR}/icons icon_png) + set (icon_ico ${PROJECT_BINARY_DIR}/${icon}.ico) - icon_for_win32 ("${icon_png_list}" ${icon_ico}) + icon_for_win32 (${icon_ico} "${icon_png_list}" "${icon_png}") list (APPEND icon_ico_list ${icon_ico}) endforeach () -- cgit v1.2.3-70-g09d2