]> source.dussan.org Git - tigervnc.git/commitdiff
Automatically generate Windows icon file
authorPierre Ossman <ossman@cendio.se>
Wed, 11 May 2022 10:39:58 +0000 (12:39 +0200)
committerPierre Ossman <ossman@cendio.se>
Wed, 11 May 2022 11:06:27 +0000 (13:06 +0200)
media/CMakeLists.txt
media/icons/tigervnc.ico [new file with mode: 0644]
media/tigervnc.ico [deleted file]
vncviewer/vncviewer.rc.in

index 4bed4b6b90893a8f2a73a9ad6c0da8ffe7980c88..248e2213d1cc48cb147055dab1fe3572aa5b93e9 100644 (file)
@@ -1,14 +1,16 @@
-set(ICON_SIZES 16 22 24 32 48 64 128)
+set(LINUX_ICON_SIZES 16 22 24 32 48 64 128)
+set(WINDOWS_ICON_SIZES 16 24 32 48 256)
 
 find_program(CONVERT_EXECUTABLE convert)
 
 if(CONVERT_EXECUTABLE)
-  foreach(SIZE ${ICON_SIZES})
+  set(ICON_FILES icons/tigervnc.ico)
+  foreach(SIZE ${LINUX_ICON_SIZES})
     list(APPEND ICON_FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_${SIZE}.png)
   endforeach()
   add_custom_target(icons DEPENDS ${ICON_FILES})
 
-  foreach(SIZE ${ICON_SIZES})
+  foreach(SIZE ${LINUX_ICON_SIZES} ${WINDOWS_ICON_SIZES})
     if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_${SIZE}.svg)
       set(ICON_SRC_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_${SIZE}.svg)
     else()
@@ -21,4 +23,18 @@ if(CONVERT_EXECUTABLE)
       DEPENDS ${ICON_SRC_FILE}
       COMMENT "Generating icons/tigervnc_${SIZE}.png")
   endforeach()
+
+  foreach(SIZE ${WINDOWS_ICON_SIZES})
+    if(${SIZE} LESS_EQUAL 32)
+      list(APPEND ICO_LEGACY \\\( ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_${SIZE}.png -depth 4 -colors 16 \\\))
+      list(APPEND ICO_LEGACY \\\( ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_${SIZE}.png -depth 8 -colors 256 \\\))
+    endif()
+    list(APPEND ICO_NORMAL \\\( ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_${SIZE}.png \\\))
+    list(APPEND ICO_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_${SIZE}.png)
+  endforeach()
+  add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc.ico
+    COMMAND ${CONVERT_EXECUTABLE} ${ICO_LEGACY} ${ICO_NORMAL}
+      ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc.ico
+    DEPENDS ${ICO_DEPENDS}
+    COMMENT "Generating icons/tigervnc.ico")
 endif()
diff --git a/media/icons/tigervnc.ico b/media/icons/tigervnc.ico
new file mode 100644 (file)
index 0000000..97aa02a
Binary files /dev/null and b/media/icons/tigervnc.ico differ
diff --git a/media/tigervnc.ico b/media/tigervnc.ico
deleted file mode 100755 (executable)
index b86033b..0000000
Binary files a/media/tigervnc.ico and /dev/null differ
index c87a5400d6fa2a326519f5f365d2651fb1983195..9fec92f3de37b4ca90bdfe516edaa7d27114f7aa 100644 (file)
@@ -70,7 +70,7 @@ END
 
 // Icon with lowest ID value placed first to ensure application icon
 // remains consistent on all systems.
-IDI_ICON                ICON    DISCARDABLE     "@CMAKE_SOURCE_DIR@/media/tigervnc.ico"
+IDI_ICON                ICON    DISCARDABLE     "@CMAKE_SOURCE_DIR@/media/icons/tigervnc.ico"
 
 #endif    // English (U.K.) resources
 /////////////////////////////////////////////////////////////////////////////