esp-rs / esp-idf-sys

Bindings for ESP-IDF (Espressif's IoT Development Framework)
Apache License 2.0
257 stars 120 forks source link

set CROSS_COMPILE env variable #308

Open sampaioletti opened 2 months ago

sampaioletti commented 2 months ago

Would it be feasible to have the CROSS_COMPILE environment variable set by this crate's build.rs. Building for a lot of esp targets requires manually changing it as cargo doesn't support per target env variables or using an external build runner.

Not sure if this would be done here or if it would have to come from the embuild crate so it would happen in the build.rs of the users project.

It could be a 'set if not already set' by user. Just a thought, Happy to PR if it makes sense.

Vollbrecht commented 2 months ago

A target alone is not enough information to successfully compile a project for it. You would at least also change the MCU variant, for example the riscvimc target is valid for both esp32c2 and esp32c3, but certain esp-idf options are coupled to the actual mcu variant and not the compile target.

In general we are happy for every PR but its a non-trivial problem to look for the right places to make it work. If you want to dig deeper and have questions we are always happy to answer them!