Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: dts: Use temporary file for dts.cmake with sysbuild #2267

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion cmake/modules/dts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,26 @@ endif()
#
# Run GEN_DTS_CMAKE_SCRIPT.
#
# A temporary file is copied to the original file if it differs. This prevents issue such as a
# cycle when sysbuild is used of configuring and building multiple times due to the dts.cmake file
# of images having a newer modification time than the sysbuild build.ninja file, despite the
# output having not changed
#
set(dts_cmake_tmp ${DTS_CMAKE}.new)

execute_process(
COMMAND ${PYTHON_EXECUTABLE} ${GEN_DTS_CMAKE_SCRIPT}
--edt-pickle ${EDT_PICKLE}
--cmake-out ${DTS_CMAKE}
--cmake-out ${dts_cmake_tmp}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
RESULT_VARIABLE ret
)
if(NOT "${ret}" STREQUAL "0")
message(FATAL_ERROR "gen_dts_cmake.py failed with return code: ${ret}")
else()
zephyr_file_copy(${dts_cmake_tmp} ${DTS_CMAKE} ONLY_IF_DIFFERENT)
file(REMOVE ${dts_cmake_tmp})
set(dts_cmake_tmp)
message(STATUS "Including generated dts.cmake file: ${DTS_CMAKE}")
include(${DTS_CMAKE})
endif()
Expand Down
Loading