-
Notifications
You must be signed in to change notification settings - Fork 140
Description
Getting esp-idf-sys to build external components is relatively simple, I have PoC locally building esp-rainmaker. The hard part is how we tell esp-idf-sys where these external components are and what includes we need. Essentially the inter-crate communication.
It seems there is no way (unless I'm missing something, and I hope I am because it would make this really easy) in cargo to set environment variables for dependent crates; therefore a separate crate that depends on esp-idf-sys is out of the question because we can't give esp-idf-sys the information it needs to build these external components.
Option 1 - env variables in the final application
We already set custom variables to dictate the build, added something like ESP_IDF_EXTRA_COMPONENT_PATHS could work. The downside to this is that its yet another thing a user has to remember to include, and if its the case we have a separate wrapper crate for some external components we will get weird missing item errors when we try and build that crate if we forget to add our extra component variable
Option 2 - esp-idf-sys becomes monolithic
Instead of being able to customize the build process, the way to add new components would be to add them at the source level in esp-idf-sys. esp-idf-sys will then take care of downloading the external component and adding it into its normal build process. To save build time, it might be a good idea to put these external components behind feature flags.
There may be better options I haven't considered, I won't lie I'm not an expert in esp-idf-sys's build system hence why I am opening this 😅.