diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2016-09-15 00:37:46 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2016-09-15 00:37:46 +0200 |
commit | 7f098579387bb16c775ab28490be2f347b05e51b (patch) | |
tree | 4064322990b90a42d155d0d9c14a4ea11af717ae /cmake/kicad_schematic_plot.cmake | |
parent | e4444b71b96c896690817a02cf66199183b68a19 (diff) | |
download | kicad-utils-7f098579387bb16c775ab28490be2f347b05e51b.tar.gz kicad-utils-7f098579387bb16c775ab28490be2f347b05e51b.tar.bz2 kicad-utils-7f098579387bb16c775ab28490be2f347b05e51b.tar.xz kicad-utils-7f098579387bb16c775ab28490be2f347b05e51b.zip |
Adding CMake commands:
kicad_pcb_plot() that plots the PCB in PDF, PS and SVG formats.
kicad_gerber() that generates GERBER files from a PCB. Can optionally create a ZIP file with all the files. Supports old (protel) naming of files.
Diffstat (limited to 'cmake/kicad_schematic_plot.cmake')
-rw-r--r-- | cmake/kicad_schematic_plot.cmake | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/cmake/kicad_schematic_plot.cmake b/cmake/kicad_schematic_plot.cmake new file mode 100644 index 0000000..d4b77f9 --- /dev/null +++ b/cmake/kicad_schematic_plot.cmake @@ -0,0 +1,46 @@ +function(kicad_schematic_plot) + set(options ALL) + set(one_value_args TARGET SCHEMATIC_FILE DIR) + set(multi_value_args) + cmake_parse_arguments(kicad_schematic_plot "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) + + if (NOT kicad_schematic_plot_SCHEMATIC_FILE) + message(SEND_ERROR "Missing required argument: SCHEMATIC_FILE") + return() + endif () + + set(schematic_file "${kicad_schematic_plot_SCHEMATIC_FILE}") + get_filename_component(schematic_file "${kicad_schematic_plot_SCHEMATIC_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + get_filename_component(basename "${schematic_file}" NAME_WE) + + if (NOT kicad_schematic_plot_TARGET) + set(target "${basename}-plots") + else () + set(target "${kicad_schematic_plot_TARGET}") + endif () + + if (NOT kicad_schematic_plot_DIR) + message(SEND_ERROR "Missing required argument: DIR") + return() + endif () + + set(out_dir "${kicad_schematic_plot_DIR}") + set(pdf_prefix "${out_dir}/${basename}") + + set(outputs + "${pdf_prefix}.pdf") + + add_custom_command( + OUTPUT ${outputs} + COMMAND cmake -E make_directory "${out_dir}" + COMMAND "${KicadUtilsPyDir}/kicad_schematic_plot.py" "${schematic_file}" "${out_dir}" + MAIN_DEPENDENCY "${schematic_file}") + + if (kicad_schematic_plot_ALL) + set(all ALL) + endif () + + add_custom_target( + ${target} ${all} + DEPENDS ${outputs}) +endfunction() |