From 7f098579387bb16c775ab28490be2f347b05e51b Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Thu, 15 Sep 2016 00:37:46 +0200 Subject: 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. --- cmake/kicad_schematic_plot.cmake | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 cmake/kicad_schematic_plot.cmake (limited to 'cmake/kicad_schematic_plot.cmake') 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() -- cgit v1.2.3