PlatformIO Community

Can you split the global library per board?

I did use the ESP8266 for a while, but recently got my first ESP32, and oh boy, it is nice indeed. There’s just one minor problem: I like to have my most-used libraries, WiFi/ArduinoOTA and the Adafruit TFT ones for example, as global libs, so I don’t have to include them to the projects every time.

Now with some of them, they are named alike, but there are different versions for the ESP8266 and ESP32 (and for regular Arduinos and STM32s and whatever, but let’s not overcomplicate things).

Is there any elegant way to split them into subfolders in the lib folder in an easy way (for example the OTA ESP32 version go to lib\32\ArduinoOTA, the ESP8266 goes to lib\8266\ArduinoOTA) and, and here’s my problem, include them in an easy way, like “#include <ESP32\ArduinoOTA.h>”?

As I’m messing with the subfolder structure, I couldn’t get it to work as of yet. Tried just renaming both folder and the ArduinoOTA.h to ArduinoOTA32(.h), but this gives me an error again, I assume because some other function can’t call back on the .h because it was renamed?

Another idea would be to stuff my standard libs into some custom subfolders, named ESP32, 8266, STM32 and so on, and just add them to the include per project I’m working on? How do you folks tackle this problem?

I’m sorry if this is a dumb question, I’m pretty new to all the programming stuff, let alone something as complex as PIO over the Arduino IDE…