Best way to use the same project to build multiple different apps

Hi. I’m using PlatformIO within VSCode. I wanted to build a number of similar apps which all share the same libraries and some of the same source files. I don’t want these to be separate projects, since I would then be duplicating their libraries and source files multiple times.

Ideally I’d be able to select which source files get build for each app, and that way I can have multiple main.cpp file with app main() or setup() and loop().

I’m currently accomplishing this with having a main.cpp that uses namespaces to determine which function in a certain namespace gets to be “the one”. A #define sets my choice of name spaces.

I have this nagging idea that there are better ways to do this, and my limited knowledge of the IDE and PlatformIO is the problem.

Thanks!

I do it this way:

1 Like