Mercurial > clickerconvert
annotate cmake/SvgToPng.cmake @ 0:49cd5cc0b072
Initial commit of project template (based on RetraceIT)
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 07 Mar 2016 17:35:09 +0100 |
parents | |
children |
rev | line source |
---|---|
0
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
1 macro(svg_to_png |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
2 file_from |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 file_to |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 dpi |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 size |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 list_to_add) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 # remove ../'s |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
9 get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 get_filename_component(_file_to ${CMAKE_CURRENT_SOURCE_DIR}/${file_to} REALPATH) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
11 |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 list(APPEND ${list_to_add} ${_file_to}) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 find_program(INKSCAPE_EXE inkscape) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 mark_as_advanced(INKSCAPE_EXE) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 if(INKSCAPE_EXE) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 add_custom_command( |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 OUTPUT ${_file_to} |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
20 COMMAND ${INKSCAPE_EXE} ${_file_from} --export-width=${size} --export-height=${size} --export-dpi=${dpi} --without-gui --export-png=${_file_to} |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 DEPENDS ${_file_from} ${INKSCAPE_EXE} |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
22 ) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
23 else() |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 message(WARNING "Inkscape not found, could not re-generate ${_file_to} from ${_file_from}!") |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 endif() |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 unset(_file_from) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 unset(_file_to) |
49cd5cc0b072
Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 endmacro() |