How do I build to support multiple variants of an Application?
Posted: Wed Mar 23, 2022 1:48 pm
I have an App that builds (against ESP-IDF) for a board used in one product.
I need to build the same App for the same board to be used in a different product. The second build requires a subset of the code (i.e., some of the files are not included) used in the original product, plus some 'variation' of the original code (i.e., different screens defined, some features not used, etc.).
For any build, the ESP-IDF build definition will be constant (i.e 'sdkconfig' does not change).
It seems like CMake defines the 'variant' system (cmake-variants.yaml) to address this type of issue, but it's not clear to me this is ideal, as changing variants might (?) require rebuilding of ALL components for each variant. Also, I don't see that use of CMake variants is explicitly supported in the ESP-IDF build system.
I might be able to use the ESP-IDF concept of 'Apps' to define the requirements for each build, but this also might (?) require rebuilding of ALL components for each variant.
I'm building on Linux, so I might be able to setup a second folder, soft-linking source files as required, plus using "#ifdef" extensively, but this seems fragile & convoluted.
Ideally, I would like a simple way to build the SDK components once, then rebuild only my App for each 'application variant' as I make changes to App source.
Does the ESP-IDF build system support this? If so, what is the preferred / recommended way to configure it?
I need to build the same App for the same board to be used in a different product. The second build requires a subset of the code (i.e., some of the files are not included) used in the original product, plus some 'variation' of the original code (i.e., different screens defined, some features not used, etc.).
For any build, the ESP-IDF build definition will be constant (i.e 'sdkconfig' does not change).
It seems like CMake defines the 'variant' system (cmake-variants.yaml) to address this type of issue, but it's not clear to me this is ideal, as changing variants might (?) require rebuilding of ALL components for each variant. Also, I don't see that use of CMake variants is explicitly supported in the ESP-IDF build system.
I might be able to use the ESP-IDF concept of 'Apps' to define the requirements for each build, but this also might (?) require rebuilding of ALL components for each variant.
I'm building on Linux, so I might be able to setup a second folder, soft-linking source files as required, plus using "#ifdef" extensively, but this seems fragile & convoluted.
Ideally, I would like a simple way to build the SDK components once, then rebuild only my App for each 'application variant' as I make changes to App source.
Does the ESP-IDF build system support this? If so, what is the preferred / recommended way to configure it?