parent
b5438c3ae4
commit
89389e82e8
|
@ -1,30 +1,34 @@
|
||||||
cmake_minimum_required(VERSION 2.8)
|
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
|
# Render SVG icon in various sizes
|
||||||
find_program(RSVG_CONVERT rsvg-convert)
|
find_program(RSVG_CONVERT rsvg-convert)
|
||||||
if(RSVG_CONVERT AND (PLATFORM_GNU OR PLATFORM_MACOSX))
|
find_program(XMLSTARLET xmlstarlet)
|
||||||
add_custom_target(png-icons ALL)
|
if(RSVG_CONVERT AND XMLSTARLET AND (PLATFORM_GNU OR PLATFORM_MACOSX))
|
||||||
foreach(PNGSIZE 512 256 128 48 32 16)
|
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(
|
add_custom_command(
|
||||||
OUTPUT ${PNGSIZE}/colobot.png
|
OUTPUT ${PNG_SIZE}/colobot.png
|
||||||
COMMAND mkdir -p ${PNGSIZE}
|
COMMAND mkdir -p ${PNG_SIZE}
|
||||||
COMMAND ${RSVG_CONVERT} -w ${PNGSIZE} -h ${PNGSIZE} ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE} > ${PNGSIZE}/colobot.png
|
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_custom_target(png-icon-${PNG_SIZE} ALL DEPENDS ${PNG_SIZE}/colobot.png)
|
||||||
add_dependencies(png-icons png-icon-${PNGSIZE})
|
add_dependencies(png-icons png-icon-${PNG_SIZE})
|
||||||
|
|
||||||
if(PLATFORM_GNU)
|
if(PLATFORM_GNU)
|
||||||
install(
|
install(
|
||||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGSIZE}/colobot.png
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNG_SIZE}/colobot.png
|
||||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNGSIZE}x${PNGSIZE}/apps/
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/${PNG_SIZE}x${PNG_SIZE}/apps/
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
# Prepare the ICNS icon generation
|
# Prepare the ICNS icon generation
|
||||||
list(APPEND ICNS_SRCS "${PNGSIZE}/colobot.png")
|
list(APPEND ICNS_SRCS "${PNG_SIZE}/colobot.png")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Pack icon for Mac OS
|
# Pack icon for Mac OS
|
||||||
find_program(PNG2ICNS png2icns)
|
find_program(PNG2ICNS png2icns)
|
||||||
if(PNG2ICNS AND PLATFORM_MACOSX)
|
if(PNG2ICNS AND PLATFORM_MACOSX)
|
||||||
|
@ -54,7 +58,7 @@ if(PLATFORM_GNU)
|
||||||
|
|
||||||
# Install Icon
|
# Install Icon
|
||||||
install(
|
install(
|
||||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/${COLOBOT_ICON_FILE}
|
FILES ${COLOBOT_ICON_FILE}
|
||||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps/
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
width="32"
|
width="32"
|
||||||
height="32"
|
height="32"
|
||||||
|
viewBox="0 0 32 32"
|
||||||
id="svg2"
|
id="svg2"
|
||||||
version="1.1"
|
version="1.1"
|
||||||
inkscape:version="0.48.4 r9939"
|
inkscape:version="0.48.4 r9939"
|
||||||
|
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Loading…
Reference in New Issue