Skip to content

Commit 964aa6d

Browse files
LuDudakkasperczyk-no
authored andcommitted
[nrf fromlist][cmake] Fix building issue due to lack of Python3 under Windows
This commit ensures that ${Python3_EXECUTABLE} is used when executing codegen_paths.py script. Upstream PR #: 40425 Signed-off-by: Łukasz Duda <[email protected]>
1 parent 1ef3e65 commit 964aa6d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

build/chip/chip_codegen.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ function(chip_codegen TARGET_NAME)
3333

3434
set(CHIP_CODEGEN_PREGEN_DIR "" CACHE PATH "Pre-generated directory to use instead of compile-time code generation.")
3535

36+
# Python is required for code generation
37+
find_package(Python3 REQUIRED)
38+
3639
# Output paths can contain placeholders such as
3740
# {{defined_cluster_name}} or {{server_cluster_name}}
3841
#
3942
# This translates them to the actually fully expanded path.
4043
execute_process(
41-
COMMAND "${CHIP_ROOT}/scripts/codegen_paths.py" "--idl" "${ARG_INPUT}" ${ARG_OUTPUTS}
44+
COMMAND "${Python3_EXECUTABLE}" "${CHIP_ROOT}/scripts/codegen_paths.py" "--idl" "${ARG_INPUT}" ${ARG_OUTPUTS}
4245
OUTPUT_VARIABLE GENERATED_PATHS_OUT
4346
)
4447
string(REPLACE "\n" ";" GENERATED_PATHS "${GENERATED_PATHS_OUT}")
@@ -60,12 +63,9 @@ function(chip_codegen TARGET_NAME)
6063
list(APPEND OUT_NAMES "${GEN_FOLDER}/${NAME}")
6164
endforeach()
6265

63-
# Python is expected to be in the path
64-
#
65-
find_package(Python3 REQUIRED)
6666
add_custom_command(
6767
OUTPUT ${OUT_NAMES}
68-
COMMAND ${Python3_EXECUTABLE} "${CHIP_ROOT}/scripts/codegen.py"
68+
COMMAND "${Python3_EXECUTABLE}" "${CHIP_ROOT}/scripts/codegen.py"
6969
ARGS "--generator" "${ARG_GENERATOR}"
7070
"--output-dir" "${GEN_FOLDER}"
7171
"--expected-outputs" "${GEN_FOLDER}/expected.outputs"

0 commit comments

Comments
 (0)