|I'm trying to do something simpler than that, if I can.
The header only approach works with many IoT projects under the Arduino framework, as there's only one cpp file - other than from included libraries which will never include your headers.
However, once you're no longer coding against Arduino, the possibility of having several cpps becomes very real and then you get symbol nightmare.
75% of GFX is templates. The trouble was the 25% that wasn't.
This is what I do now, because it makes Platform IO happy as well as satisfying other build environments:
I use /include and /src for each "project/module" i'm developing. What I mean by that is this.
GFX is a module
NES (my nintendo engine) is a module
The main project that includes both of those is itself, a module.
So it goes
for the overarching project "myproject"
Then, and I'm ashamed of this, but it works - I don't use CMake or Make at all (because they don't work with platformIO)
I use vscode's .vscode folder (cpp_properties.json/tasks.json/launch.json) to configure my build.
And then if I'm feeling saucy I write a shell script to run the build.
Make can take a running jump. CMake isn't any better. Besides, it wouldn't matter if I like them, since my toolchain isn't compatible with them.
Real programmers use butterflies