There are idf.py hints for helping the user to set component
dependencies properly instead of building sources out-of-component or
including headers from outside the component directory. These are
produced with
tools/idf_py_actions/hint_modules/component_requirements.py.
However, idf.py hints are printed only when the build fails. If the user
starts with a buildable solution then the suggestions to add component
dependencies are not printed.
This commit introduces cmake-level warnings for building source files
from outside the component and including header files without setting up
proper component dependencies.
This commit adds new CMake APIs for the build system, viz.,
idf_build_add_post_elf_dependency() and
idf_build_get_post_elf_dependencies().
These APIs allow components to add post-ELF processing hooks before the
binary file is generated.
Closes https://github.com/espressif/esp-idf/issues/17251
The test create build folder in current directory which
in this case is defined by (test_app_copy).
It also creates sdkconfig file in cmake source directory, which
is defined as $IDF_PATH/examples/build_system/cmake/idf_as_lib
The fixtures ensures proper cleanup even when test fails.
The `idf_as_lib` example is used and tested in
`tools/test_build_system/test_cmake.py`. Include `idf_as_lib` in the
build_system rules to ensure the tests are executed whenever there is a
modification in the `idf_as_lib` example.
Expand the `test_build_custom_cmake_project` test to cover all supported
targets, including host build.
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
The test_build_cmake_library_psram_workaround verifies that the
mfix-esp32-psram-cache-issue flag is applied to all compile commands in
compile_commands.json when CONFIG_SPIRAM_CACHE_WORKAROUND=y. Although
the import_lib does not need the esp_psram component, this test does. To
avoid adding the esp_psram dependency to the import_lib, disable
MINIMAL_BUILD for this test by explicitly setting the COMPONENTS
variable.
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
The parametrization include `[` and `]` in names. This is not
possible to use within path. Expand the sanitization into all
fixtures using request.node.name.
Previously the error message was
CMake Error at /home/user/esp-idf/tools/cmake/build.cmake:296 (__component_get_property):
__component_get_property Function invoked with incorrect arguments for
function named: __component_get_property
Call Stack (most recent call first):
/home/user/esp-idf/tools/cmake/build.cmake:341 (__build_resolve_and_add_req)
/home/user/esp-idf/tools/cmake/build.cmake:638 (__build_expand_requirements)
/home/user/esp-idf/tools/cmake/project.cmake:710 (idf_build_process)
CMakeLists.txt:6 (project)
Now it will be:
CMake Error at /home/user/esp-idf/tools/cmake/build.cmake:298 (message):
Failed to resolve component 'whatever' required by component 'main'.
Call Stack (most recent call first):
/home/user/esp-idf/tools/cmake/build.cmake:345 (__build_resolve_and_add_req)
/home/user/esp-idf/tools/cmake/build.cmake:642 (__build_expand_requirements)
/home/user/esp-idf/tools/cmake/project.cmake:710 (idf_build_process)
CMakeLists.txt:6 (project)
Also improved the hint to show the component name in quotes.
- Move file-related functions bin_file_contains and file_contains
from idf_utils.py and existing functions from editing.py into a new
file file_utils.py
- Add a function 'bin_files_differ' to compare binary files
Closes https://github.com/espressif/esp-idf/pull/14036
[Frantisek Hrbata: fixed spelling not related to this change so spellcheck succeeds]
[Frantisek Hrbata: modified the error message to be recognized by the existing hint]
[Frantisek Hrbata: added also check in idf_component_set_property and simple tests]
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
There is currently a bug in the __build_resolve_and_add_req function in
tools/cmake/build.cmake where the check for registered component
requirements is incorrectly applied to the component itself rather than
its dependencies. This issue likely originated from a typo, using
component_target instead of _component_target. To prevent further
confusion, _component_target has been renamed to _req_target.
Fixing this revealed multiple incorrect dependencies for the Linux
target, which have now been resolved by explicitly specifying the
dependencies for the Linux target.
Closes https://github.com/espressif/esp-idf/issues/13447
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>