summaryrefslogtreecommitdiff
path: root/cmake/kicad.cmake
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-02-14 15:04:59 +0100
committerxengineering <me@xengineering.eu>2025-02-14 15:04:59 +0100
commit7a561e43809c9cfac13fba3e572844041ea6411b (patch)
tree888e624b42dd749318e626246269485675b4c9d1 /cmake/kicad.cmake
parent7b68bbb92296a2f3740bd6b22fec157197bf06fd (diff)
downloadiot-contact-7a561e43809c9cfac13fba3e572844041ea6411b.tar
iot-contact-7a561e43809c9cfac13fba3e572844041ea6411b.tar.zst
iot-contact-7a561e43809c9cfac13fba3e572844041ea6411b.zip
pcb: Rename targets, functions and output files
This simplifies the CMake code and the paths inside the build folder.
Diffstat (limited to 'cmake/kicad.cmake')
-rw-r--r--cmake/kicad.cmake40
1 files changed, 14 insertions, 26 deletions
diff --git a/cmake/kicad.cmake b/cmake/kicad.cmake
index 6c2f612..469b3a5 100644
--- a/cmake/kicad.cmake
+++ b/cmake/kicad.cmake
@@ -1,51 +1,39 @@
-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})
+function(kicad_schematic_pdf target sink source)
+ add_custom_target(
+ "${target}"
+ ALL
+ DEPENDS
+ ${sink}
+ )
add_custom_command(
OUTPUT
- ${pdf}
+ ${sink}
COMMAND
- kicad-cli sch export pdf --output ${pdf} ${source}
+ kicad-cli sch export pdf --output ${sink} ${source}
DEPENDS
${source}
JOB_POOL
kicad
)
+endfunction()
+function(kicad_bom_csv target sink source)
add_custom_target(
"${target}"
ALL
DEPENDS
- ${pdf}
+ ${sink}
)
-endfunction()
-
-function(kicad_bom_to_csv source target)
- get_filename_component(name ${source} NAME)
- get_filename_component(dir ${source} DIRECTORY)
- file(RELATIVE_PATH rel "${CMAKE_SOURCE_DIR}" "${dir}")
- set(name_csv "${name}.csv")
- set(csv ${CMAKE_BINARY_DIR}/${rel}/${name_csv})
add_custom_command(
OUTPUT
- ${csv}
+ ${sink}
COMMAND
- kicad-cli sch export bom --output ${csv} ${source}
+ kicad-cli sch export bom --output ${sink} ${source}
DEPENDS
${source}
JOB_POOL
kicad
)
-
- add_custom_target(
- "${target}"
- ALL
- DEPENDS
- ${csv}
- )
endfunction()