diff --git a/tools/cmakev2/build.cmake b/tools/cmakev2/build.cmake index 3d311bc5ef..79e806a3bf 100644 --- a/tools/cmakev2/build.cmake +++ b/tools/cmakev2/build.cmake @@ -611,12 +611,12 @@ function(idf_build_executable executable) endfunction() #[[ - __get_components_metadata(COMPONENTS ... + __get_components_metadata(COMPONENTS ... OUTPUT ) *COMPONENTS[in]* - List of components for which to generate metadata. + List of component interfaces for which to generate metadata. *OUTPUT[out]* @@ -641,19 +641,20 @@ function(__get_components_metadata) set(components_json "") - foreach(name IN LISTS ARG_COMPONENTS) - idf_component_get_property(target ${name} COMPONENT_REAL_TARGET) - idf_component_get_property(alias ${name} COMPONENT_ALIAS) - idf_component_get_property(prefix ${name} __PREFIX) - idf_component_get_property(dir ${name} COMPONENT_DIR) - idf_component_get_property(type ${name} COMPONENT_TYPE) - idf_component_get_property(lib ${name} COMPONENT_LIB) - idf_component_get_property(reqs ${name} REQUIRES) - idf_component_get_property(include_dirs ${name} INCLUDE_DIRS) - idf_component_get_property(priv_reqs ${name} PRIV_REQUIRES) - idf_component_get_property(managed_reqs ${name} MANAGED_REQUIRES) - idf_component_get_property(managed_priv_reqs ${name} MANAGED_PRIV_REQUIRES) - idf_component_get_property(component_source ${name} COMPONENT_SOURCE) + foreach(interface IN LISTS ARG_COMPONENTS) + __idf_component_get_property_unchecked(name ${interface} COMPONENT_NAME) + __idf_component_get_property_unchecked(target ${interface} COMPONENT_REAL_TARGET) + __idf_component_get_property_unchecked(alias ${interface} COMPONENT_ALIAS) + __idf_component_get_property_unchecked(prefix ${interface} __PREFIX) + __idf_component_get_property_unchecked(dir ${interface} COMPONENT_DIR) + __idf_component_get_property_unchecked(type ${interface} COMPONENT_TYPE) + __idf_component_get_property_unchecked(lib ${interface} COMPONENT_LIB) + __idf_component_get_property_unchecked(reqs ${interface} REQUIRES) + __idf_component_get_property_unchecked(include_dirs ${interface} INCLUDE_DIRS) + __idf_component_get_property_unchecked(priv_reqs ${interface} PRIV_REQUIRES) + __idf_component_get_property_unchecked(managed_reqs ${interface} MANAGED_REQUIRES) + __idf_component_get_property_unchecked(managed_priv_reqs ${interface} MANAGED_PRIV_REQUIRES) + __idf_component_get_property_unchecked(component_source ${interface} COMPONENT_SOURCE) if("${type}" STREQUAL "LIBRARY") set(file "$") @@ -774,16 +775,18 @@ function(idf_build_generate_metadata binary) __make_json_list("${common_component_reqs}" OUTPUT common_component_reqs_json) idf_library_get_property(build_components "${library}" LIBRARY_COMPONENTS_LINKED) + idf_library_get_property(build_component_interfaces "${library}" LIBRARY_COMPONENT_INTERFACES_LINKED) list(SORT build_components) + list(SORT build_component_interfaces) __make_json_list("${build_components}" OUTPUT build_components_json) set(build_component_paths) set(COMPONENT_KCONFIGS) set(COMPONENT_KCONFIGS_PROJBUILD) - foreach(component_name IN LISTS build_components) - idf_component_get_property(component_dir "${component_name}" COMPONENT_DIR) - idf_component_get_property(component_kconfig "${component_name}" __KCONFIG) - idf_component_get_property(component_kconfig_projbuild "${component_name}" __KCONFIG_PROJBUILD) + foreach(component_interface IN LISTS build_component_interfaces) + __idf_component_get_property_unchecked(component_dir "${component_interface}" COMPONENT_DIR) + __idf_component_get_property_unchecked(component_kconfig "${component_interface}" __KCONFIG) + __idf_component_get_property_unchecked(component_kconfig_projbuild "${component_interface}" __KCONFIG_PROJBUILD) list(APPEND build_component_paths "${component_dir}") if(component_kconfig) list(APPEND COMPONENT_KCONFIGS "${component_kconfig}") @@ -794,10 +797,10 @@ function(idf_build_generate_metadata binary) endforeach() __make_json_list("${build_component_paths}" OUTPUT build_component_paths_json) - __get_components_metadata(COMPONENTS "${build_components}" OUTPUT build_component_info_json) + __get_components_metadata(COMPONENTS "${build_component_interfaces}" OUTPUT build_component_info_json) - idf_build_get_property(components_discovered COMPONENTS_DISCOVERED) - __get_components_metadata(COMPONENTS "${components_discovered}" OUTPUT all_component_info_json) + idf_build_get_property(component_interfaces COMPONENT_INTERFACES) + __get_components_metadata(COMPONENTS "${component_interfaces}" OUTPUT all_component_info_json) __generate_gdbinit() idf_build_get_property(gdbinit_files_prefix_map GDBINIT_FILES_PREFIX_MAP) diff --git a/tools/cmakev2/kconfig.cmake b/tools/cmakev2/kconfig.cmake index 3fe73365b8..a9a589b162 100644 --- a/tools/cmakev2/kconfig.cmake +++ b/tools/cmakev2/kconfig.cmake @@ -173,14 +173,14 @@ endfunction() __consolidate_component_kconfig_files() Consolidate Kconfig files from discovered components into global build - properties. This scans the COMPONENTS_DISCOVERED build property and for + properties. This scans the COMPONENT_INTERFACES build property and for each component, retrieves its Kconfig files from component properties and adds them to the global __KCONFIGS, __KCONFIG_PROJBUILDS, and __SDKCONFIG_RENAMES build properties. #]] function(__consolidate_component_kconfig_files) - idf_build_get_property(components_discovered COMPONENTS_DISCOVERED) - if(NOT components_discovered) + idf_build_get_property(component_interfaces COMPONENT_INTERFACES) + if(NOT component_interfaces) idf_die("No components discovered. This must be run after component discovery.") endif() @@ -190,12 +190,13 @@ function(__consolidate_component_kconfig_files) idf_build_set_property(__KCONFIG_PROJBUILDS "") idf_build_set_property(__SDKCONFIG_RENAMES "") - # Iterate through all discovered components and consolidate their Kconfig files - foreach(component_name IN LISTS components_discovered) + # Iterate through all interfaces of discovered components and consolidate + # their Kconfig files + foreach(component_interface IN LISTS component_interfaces) # Get Kconfig files from component properties - idf_component_get_property(component_kconfig "${component_name}" __KCONFIG) - idf_component_get_property(component_projbuild "${component_name}" __KCONFIG_PROJBUILD) - idf_component_get_property(component_rename "${component_name}" __SDKCONFIG_RENAME) + __idf_component_get_property_unchecked(component_kconfig "${component_interface}" __KCONFIG) + __idf_component_get_property_unchecked(component_projbuild "${component_interface}" __KCONFIG_PROJBUILD) + __idf_component_get_property_unchecked(component_rename "${component_interface}" __SDKCONFIG_RENAME) if(component_kconfig) idf_build_set_property(__KCONFIGS "${component_kconfig}" APPEND) @@ -395,20 +396,20 @@ function(__create_executable_config_env_file executable) __get_executable_library_or_die(TARGET "${executable}" OUTPUT library) - idf_library_get_property(components_linked "${library}" LIBRARY_COMPONENTS_LINKED) + idf_library_get_property(component_interfaces_linked "${library}" LIBRARY_COMPONENT_INTERFACES_LINKED) set(kconfigs "") set(kconfigs_projbuild "") set(kconfigs_excluded "") set(kconfigs_projbuild_excluded "") - idf_build_get_property(components_discovered COMPONENTS_DISCOVERED) - foreach(component_name IN LISTS components_discovered) - idf_component_get_property(component_kconfig "${component_name}" __KCONFIG) - idf_component_get_property(component_projbuild "${component_name}" __KCONFIG_PROJBUILD) + idf_build_get_property(component_interfaces COMPONENT_INTERFACES) + foreach(component_interface IN LISTS component_interfaces) + __idf_component_get_property_unchecked(component_kconfig "${component_interface}" __KCONFIG) + __idf_component_get_property_unchecked(component_projbuild "${component_interface}" __KCONFIG_PROJBUILD) if(component_kconfig) - if("${component_name}" IN_LIST components_linked) + if("${component_interface}" IN_LIST component_interfaces_linked) list(APPEND kconfigs "${component_kconfig}") else() list(APPEND kconfigs_excluded "${component_kconfig}") @@ -416,7 +417,7 @@ function(__create_executable_config_env_file executable) endif() if(component_projbuild) - if("${component_name}" IN_LIST components_linked) + if("${component_interface}" IN_LIST component_interfaces_linked) list(APPEND kconfigs_projbuild "${component_projbuild}") else() list(APPEND kconfigs_projbuild_excluded "${component_projbuild}") diff --git a/tools/cmakev2/manager.cmake b/tools/cmakev2/manager.cmake index 21bb433ea0..7bf8d6e658 100644 --- a/tools/cmakev2/manager.cmake +++ b/tools/cmakev2/manager.cmake @@ -184,9 +184,10 @@ function(__download_component_level_managed_components) # Build local components list from discovered components set(__contents "components:\n") - idf_build_get_property(component_names COMPONENTS_DISCOVERED) - foreach(name ${component_names}) - idf_component_get_property(dir ${name} COMPONENT_DIR) + idf_build_get_property(component_interfaces COMPONENT_INTERFACES) + foreach(interface ${component_interfaces}) + __idf_component_get_property_unchecked(name ${interface} COMPONENT_NAME) + __idf_component_get_property_unchecked(dir ${interface} COMPONENT_DIR) set(__contents "${__contents} - name: \"${name}\"\n path: \"${dir}\"\n") endforeach() file(WRITE ${local_components_list_file} "${__contents}") diff --git a/tools/cmakev2/project.cmake b/tools/cmakev2/project.cmake index 56c31b9a09..161a9c3e8c 100644 --- a/tools/cmakev2/project.cmake +++ b/tools/cmakev2/project.cmake @@ -85,7 +85,7 @@ function(__init_project_configuration) idf_build_get_property(idf_ver IDF_VER) idf_build_get_property(idf_target IDF_TARGET) - idf_build_get_property(components_discovered COMPONENTS_DISCOVERED) + idf_build_get_property(component_interfaces COMPONENT_INTERFACES) idf_build_get_property(build_dir BUILD_DIR) idf_build_get_property(project_dir PROJECT_DIR) idf_build_get_property(project_name PROJECT_NAME) @@ -457,8 +457,9 @@ function(__init_project_configuration) # Generate mapping for component paths set(gdbinit_file_lines) - foreach(component_name ${components_discovered}) - idf_component_get_property(component_dir ${component_name} COMPONENT_DIR) + foreach(component_interface ${component_interfaces}) + __idf_component_get_property_unchecked(component_name ${component_interface} COMPONENT_NAME) + __idf_component_get_property_unchecked(component_dir ${component_interface} COMPONENT_DIR) string(TOUPPER ${component_name} component_name_uppercase) set(substituted_path "/COMPONENT_${component_name_uppercase}_DIR") @@ -599,10 +600,11 @@ macro(idf_project_init) # Include all project_include.cmake files for the components that have # been discovered. - idf_build_get_property(component_names COMPONENTS_DISCOVERED) - foreach(component_name IN LISTS component_names) - idf_component_get_property(project_include ${component_name} __PROJECT_INCLUDE) - idf_component_get_property(component_dir ${component_name} COMPONENT_DIR) + idf_build_get_property(component_interfaces COMPONENT_INTERFACES) + foreach(component_interface IN LISTS component_interfaces) + __idf_component_get_property_unchecked(project_include ${component_interface} __PROJECT_INCLUDE) + __idf_component_get_property_unchecked(component_dir ${component_interface} COMPONENT_DIR) + __idf_component_get_property_unchecked(component_name ${component_interface} COMPONENT_NAME) if(project_include) set(COMPONENT_NAME ${component_name}) set(COMPONENT_DIR ${component_dir})