mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
feat: add component_source property to component targets
This commit is contained in:
@@ -61,7 +61,7 @@ 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 2)
|
||||
idf_build_set_property(__COMPONENT_MANAGER_INTERFACE_VERSION 3)
|
||||
|
||||
#
|
||||
# Parse and store the VERSION argument provided to the project() command.
|
||||
@@ -427,11 +427,11 @@ function(__project_init components_var test_components_var)
|
||||
idf_build_set_property(CXX_COMPILE_OPTIONS "${extra_cxxflags}" APPEND)
|
||||
idf_build_set_property(COMPILE_OPTIONS "${extra_cppflags}" APPEND)
|
||||
|
||||
function(__project_component_dir component_dir)
|
||||
function(__project_component_dir component_dir component_source)
|
||||
get_filename_component(component_dir "${component_dir}" ABSOLUTE)
|
||||
# The directory itself is a valid idf component
|
||||
if(EXISTS ${component_dir}/CMakeLists.txt)
|
||||
idf_build_component(${component_dir})
|
||||
idf_build_component(${component_dir} ${component_source})
|
||||
else()
|
||||
idf_build_get_property(exclude_dirs EXTRA_COMPONENT_EXCLUDE_DIRS)
|
||||
# otherwise, check whether the subfolders are potential idf components
|
||||
@@ -440,7 +440,7 @@ function(__project_init components_var test_components_var)
|
||||
if(IS_DIRECTORY ${component_dir} AND NOT ${component_dir} IN_LIST exclude_dirs)
|
||||
__component_dir_quick_check(is_component ${component_dir})
|
||||
if(is_component)
|
||||
idf_build_component(${component_dir})
|
||||
idf_build_component(${component_dir} ${component_source})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -458,11 +458,11 @@ function(__project_init components_var test_components_var)
|
||||
if(NOT EXISTS ${component_abs_path})
|
||||
message(FATAL_ERROR "Directory specified in COMPONENT_DIRS doesn't exist: ${component_abs_path}")
|
||||
endif()
|
||||
__project_component_dir(${component_dir})
|
||||
__project_component_dir(${component_dir} "project_components")
|
||||
endforeach()
|
||||
else()
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/main")
|
||||
__project_component_dir("${CMAKE_CURRENT_LIST_DIR}/main")
|
||||
__project_component_dir("${CMAKE_CURRENT_LIST_DIR}/main" "project_components")
|
||||
endif()
|
||||
|
||||
paths_with_spaces_to_list(EXTRA_COMPONENT_DIRS)
|
||||
@@ -471,12 +471,12 @@ function(__project_init components_var test_components_var)
|
||||
if(NOT EXISTS ${component_abs_path})
|
||||
message(FATAL_ERROR "Directory specified in EXTRA_COMPONENT_DIRS doesn't exist: ${component_abs_path}")
|
||||
endif()
|
||||
__project_component_dir("${component_dir}")
|
||||
__project_component_dir("${component_dir}" "project_extra_components")
|
||||
endforeach()
|
||||
|
||||
# Look for components in the usual places: CMAKE_CURRENT_LIST_DIR/main,
|
||||
# extra component dirs, and CMAKE_CURRENT_LIST_DIR/components
|
||||
__project_component_dir("${CMAKE_CURRENT_LIST_DIR}/components")
|
||||
__project_component_dir("${CMAKE_CURRENT_LIST_DIR}/components" "project_components")
|
||||
endif()
|
||||
|
||||
# For bootloader components, we only need to set-up the Kconfig files.
|
||||
@@ -528,7 +528,7 @@ function(__project_init components_var test_components_var)
|
||||
set(include 0)
|
||||
endif()
|
||||
if(include AND EXISTS ${component_dir}/test)
|
||||
__component_add(${component_dir}/test ${component_name})
|
||||
__component_add(${component_dir}/test ${component_name} "project_components")
|
||||
list(APPEND test_components ${component_name}::test)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user