From ca61cafa2bd04235203d43026710e3522bcdd088 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 21 Sep 2016 23:19:33 +0200 Subject: kicad_gerber: Support for renaming layers and uppercasing all extensions. --- cmake/kicad_gerber.cmake | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'cmake') diff --git a/cmake/kicad_gerber.cmake b/cmake/kicad_gerber.cmake index 330c5bd..580fa10 100644 --- a/cmake/kicad_gerber.cmake +++ b/cmake/kicad_gerber.cmake @@ -1,7 +1,7 @@ function(kicad_gerber) - set(options ALL) + set(options ALL UPPERCASE_EXTENSIONS) set(one_value_args TARGET PCB_FILE DIR ZIP_FILE NAMING_STYLE) - set(multi_value_args) + set(multi_value_args LAYER_EXTENSION) cmake_parse_arguments(ARGS "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN}) if (NOT ARGS_PCB_FILE) @@ -15,7 +15,7 @@ function(kicad_gerber) if (ARGS_NAMING_STYLE STREQUAL MODERN) elseif (ARGS_NAMING_STYLE STREQUAL PROTEL) - set(protel --protel-extension) + set(protel --protel-extensions) else () message(SEND_ERROR "Unsupported NAMING_STYLE: ${ARGS_NAMING_STYLE}") return() @@ -36,11 +36,19 @@ function(kicad_gerber) return() endif () + foreach (le ${ARGS_LAYER_EXTENSION}) + list(APPEND les --layer-extension ${le}) + endforeach () + + if (ARGS_UPPERCASE_EXTENSIONS) + set(uppercase_extensions --uppercase-extensions) + endif () + set(out_dir "${ARGS_DIR}") set(prefix "${out_dir}/${basename}") execute_process( - COMMAND "${KicadUtilsPyDir}/kicad_gerber.py" --pcb "${pcb_file}" --output-directory "${out_dir}" ${protel} --detect-files-only + COMMAND "${KicadUtilsPyDir}/kicad_gerber.py" --pcb "${pcb_file}" --output-directory "${out_dir}" ${protel} ${uppercase_extensions} ${les} --detect-files-only OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/${target}-gerber-index.txt OUTPUT_VARIABLE out ERROR_VARIABLE err @@ -53,16 +61,11 @@ function(kicad_gerber) return() endif () -# foreach (o ${out}) -# list(APPEND outputs ${prefix}${o}) -# endforeach () - - # message("out=${out}") - message("outputs=${outputs}") + message("outputs=${outputs}") add_custom_command( OUTPUT ${outputs} COMMAND cmake -E make_directory "${out_dir}" - COMMAND "${KicadUtilsPyDir}/kicad_gerber.py" --pcb "${pcb_file}" --output-directory "${out_dir}" ${protel} + COMMAND "${KicadUtilsPyDir}/kicad_gerber.py" --pcb "${pcb_file}" --output-directory "${out_dir}" ${protel} ${uppercase_extensions} ${les} MAIN_DEPENDENCY "${pcb_file}") if (ARGS_ALL) -- cgit v1.2.3