Chapter 4. API Guides
idf_component_register(SRCS "engine.c"
INCLUDE_DIRS "include"
PRIV_REQUIRES
As a result, source files in the car component don't need the spark_plug include directories added to their
compiler search path. This can speed up compilation, and stops compiler command lines from becoming longer than
necessary.
Spark Plug Component
file spark_plug.h, but this doesn't include headers from any other components.
This means that the spark_plug/CMakeLists.txt file doesn' t need any REQUIRES or PRIV_REQUIRES
clauses:
idf_component_register(SRCS "spark_plug.c"
INCLUDE_DIRS
Source File Include Directories
Each component's source file is compiled with these include path directories, as specified in the passed arguments
to idf_component_register:
idf_component_register(..
• The current component's INCLUDE_DIRS and PRIV_INCLUDE_DIRS.
• The INCLUDE_DIRS belonging to all other components listed in the REQUIRES and PRIV_REQUIRES
parameters (ie all the current component's public and private dependencies).
• Recursively, all of the INCLUDE_DIRS of those components REQUIRES lists (ie all public dependencies of
this component's dependencies, recursively expanded).
Main component requirements
The component named main is special because it automatically requires all other components in the build. So it's
not necessary to pass REQUIRES or PRIV_REQUIRES to this component. See
what needs to be changed if no longer using the main component.
Common component requirements
To avoid duplication, every component automatically requires some "common"IDF components even if they are
not mentioned explicitly. Headers from these components can always be included.
The list of common components is: cxx, newlib, freertos, esp_hw_support, heap, log, lwip, soc, hal, esp_rom,
esp_common, esp_system.
Including components in the build
• By default, every component is included in the build.
• If you set the COMPONENTS variable to a minimal list of components used directly by your project, then the
build will expand to also include required components. The full list of components will be:
– Components mentioned explicitly in COMPONENTS.
– Those components'requirements (evaluated recursively).
– The "common"components that every component depends on.
• Setting COMPONENTS to the minimal list of required components can significantly reduce compile times.
Espressif Systems
spark_plug)
The spark_plug component doesn't depend on anything else. It has a public header
".")
INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS
Submit Document Feedback
"other")
renaming main
1280
for a description of
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?