summaryrefslogtreecommitdiff
path: root/icons/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'icons/CMakeLists.txt')
-rw-r--r--icons/CMakeLists.txt50
1 files changed, 50 insertions, 0 deletions
diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt
new file mode 100644
index 0000000..5c17877
--- /dev/null
+++ b/icons/CMakeLists.txt
@@ -0,0 +1,50 @@
+file(GLOB icon_files "${CMAKE_CURRENT_SOURCE_DIR}/*.svg")
+
+set(formats
+ pdf
+ svg
+ png
+ ico
+)
+
+find_program(imagemagick magick convert)
+
+foreach(icon_file ${icon_files})
+ get_filename_component(icon ${icon_file} NAME_WE)
+ foreach(format ${formats})
+ set(source "${CMAKE_CURRENT_SOURCE_DIR}/${icon}.svg")
+ set(sink "${CMAKE_CURRENT_BINARY_DIR}/${format}/${icon}.${format}")
+ if(format STREQUAL ico)
+ set(intermediate "${CMAKE_CURRENT_BINARY_DIR}/png/${icon}.png")
+ add_custom_command(
+ OUTPUT
+ ${sink}
+ COMMAND
+ ${imagemagick}
+ ${intermediate}
+ ${sink}
+ DEPENDS
+ ${intermediate}
+ )
+ else()
+ add_custom_command(
+ OUTPUT
+ ${sink}
+ COMMAND
+ SELF_CALL=xxx # https://gitlab.com/inkscape/inkscape/-/issues/4716
+ inkscape
+ --export-type=${format}
+ --export-filename=${sink}
+ ${source}
+ DEPENDS
+ ${source}
+ )
+ endif()
+ add_custom_target(
+ "icon-${format}-${icon}"
+ ALL
+ DEPENDS
+ ${sink}
+ )
+ endforeach()
+endforeach()