Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake-first build #17

Merged
merged 2 commits into from
Oct 6, 2021
Merged

CMake-first build #17

merged 2 commits into from
Oct 6, 2021

Conversation

ivmarkov
Copy link
Collaborator

@ivmarkov ivmarkov commented Oct 6, 2021

@N3xed:

These changes are addressing the TODO (and this issue) where we did not support building the esp-idf-sys from mixed Rust/C projects, where the build is driven by cmake (as opposed to cargo).

The changes are as minimal as it gets, where the only new concept I had to introduce is the notion of EspIdfComponents. This was necessary, because the CMake-first builds (unlike PIO- and native- driven cargo-first ones and unlike the PIO-first ones) do NOT by default include all ESP-IDF components as part of the build). Therefore, we needed another set of cfg-s - similar in spirit to the kconfig ones, which are telling us which ESP-IDF components are part of the build. So that we can conditionally include the relevant headers in bindings.h, as well as use these cfg-s downstream to conditionally enable/disable Rust safe wrappers for those components in esp-idf-svc and esp-idf-hal.

I also took the freedom to move all build files into a build/ sub-folder, as they grew again a bit.

UPDATE: As for the changes necessary for CMake ESP-IDF projects so that these can take advantage of the CMake-first build of esp-idf-sys, look here.

@ivmarkov
Copy link
Collaborator Author

ivmarkov commented Oct 6, 2021

And no idea why it says there are conflicts. :)

Copy link
Collaborator

@N3xed N3xed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some small things, otherwise looks good to me.

The branch is not up to date with master (because of my last commit). That's why there is a conflict.

build/native.rs Outdated Show resolved Hide resolved
build/native.rs Outdated Show resolved Hide resolved
build/native.rs Outdated Show resolved Hide resolved
build_pio.rs Show resolved Hide resolved
@ivmarkov ivmarkov force-pushed the cmake-first-build branch 2 times, most recently from b711134 to e3dc61f Compare October 6, 2021 11:51
@ivmarkov
Copy link
Collaborator Author

ivmarkov commented Oct 6, 2021

@N3xed: All feedback addressed in the latest PR.
One more change: I rewrote the code where the ESP-IDF components' names are pushed as Tristate kconfig values, because these things are not really kconfigs so modelling them as such is a bit dirty. They are now directly pushed as Rust cfgs (and Bindgen -D clang_args), bypassing the kconfig layer.

@ivmarkov ivmarkov merged commit 69653db into master Oct 6, 2021
@ivmarkov ivmarkov deleted the cmake-first-build branch January 29, 2022 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants