managed_components文件夹下的组件怎么被构建进项目中

18923849801
Posts: 2
Joined: Wed Nov 30, 2022 3:54 am

managed_components文件夹下的组件怎么被构建进项目中

Postby 18923849801 » Wed Nov 30, 2022 4:00 am

之前一直在用旧版本,最近下载了esp_idf的新版本,发现项目目录下文件结构发生了一些变化,引入了idf component manager工具,所有依赖的组件都被下载到component_managed中了,是不是可以理解成不用再去esp-idf、项目目录和extra_component_dirs下面的components搜索组件,需要的组件都在component_managed目录中了直接构建就可以了。

看旧版本get_started/blink的项目cmakelists里面有设置extra_component_dirs,但新版本(5.0或5.1)好像就没,没弄明白怎么把managed_components里的组件添加到项目里去的

18923849801
Posts: 2
Joined: Wed Nov 30, 2022 3:54 am

Re: managed_components文件夹下的组件怎么被构建进项目中

Postby 18923849801 » Thu Dec 01, 2022 2:13 am

含idf_components.ymi组件会到 https://components.espressif.com/下载所依赖的 ... onents文件夹中,所依赖的组件名称会被添加到components组件名称列表中,详情可到build.cmake中查看:
# Call for component manager to download dependencies for all components
idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
if(idf_component_manager EQUAL 1)
idf_build_get_property(build_dir BUILD_DIR)
set(managed_components_list_file ${build_dir}/managed_components_list.temp.cmake)
set(local_components_list_file ${build_dir}/local_components_list.temp.yml)
set(__contents "components:\n")
foreach(__component_name ${components})
idf_component_get_property(__component_dir ${__component_name} COMPONENT_DIR)
set(__contents "${__contents} - name: \"${__component_name}\"\n path: \"${__component_dir}\"\n")
endforeach()
file(WRITE ${local_components_list_file} "${__contents}")
# Call for the component manager to prepare remote dependencies
idf_build_get_property(python PYTHON)
idf_build_get_property(component_manager_interface_version __COMPONENT_MANAGER_INTERFACE_VERSION)
execute_process(COMMAND ${python}
"-m"
"idf_component_manager.prepare_components"
"--project_dir=${project_dir}"
"--interface_version=${component_manager_interface_version}"
"prepare_dependencies"
"--local_components_list_file=${local_components_list_file}"
"--managed_components_list_file=${managed_components_list_file}"
RESULT_VARIABLE result
ERROR_VARIABLE error)
if(NOT result EQUAL 0)
message(FATAL_ERROR "${error}")
endif()
include(${managed_components_list_file})
# Add managed components to list of all components
# `managed_components` contains the list of components installed by the component manager
# It is defined in the temporary managed_components_list_file file
set(__COMPONENTS "${__COMPONENTS};${managed_components}")

Who is online

Users browsing this forum: No registered users and 82 guests