PlatformIO Community

Include modified library in my own library

Hello,

This is more of a best practices sort of question. My setup is the following:

I’m making a lib with Platfformio, I have the src folder with my code, and examples folder. One of my dependencies is a modified (by myself) version of another lib (NTPClient in this case).

My question is about the best place to put the NTPClient lib? I’ve looked into PIO docs about library structure, but it is not very clear for this specific case. I’ve also looked into other published libs, and saw some use other directories (ArduinoJson has an extras dir for example).

I’m thinking the options are:

  1. Inside src folder, on its own subfolder
  2. Create another folder in root, maybe called extras, lib, include or lib_deps
  3. Fork NTPClient and add my version to “dependencies” in the library.json file

So where would be the more appropriate place? One of the options I mentioned, or something else?

If your library is dependent on a specifically moded library, then add a library.json and specify that modified library in the dependencies section. The modified library would then live in its own separate repo that you can point at with no copy of it in the main library.