parent
b5438c3ae4
commit
89389e82e8
desktop
|
@ -1,28 +1,32 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
set(COLOBOT_ICON_FILE colobot.svg)
|
||||
set(COLOBOT_ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/colobot.svg)
|
||||
|
||||
# Render SVG icon in various sizes
|
||||
find_program(RSVG_CONVERT rsvg-convert)
|
||||
if(RSVG_CONVERT AND (PLATFORM_GNU OR PLATFORM_MACOSX))
|
||||
add_custom_target(png-icons ALL)
|
||||
foreach(PNGSIZE 512 256 128 48 32 16)
|
||||
find_program(XMLSTARLET xmlstarlet)
|
||||
if(RSVG_CONVERT AND XMLSTARLET AND (PLATFORM_GNU OR PLATFORM_MACOSX))
|
||||
add_custom_target(png-icons ALL DEPENDS ${COLOBOT_ICON_FILE})
|
||||
|
||||
foreach(PNG_SIZE 512 256 128 48 32 16)
|
||||
# Using xmlstarlet to edit SVG file is a workaround for rsvg-convert bug (see: https://bugzilla.gnome.org/show_bug.cgi?id=762115)
|
||||
add_custom_command(
|
||||
OUTPUT ${PNGSIZE}/colobot.png
|
||||
COMMAND mkdir -p ${PNGSIZE}
|
||||
COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} > ${PNGSIZE}/colobot.png
|
||||
OUTPUT ${PNG_SIZE}/colobot.png
|
||||
COMMAND mkdir -p ${PNG_SIZE}
|
||||
COMMAND ${XMLSTARLET} ed -u /*/@width -v ${PNG_SIZE} -u /*/@height -v ${PNG_SIZE} ${COLOBOT_ICON_FILE} > ${PNG_SIZE}/colobot.svg
|
||||
COMMAND ${RSVG_CONVERT} ${PNG_SIZE}/colobot.svg -o ${PNG_SIZE}/colobot.png
|
||||
)
|
||||
add_custom_target(png-icon-${PNGSIZE} ALL DEPENDS ${PNGSIZE}/colobot.png)
|
||||
add_dependencies(png-icons png-icon-${PNGSIZE})
|
||||
add_custom_target(png-icon-${PNG_SIZE} ALL DEPENDS ${PNG_SIZE}/colobot.png)
|
||||
add_dependencies(png-icons png-icon-${PNG_SIZE})
|
||||
|
||||
if(PLATFORM_GNU)
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNG_SIZE}/colobot.png
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNG_SIZE}x${PNG_SIZE}/apps/
|
||||
)
|
||||
endif()
|
||||
# Prepare the ICNS icon generation
|
||||
list(APPEND ICNS_SRCS "${PNGSIZE}/colobot.png")
|
||||
list(APPEND ICNS_SRCS "${PNG_SIZE}/colobot.png")
|
||||
endforeach()
|
||||
|
||||
# Pack icon for Mac OS
|
||||
|
@ -54,7 +58,7 @@ if(PLATFORM_GNU)
|
|||
|
||||
# Install Icon
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
|
||||
FILES ${COLOBOT_ICON_FILE}
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
|
||||
)
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="32"
|
||||
height="32"
|
||||
viewBox="0 0 32 32"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
|
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue