From ca4fd8d4cf43a8624a9c902682e157f80708d47b Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 27 Sep 2019 15:07:11 +0200 Subject: kicad_gerber.cmake: Adding KicadUtilsPython option to select which python binary to use. kicad_gerber.py: Sync from ee-python, support executing self with python3 if running under v2 and other way around. Useful if kicad is using the other version. --- cmake/kicad_gerber.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'cmake') diff --git a/cmake/kicad_gerber.cmake b/cmake/kicad_gerber.cmake index c56ed19..4e8c850 100644 --- a/cmake/kicad_gerber.cmake +++ b/cmake/kicad_gerber.cmake @@ -25,6 +25,10 @@ function(kicad_gerber) get_filename_component(pcb_file "${ARGS_PCB_FILE}" ABSOLUTE BASE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") get_filename_component(basename "${pcb_file}" NAME_WE) + if (NOT DEFINED KicadUtilsPython) + set(KicadUtilsPython python) + endif () + if (NOT ARGS_TARGET) set(target "${basename}-gerber") else () @@ -56,10 +60,11 @@ function(kicad_gerber) endif() execute_process( - COMMAND "${KicadUtilsPyDir}/kicad_gerber.py" + COMMAND "${KicadUtilsPython}" "${KicadUtilsPyDir}/kicad_gerber.py" --pcb "${pcb_file}" --output-directory "${out_dir}" - --detect-files-only ${CMAKE_CURRENT_BINARY_DIR}/${target}-gerber-index.txt + --detect-files-only + --index ${CMAKE_CURRENT_BINARY_DIR}/${target}-gerber-index.txt ${protel} ${uppercase_extensions} ${extended_gerber_attributes} @@ -107,6 +112,7 @@ function(kicad_gerber) OUTPUT ${ARGS_ZIP_FILE} MAIN_DEPENDENCY "${pcb_file}" DEPENDS ${outputs} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND cmake -E remove -f ${ARGS_ZIP_FILE} COMMAND zip -q ${ARGS_ZIP_FILE} -j ${outputs}) endif () -- cgit v1.2.3