diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-22 17:51:00 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-08-22 17:51:00 +0400 |
commit | 29c8d3e20de92577d9067b70c6745bf1f0654e9c (patch) | |
tree | 00e8494ff679d062d74f351a518627fce3b725f4 /build_files | |
parent | 104cd04f4f4e98aa2903dcd7de533bb5e4bcc11f (diff) |
Automatically re-generate png icon files from svg ones (CMake only for now)... Expects Inkscape program.
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/cmake/macros.cmake | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 854609f1665..e3c6169d77a 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -799,4 +799,35 @@ macro(data_to_c_simple unset(_file_from) unset(_file_to) unset(_file_to_path) + endmacro() + +macro(svg_to_png + file_from + file_to + dpi + list_to_add) + + # remove ../'s + get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH) + get_filename_component(_file_to ${CMAKE_CURRENT_SOURCE_DIR}/${file_to} REALPATH) + + list(APPEND ${list_to_add} ${_file_to}) + + find_program(INKSCAPE_EXE inkscape) + mark_as_advanced(INKSCAPE_EXE) + + if(INKSCAPE_EXE) + add_custom_command( + OUTPUT ${_file_to} + COMMAND ${INKSCAPE_EXE} ${_file_from} --export-dpi=${dpi} --without-gui --export-png=${_file_to} + DEPENDS ${_file_from} ${INKSCAPE_EXE} + ) + else() + message(WARNING "Inkscape not found, could not re-generate ${_file_to} from ${_file_from}!") + endif() + + unset(_file_from) + unset(_file_to) + +endmacro()
\ No newline at end of file |