mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'feat/make_property_idf_component_manager_root_level_v4.2' into 'release/v4.2'
Feat/make property idf component manager root level (v4.2) See merge request espressif/esp-idf!19084
This commit is contained in:
@ -1186,6 +1186,7 @@ These are properties that describe the build. Values of build properties can be
|
|||||||
- EXECUTABLE - project executable; set by call to ``idf_build_executable``
|
- EXECUTABLE - project executable; set by call to ``idf_build_executable``
|
||||||
- EXECUTABLE_NAME - name of project executable without extension; set by call to ``idf_build_executable``
|
- EXECUTABLE_NAME - name of project executable without extension; set by call to ``idf_build_executable``
|
||||||
- EXECUTABLE_DIR - path containing the output executable
|
- EXECUTABLE_DIR - path containing the output executable
|
||||||
|
- IDF_COMPONENT_MANAGER - the component manager is enabled by default, but if this property is set to ``0`` it was disabled by the IDF_COMPONENT_MANAGER environment variable
|
||||||
- IDF_PATH - ESP-IDF path; set from IDF_PATH environment variable, if not, inferred from the location of ``idf.cmake``
|
- IDF_PATH - ESP-IDF path; set from IDF_PATH environment variable, if not, inferred from the location of ``idf.cmake``
|
||||||
- IDF_TARGET - target chip for the build; set from the required target argument for ``idf_build_process``
|
- IDF_TARGET - target chip for the build; set from the required target argument for ``idf_build_process``
|
||||||
- IDF_VER - ESP-IDF version; set from either a version file or the Git revision of the IDF_PATH repository
|
- IDF_VER - ESP-IDF version; set from either a version file or the Git revision of the IDF_PATH repository
|
||||||
|
@ -6,13 +6,6 @@ The IDF Component manager is a tool that downloads dependencies for any ESP-IDF
|
|||||||
|
|
||||||
A list of components can be found on `<https://components.espressif.com/>`_
|
A list of components can be found on `<https://components.espressif.com/>`_
|
||||||
|
|
||||||
Activating the Component Manager
|
|
||||||
================================
|
|
||||||
|
|
||||||
If CMake is started using ``idf.py`` or `ESP-IDF VSCode Extension <https://marketplace.visualstudio.com/items?itemName=espressif.esp-idf-extension>`_ then the component manager will be activated by default.
|
|
||||||
|
|
||||||
If CMake is used directly or with some CMake-based IDE like CLion, it's necessary to set the ``IDF_COMPONENT_MANAGER`` environment variable to ``1`` to enable the component manager integration with the build system.
|
|
||||||
|
|
||||||
Using with a project
|
Using with a project
|
||||||
====================
|
====================
|
||||||
|
|
||||||
@ -70,3 +63,8 @@ Defining dependencies in the manifest
|
|||||||
# # with relative or absolute path
|
# # with relative or absolute path
|
||||||
# some_local_component:
|
# some_local_component:
|
||||||
# path: ../../projects/component
|
# path: ../../projects/component
|
||||||
|
|
||||||
|
Disabling the Component Manager
|
||||||
|
===============================
|
||||||
|
|
||||||
|
The component manager can be explicitly disabled by setting ``IDF_COMPONENT_MANAGER`` environment variable to ``0``.
|
||||||
|
@ -95,15 +95,6 @@ build_esp_idf_tests_cmake_esp32s2:
|
|||||||
- $BOT_LABEL_EXAMPLE_TEST
|
- $BOT_LABEL_EXAMPLE_TEST
|
||||||
- $BOT_LABEL_REGULAR_TEST
|
- $BOT_LABEL_REGULAR_TEST
|
||||||
- $BOT_LABEL_WEEKEND_TEST
|
- $BOT_LABEL_WEEKEND_TEST
|
||||||
script:
|
|
||||||
# it's not possible to build 100% out-of-tree and have the "artifacts"
|
|
||||||
# mechanism work, but this is the next best thing
|
|
||||||
- mkdir ${BUILD_PATH}
|
|
||||||
- mkdir -p ${LOG_PATH}
|
|
||||||
- ${IDF_PATH}/tools/ci/build_examples.sh
|
|
||||||
# Check if the tests demand Make built binaries. If not, delete them
|
|
||||||
- if [ ${EXAMPLE_TEST_BUILD_SYSTEM} == "cmake" ]; then exit 0; fi
|
|
||||||
- rm -rf ${BUILD_PATH}
|
|
||||||
|
|
||||||
build_examples_make:
|
build_examples_make:
|
||||||
extends: .build_examples_template
|
extends: .build_examples_template
|
||||||
@ -127,6 +118,15 @@ build_examples_make:
|
|||||||
- schedules
|
- schedules
|
||||||
- pipelines
|
- pipelines
|
||||||
- web
|
- web
|
||||||
|
script:
|
||||||
|
# it's not possible to build 100% out-of-tree and have the "artifacts"
|
||||||
|
# mechanism work, but this is the next best thing
|
||||||
|
- mkdir ${BUILD_PATH}
|
||||||
|
- mkdir -p ${LOG_PATH}
|
||||||
|
- ${IDF_PATH}/tools/ci/build_examples.sh
|
||||||
|
# Check if the tests demand Make built binaries. If not, delete them
|
||||||
|
- if [ ${EXAMPLE_TEST_BUILD_SYSTEM} == "cmake" ]; then exit 0; fi
|
||||||
|
- rm -rf ${BUILD_PATH}
|
||||||
|
|
||||||
# same as above, but for CMake
|
# same as above, but for CMake
|
||||||
.build_examples_cmake: &build_examples_cmake
|
.build_examples_cmake: &build_examples_cmake
|
||||||
@ -147,6 +147,17 @@ build_examples_make:
|
|||||||
LOG_PATH: "${CI_PROJECT_DIR}/log_examples"
|
LOG_PATH: "${CI_PROJECT_DIR}/log_examples"
|
||||||
BUILD_PATH: "${CI_PROJECT_DIR}/build_examples"
|
BUILD_PATH: "${CI_PROJECT_DIR}/build_examples"
|
||||||
EXAMPLE_TEST_BUILD_SYSTEM: "cmake"
|
EXAMPLE_TEST_BUILD_SYSTEM: "cmake"
|
||||||
|
script:
|
||||||
|
# install idf-component-manager inside CI pipeline to avoid breaking python packages dependencies
|
||||||
|
- pip install "idf-component-manager~=1.1"
|
||||||
|
# it's not possible to build 100% out-of-tree and have the "artifacts"
|
||||||
|
# mechanism work, but this is the next best thing
|
||||||
|
- mkdir ${BUILD_PATH}
|
||||||
|
- mkdir -p ${LOG_PATH}
|
||||||
|
- ${IDF_PATH}/tools/ci/build_examples.sh
|
||||||
|
# Check if the tests demand Make built binaries. If not, delete them
|
||||||
|
- if [ ${EXAMPLE_TEST_BUILD_SYSTEM} == "cmake" ]; then exit 0; fi
|
||||||
|
- rm -rf ${BUILD_PATH}
|
||||||
|
|
||||||
build_examples_cmake_esp32:
|
build_examples_cmake_esp32:
|
||||||
extends: .build_examples_cmake
|
extends: .build_examples_cmake
|
||||||
|
@ -138,6 +138,7 @@ function(__build_init idf_path)
|
|||||||
|
|
||||||
idf_build_set_property(__PREFIX idf)
|
idf_build_set_property(__PREFIX idf)
|
||||||
idf_build_set_property(__CHECK_PYTHON 1)
|
idf_build_set_property(__CHECK_PYTHON 1)
|
||||||
|
idf_build_set_property(IDF_COMPONENT_MANAGER 0)
|
||||||
|
|
||||||
__build_set_default_build_specifications()
|
__build_set_default_build_specifications()
|
||||||
|
|
||||||
@ -404,6 +405,35 @@ macro(idf_build_process target)
|
|||||||
|
|
||||||
idf_build_set_property(__COMPONENT_REQUIRES_COMMON ${target} APPEND)
|
idf_build_set_property(__COMPONENT_REQUIRES_COMMON ${target} APPEND)
|
||||||
|
|
||||||
|
idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
|
||||||
|
if(idf_component_manager EQUAL "1")
|
||||||
|
set(managed_components_list_file ${CMAKE_BINARY_DIR}/managed_components_list.temp.cmake)
|
||||||
|
|
||||||
|
# Call for package manager to prepare remote dependencies
|
||||||
|
execute_process(COMMAND ${PYTHON}
|
||||||
|
"-m"
|
||||||
|
"idf_component_manager.prepare_components"
|
||||||
|
"--project_dir=${CMAKE_CURRENT_LIST_DIR}"
|
||||||
|
"prepare_dependencies"
|
||||||
|
"--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
|
||||||
|
include(${managed_components_list_file})
|
||||||
|
file(REMOVE ${managed_components_list_file})
|
||||||
|
else()
|
||||||
|
message(VERBOSE "IDF Component manager was explicitly disabled by setting IDF_COMPONENT_MANAGER=0")
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/idf_project.yml")
|
||||||
|
message(WARNING "\"idf_project.yml\" file is found in project directory, "
|
||||||
|
"but component manager is not enabled. Please set IDF_COMPONENT_MANAGER environment variable.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Perform early expansion of component CMakeLists.txt in CMake scripting mode.
|
# Perform early expansion of component CMakeLists.txt in CMake scripting mode.
|
||||||
# It is here we retrieve the public and private requirements of each component.
|
# It is here we retrieve the public and private requirements of each component.
|
||||||
# It is also here we add the common component requirements to each component's
|
# It is also here we add the common component requirements to each component's
|
||||||
|
@ -222,7 +222,7 @@ function(__component_get_requirements)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
|
idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
|
||||||
if(idf_component_manager AND idf_component_manager EQUAL "1")
|
if(idf_component_manager EQUAL 1)
|
||||||
# Call for component manager once again to inject dependencies
|
# Call for component manager once again to inject dependencies
|
||||||
idf_build_get_property(python PYTHON)
|
idf_build_get_property(python PYTHON)
|
||||||
execute_process(COMMAND ${python}
|
execute_process(COMMAND ${python}
|
||||||
|
@ -37,6 +37,13 @@ endif()
|
|||||||
# value passed externally.
|
# value passed externally.
|
||||||
__target_init()
|
__target_init()
|
||||||
|
|
||||||
|
# Enable the component manager for regular projects if not explicitly disabled.
|
||||||
|
if(NOT "$ENV{IDF_COMPONENT_MANAGER}" EQUAL "0")
|
||||||
|
idf_build_set_property(IDF_COMPONENT_MANAGER 1)
|
||||||
|
endif()
|
||||||
|
# Set component manager interface version
|
||||||
|
idf_build_set_property(__COMPONENT_MANAGER_INTERFACE_VERSION 0)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Get the project version from either a version file or the Git revision. This is passed
|
# Get the project version from either a version file or the Git revision. This is passed
|
||||||
# to the idf_build_process call. Dependencies are also set here for when the version file
|
# to the idf_build_process call. Dependencies are also set here for when the version file
|
||||||
@ -172,8 +179,6 @@ function(__project_init components_var test_components_var)
|
|||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
idf_build_set_property(IDF_COMPONENT_MANAGER "$ENV{IDF_COMPONENT_MANAGER}")
|
|
||||||
|
|
||||||
# Add component directories to the build, given the component filters, exclusions
|
# Add component directories to the build, given the component filters, exclusions
|
||||||
# extra directories, etc. passed from the root CMakeLists.txt.
|
# extra directories, etc. passed from the root CMakeLists.txt.
|
||||||
if(COMPONENT_DIRS)
|
if(COMPONENT_DIRS)
|
||||||
@ -188,39 +193,6 @@ function(__project_init components_var test_components_var)
|
|||||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/idf_project.yml")
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/idf_project.yml")
|
||||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/dependencies.lock")
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/dependencies.lock")
|
||||||
|
|
||||||
idf_build_get_property(idf_component_manager IDF_COMPONENT_MANAGER)
|
|
||||||
if(idf_component_manager)
|
|
||||||
if(idf_component_manager EQUAL "0")
|
|
||||||
message(VERBOSE "IDF Component manager was explicitly disabled by setting IDF_COMPONENT_MANAGER=0")
|
|
||||||
elseif(idf_component_manager EQUAL "1")
|
|
||||||
set(managed_components_list_file ${CMAKE_BINARY_DIR}/managed_components_list.temp.cmake)
|
|
||||||
|
|
||||||
# Call for package manager to prepare remote dependencies
|
|
||||||
execute_process(COMMAND ${PYTHON}
|
|
||||||
"-m"
|
|
||||||
"idf_component_manager.prepare_components"
|
|
||||||
"--project_dir=${CMAKE_CURRENT_LIST_DIR}"
|
|
||||||
"prepare_dependencies"
|
|
||||||
"--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
|
|
||||||
include(${managed_components_list_file})
|
|
||||||
file(REMOVE ${managed_components_list_file})
|
|
||||||
else()
|
|
||||||
message(WARNING "IDF_COMPONENT_MANAGER environment variable is set to unknown value "
|
|
||||||
"\"${idf_component_manager}\". If you want to use component manager set it to 1.")
|
|
||||||
endif()
|
|
||||||
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/idf_project.yml")
|
|
||||||
message(WARNING "\"idf_project.yml\" file is found in project directory, "
|
|
||||||
"but component manager is not enabled. Please set IDF_COMPONENT_MANAGER environment variable.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Look for components in the usual places: CMAKE_CURRENT_LIST_DIR/main,
|
# Look for components in the usual places: CMAKE_CURRENT_LIST_DIR/main,
|
||||||
# CMAKE_CURRENT_LIST_DIR/components, and the extra component dirs
|
# CMAKE_CURRENT_LIST_DIR/components, and the extra component dirs
|
||||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/main")
|
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/main")
|
||||||
|
Reference in New Issue
Block a user