I have a library that depends on another library for “classic esp32”, but not for the esp32c3.
Is there a way to specify this in my library.json
?
To be more specific: for esp32 I depend on the madhephaestus/ESP32Encoder
library, because I use it for my rotary encoders. But the esp32-c3 misses the required counter hardware, and moreover the ESP32Encoder
library fails to compile if you have selected an esp32-c3 board.
So I would like to somehow specify that that library is a dependency only for “normal” esp32, not esp32c3.
Is that somehow possible? I’ve searched both the documentation and the forums and I haven’t been able to come up with a solution (or workaround, or hack).
Set the LDF mode to chain+ and use conditional #ifdef
to include one library or the other (#ifdef __riscv
). The LDF should then filter out the unused library from compilation.
Using chain+
works fine for my platform.ini
, but I don’t think I can use this in my library.json
, right?
So, then I would have to instruct all users of my library to use chain+
, and moreover I have no idea what I should do in my library. Not specify the madhephaestus/ESP32Encoder
library at all and simply depend on the end-user chain+
to find the dependency?
Yes you can, I linked you to it in
Also see general overview page.
You add both dependencies in the library.json
, the LDF setting and your code will filter the unneeded one out at the next stage.
Doesn’t work, at least not the way I use it. Which is sort-of indirect: my library config header has things like
#ifdef ESP32
#define USE_DEPENDENCY
#endif
And then one of the source files in my library has
#ifdef USE_DEPENDENCY
#include <Dependency.h>
#endif
I have tried all sort of options for the LDF but it will simply not find the dependency on Dependency.h
.
I also cannot find a --verbose
or --debug
option to the LDF, is there one?
Or, if everything else fails, how do I find the source code to the LDF? I’ve done various greps through the source tree, but I seem to looking for the wrong thing…