summaryrefslogtreecommitdiff
path: root/cmake/kicad.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/kicad.cmake')
-rw-r--r--cmake/kicad.cmake23
1 files changed, 23 insertions, 0 deletions
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()