feat(examples): trim down the plugins example build

Set the COMPONENTS project variable to streamline the build process.
Although the minimal build feature could be used to specify plugin
components in the main component dependencies, it's more convenient to
set the plugin components at the project level. This approach also
allows for quick selection of which plugins to include in the
application.

Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
Frantisek Hrbata 2025-01-06 19:23:42 +01:00
parent e66e8a7a28
commit c368f15328
2 changed files with 10 additions and 0 deletions

View File

@ -3,4 +3,6 @@
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# "Trim" the build. Include the minimal set of components, main, and plugins.
set(COMPONENTS main plugin_hello plugin_nihao)
project(plugins)

View File

@ -52,6 +52,14 @@ For each plugin, a structure describing the plugin (or a pointer to it) is place
## Example code overview
This example uses the optional `COMPONENTS` project variable to streamline the build process. By specifying components in this variable, only those components and their dependencies are linked to the application, reducing build time. Additionally, listing plugin components in the `COMPONENTS` variable ensures that only the specified plugins are linked. This approach provides a convenient way to quickly select the plugins to include in the application. The `COMPONENTS` variable is set in the project's CMakeLists.txt file:
```cmake
set(COMPONENTS main plugin_hello plugin_nihao)
```
For details about the `COMPONENTS` project variable, please refer to the Build System documentation.
This example contains 4 components:
* `main` — Only calls two sample functions defined in `plugins` component.