Skip to content

Commit 3bdbcbb

Browse files
Damian-Nordickkasperczyk-no
authored andcommitted
[nrf noup] Patch chip_data_model.cmake
Make chip_data_model.cmake correctly determine CHIP_ROOT constant if that is not defined in the application CMake. Also, use Python3 selected by CMake. Signed-off-by: Damian Krolik <damian.krolik@nordicsemi.no>
1 parent c1046bc commit 3bdbcbb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

build/chip/chip_codegen.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ function(chip_codegen TARGET_NAME)
5252

5353
# Python is expected to be in the path
5454
#
55-
# find_package(Python3 REQUIRED)
55+
find_package(Python3 REQUIRED)
5656
add_custom_command(
5757
OUTPUT ${OUT_NAMES}
58-
COMMAND "${CHIP_ROOT}/scripts/codegen.py"
58+
COMMAND ${Python3_EXECUTABLE} "${CHIP_ROOT}/scripts/codegen.py"
5959
ARGS "--generator" "${ARG_GENERATOR}"
6060
"--output-dir" "${GEN_FOLDER}"
6161
"--expected-outputs" "${GEN_FOLDER}/expected.outputs"

src/app/chip_data_model.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
set(CHIP_APP_BASE_DIR ${CMAKE_CURRENT_LIST_DIR})
1818

19+
if (NOT CHIP_ROOT)
20+
get_filename_component(CHIP_ROOT ${CHIP_APP_BASE_DIR}/../.. REALPATH)
21+
endif()
22+
1923
include("${CHIP_ROOT}/build/chip/chip_codegen.cmake")
2024

2125
# Configure ${APP_TARGET} with source files associated with ${CLUSTER} cluster

0 commit comments

Comments
 (0)