diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2023-07-16 08:34:11 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2023-07-16 08:35:39 +0200 |
commit | 6f02af814f099325458e14aff4f1ac83d31385dc (patch) | |
tree | a9817e6b2b7fcb8e38a0cd5ff67ca3c9fa47de9a /xW/CMakeLists.txt | |
parent | 90859107c8686c8798bff26aeb8ff17cea54bee1 (diff) | |
download | xK-6f02af814f099325458e14aff4f1ac83d31385dc.tar.gz xK-6f02af814f099325458e14aff4f1ac83d31385dc.tar.xz xK-6f02af814f099325458e14aff4f1ac83d31385dc.zip |
xW: store the largest program icon in PNG format
This shaves off about half a megabyte.
Diffstat (limited to 'xW/CMakeLists.txt')
-rw-r--r-- | xW/CMakeLists.txt | 18 |
1 files changed, 13 insertions, 5 deletions
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 () |