Git Product home page Git Product logo

Comments (4)

N3xed avatar N3xed commented on May 31, 2024 1

There is currently no esp-idf-native way to do this, but you can do this with a sys-crate.

We actually propagate all esp-idf gcc include arguments here. They can then be retrieved in all dependent build scripts with:

embuild::build::CInclArgs::try_from_env("ESP_IDF")

With this and the compiler you can use embuild::cmake or the cc crate to compile your C library and embuild::bindgen to generate the Rust bindings.

The compiler path you can get using embuild::espidf::Installer::install(), which will give you the exported PATH (among other things) containing all the tools used (note: see this as an example). From the exported PATH the compiler binary can then be retrieved for example using the which crate.

from esp-idf-sys.

MabezDev avatar MabezDev commented on May 31, 2024

AFAIK there is no way to do this yet. Perhaps adding an env variable, or something in the Cargo.toml to allow specifying more header files? Instead of hardcoded to binding.h.

An alternative option is to move your custom component into a -sys crate itself, and manage the bindings from your side. esp-idf-sys exports the esp-idf include paths so it should be pretty easy to build the two crates together.

from esp-idf-sys.

YOxan avatar YOxan commented on May 31, 2024

I've tried to go in an other way, just with creating a wrapper around this component based on esp-idf-sys repo. But in that case linker is going crazy and I should add component to both esp-idf repo and created in wrapper crate to fix that. Will try to go with "include paths" as you suggested, but it would be really helpful if sometime esp-idf-sys could support this case.

from esp-idf-sys.

YOxan avatar YOxan commented on May 31, 2024

Awesome! Thanks for assistant, will try that

from esp-idf-sys.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.