I’ve been trying to figure out the best practice for sharing local libraries.
Example… I am writing a communications protocol for a group of embedded devices that will all interact with each other. Multiple projects, one communications library.
I’d like this library to be stored in it’s own location, as opposed to under any of the projects.
I originally tried to manage this as a submodule, which allowed me to put a copy in the “lib” folder of each project. But there are a lot of difficulties in managing this when you’re doing development of that library from multiple locations.
PlatformIO has so many options that for this old embedded programmer it’s a little confusing. In the “old days”, all I needed was an #include to the right header and a build flag to the right directory and I was off to the races.
I have not figured out how to manage this in VS Code and Platform IO.
If anyone had a recommendation, that would be really helpful. I don’t want to go back to submodules.
Here is an example of what I’m trying to do below.
Project 1 and Project 2 are independant from each other, but share the communication protocols.
I’d like to allow both projects to reference the comms_1 and comms_2.
Referencing the .h files is easy, but getting the .c files to compile is where I’m getting stuck.
|-- Project 1
|-- |-- src
|-- Project 2
|-- |-- src
|-- Communication
|—|-- Protocol 1
|-------|-- comms_1.c
|-------|-- comms_1.h
|—|-- Protocol 2
|-------|-- comms_2.c
|-------|-- comms_2.h
I appreciate the help, trying to stick to a best practice and I’m not sure I understand enough about the platformIOs different options.