Remove source paths for small subset builds

I am working on a complex project with an ESP32 with the Arduino framework. I test my modules using optional main.c files that re-implement the application with only some of my project’s functionality. I can then specify a build flag in my platformio.ini file to tell the compiler which main file to compile. It works great. The problem is that when I compile one of my test main files, it compiles EVERYTHING contained withing my project, so even if I am testing like 1 or 2 includes in my small test main file, it takes a few minutes to compile. And it seems like pio does a make clean on every build.

Anyone knows how I would be able to tell the compiler that I do not need dependencies for all of the source files in my PIO folder? This would let my compile stuff faster for my small test main files…


PlatformIO will run c/c++ intellisense and project will be re-built again, If you make any changes in platform.ini

1 Like

Do you mean there is no way to achieve what I am asking?

With lots of analysis code I think this may be possible – mostly on the SCons side. Not sure how hard it is to write a program that can prove that only certain files need to recompiled if a global build setting like a macro changes – it would have to parse the entire code and make sure it’s not used, or that it evaluates to the same result.

The basic stance is: If the platformio.ini is modified, a full rebuild must be done: PIO became basically unusable for debugging Marlin · Issue #4355 · platformio/platformio-core · GitHub.

Thanks! I think the solution would be to add some logic in the .ini file, i.e. if building this main, build flags are … else if using this main, include all build flags