feat(cmakev2/idf): initialize IDF_TARGET_ARCH build property

Based on the configuration, set the IDF_TARGET build property. This is
also set by cmakev1 and can be used to easily determine the architecture
for the project.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata
2025-08-20 14:52:39 +02:00
parent 62fc12c2ad
commit 91e283c10e
+22
View File
@@ -458,6 +458,24 @@ function(__init_submodules)
endforeach()
endfunction()
#[[
__init_idf_target_arch()
Set the IDF_TARGET_ARCH value based on the sdkconfig. This means it must be
initialized after the sdkconfig is generated and its CMake version is
included.
#]]
function(__init_idf_target_arch)
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
idf_build_set_property(IDF_TARGET_ARCH "xtensa")
elseif(CONFIG_IDF_TARGET_ARCH_RISCV)
idf_build_set_property(IDF_TARGET_ARCH "riscv")
else()
# Currently, no architecture is specified for Linux host builds.
idf_build_set_property(IDF_TARGET_ARCH "")
endif()
endfunction()
#[[
The idf_build_properties interface target is exclusively used to store
information about global build properties and is not linked or used in any
@@ -556,6 +574,10 @@ if(NOT EXISTS "${sdkconfig_cmake}")
endif()
include("${sdkconfig_cmake}")
# Initialize the target architecture based on the configuration. Ensure this is
# done after including the sdkconfig.
__init_idf_target_arch()
#[[ TODO
Many of the following things are already implemented in PoC !38337, but they