I’ve been playing with ClangBuildAnalyser recently and one of the things it picks up is the huge amount of header file parsing when compiling each translation unit.
By default the PJ adds all modules to the JuceHeader.h file. Would it be possible to add a flag in the same vein as
JUCE_DONT_DECLARE_PROJECTINFO to not include the header files?
With that I can be more selective about which bits of JUCE I include in each translation unit.
I know the new CMake support effectively already adds this but it will take a long time before I can transition completely to this.
On that note though, have the JUCE team or anyone else noticed any build time improvements during the switch to CMake?
JuceHeader.h be “empty” then? So it would be equivalent to just stop including
Yes, almost, it’s just the
ProjectInfo struct the PJ generates that’s useful then.
It would still declare things like
ProjectInfo::versionString, which (as far as I’m aware) is the only way to get the version number when you’re not building a plug-in.
There’s a new feature in the Projucer on the JUCE6 branch which removes the dependency on AppConfig.h, which means that module headers can be included individually - there’s no need to rely on the JuceHeader.h.
This means you could probably get a reasonable build speed improvement just by including JuceHeader.h in places where the ProjectInfo stuff is required (which should ideally be very limited). Everywhere else, you can just include the module headers that are actually required in each TU.