I just converted an Objective-C(++) project to plain C++. While moving more and more code over, I noticed the build time increase quite a lot.
My project is currently split up into several frameworks/dylibs and a main project which uses these frameworks.
I did some research and found that there are basically three things recommended to reduce the build time:
- reducing header dependencies
- using unity builds
- using a tool like ccache to not redo unneeded work all the time
I implemented ccache and it works great and I was able to decrease the build time quite a bit.
I'm a bit unsure though about reducing the header dependencies and the unity builds. I read that a big downside of the unity builds is that you need to recompile everything if you make changes in one source file which makes sense. That however would not be a problem for the frameworks as they will need to be recompiled anyways if they change.
I read that it's bad practice to use "umbrella headers" such as "MyFramework.h" which will include all the public headers of a given framework although you may only need a few of them.
Cocoa uses umbrella headers everywhere and it's of course much easier than to pick the exact headers needed for each source file. However, when using unity builds I will only have one header per framework, correct?
Does it still make sense to pick the individual headers or will using "umbrella headers" be ok with unity builds?
Tapping a bit in the dark here and don't want to spend time implementing a technique which doesn't help in the end.
Thanks for your help!