Skip to content
Snippets Groups Projects
Commit 65c45e8a authored by Simon Praetorius's avatar Simon Praetorius
Browse files

Improve inkscape_generate_png_from_svg

parent 8c7637c3
Branches
Tags
1 merge request!1058Improve inkscape_generate_png_from_svg
......@@ -36,16 +36,28 @@ function(inkscape_generate_png_from_svg)
set(INKSCAPE_DPI 90)
endif()
message(STATUS "Generate PNG from SVG in ${INKSCAPE_OUTPUT_DIR}")
set(_converted 0)
foreach(pic ${INKSCAPE_UNPARSED_ARGUMENTS})
string(REGEX REPLACE "\\.[a-zA-Z]+" ".svg" input ${pic})
if( INKSCAPE_NEW_VERSION )
execute_process(
COMMAND ${INKSCAPE} --export-dpi=${INKSCAPE_DPI} --export-type=png --export-filename=${pic} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
WORKING_DIRECTORY ${INKSCAPE_OUTPUT_DIR})
else()
execute_process(
COMMAND ${INKSCAPE} -z --export-dpi=${INKSCAPE_DPI} -e ${pic} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
WORKING_DIRECTORY ${INKSCAPE_OUTPUT_DIR})
if(NOT EXISTS ${INKSCAPE_OUTPUT_DIR}/${pic})
set(_converted 1)
if(INKSCAPE_NEW_VERSION)
execute_process(
COMMAND ${INKSCAPE} --export-dpi=${INKSCAPE_DPI} --export-type=png --export-filename=${pic} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
WORKING_DIRECTORY ${INKSCAPE_OUTPUT_DIR}
OUTPUT_QUIET)
else()
execute_process(
COMMAND ${INKSCAPE} -z --export-dpi=${INKSCAPE_DPI} -e ${pic} ${CMAKE_CURRENT_SOURCE_DIR}/${input}
WORKING_DIRECTORY ${INKSCAPE_OUTPUT_DIR}
OUTPUT_QUIET)
endif()
endif()
endforeach()
if(_converted)
message(STATUS "Generate PNG from SVG in ${INKSCAPE_OUTPUT_DIR} - done")
else()
message(STATUS "Generate PNG from SVG in ${INKSCAPE_OUTPUT_DIR} - skipped")
endif()
endfunction()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment