From eae277aba525a3350729e63895d2aabc03a4ffa5 Mon Sep 17 00:00:00 2001 From: xengineering Date: Fri, 14 Feb 2025 14:22:57 +0100 Subject: cmake: Add module with kicad_schematic_to_pdf This CMake function integrates converting the schematic to PDF as part of the standard build. --- cmake/kicad.cmake | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cmake/kicad.cmake (limited to 'cmake/kicad.cmake') diff --git a/cmake/kicad.cmake b/cmake/kicad.cmake new file mode 100644 index 0000000..126d2e4 --- /dev/null +++ b/cmake/kicad.cmake @@ -0,0 +1,23 @@ +function(kicad_schematic_to_pdf source target) + get_filename_component(name ${source} NAME) + get_filename_component(dir ${source} DIRECTORY) + file(RELATIVE_PATH rel "${CMAKE_SOURCE_DIR}" "${dir}") + set(name_pdf "${name}.pdf") + set(pdf ${CMAKE_BINARY_DIR}/${rel}/${name_pdf}) + + add_custom_command( + OUTPUT + ${pdf} + COMMAND + kicad-cli sch export pdf --output ${pdf} ${source} + DEPENDS + ${source} + ) + + add_custom_target( + "${target}" + ALL + DEPENDS + ${pdf} + ) +endfunction() -- cgit v1.2.3-70-g09d2