summaryrefslogtreecommitdiffstats
path: root/media/CMakeLists.txt
blob: 256d435729a5ff9d5b750198125f478d5543d318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
set(ICON_FILES
  ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_16.png
  ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_22.png
  ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_24.png
  ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_32.png
  ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_48.png)

find_program(CONVERT_EXECUTABLE convert)

if(CONVERT_EXECUTABLE)
  add_custom_target(icons DEPENDS ${ICON_FILES})

  if(UNIX AND NOT APPLE)
    foreach(SIZE 16 22 24 32 48)
      install(FILES icons/tigervnc_${SIZE}.png
        DESTINATION ${DATA_DIR}/icons/hicolor/${SIZE}x${SIZE}/apps
        RENAME tigervnc.png)
    endforeach()
    install(FILES icons/tigervnc.svg
      DESTINATION ${DATA_DIR}/icons/hicolor/scalable/apps)
  endif()
endif()

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_16.png
  COMMAND ${CONVERT_EXECUTABLE} -background transparent
    ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_16.svg
    ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_16.png
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_16.svg
  COMMENT "Generating icons/tigervnc_16.png")

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_22.png
  COMMAND ${CONVERT_EXECUTABLE} -density 72
    -size 22x22 xc:none -gravity center -background transparent
    ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_20.svg -composite
    ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_22.png
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_20.svg
  COMMENT "Generating icons/tigervnc_22.png")

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_24.png
  COMMAND ${CONVERT_EXECUTABLE} -density 72
    -size 24x24 xc:none -gravity center -background transparent
    ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_20.svg -composite
    ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_24.png
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_20.svg
  COMMENT "Generating icons/tigervnc_24.png")

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_32.png
  COMMAND ${CONVERT_EXECUTABLE} -density 72
    -size 32x32 xc:none -gravity center -background transparent
    ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_28.svg -composite
    ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_32.png
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_28.svg
  COMMENT "Generating icons/tigervnc_32.png")

add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_48.png
  COMMAND ${CONVERT_EXECUTABLE} -density 72
    -size 48x48 xc:none -gravity center -background transparent
    ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_42.svg -composite
    ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_48.png
  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_42.svg
  COMMENT "Generating icons/tigervnc_48.png")