-
Notifications
You must be signed in to change notification settings - Fork 802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make build compatible of -DCMAKE_UNITY_BUILD=ON for faster builds #3962
Conversation
3d3c873
to
850c6ab
Compare
This is a "risky" feature from CMake (we suffered it in my company). The error messages are not easy to understand... until you remember/realize that unity may be bothering you (that happened to me at work). And that happens in CI (until you enable unity in your local machine). In this PR only some workflows in CI are moved to unity, so we could check how it behaves with and without. I do not know if you plan to move more platforms or configurations to unity. If we include it we should document it existence and possible consequences in Contributing or Compiling documentation. As far as I know, the only binary/package that we release are the docker files, right? We should compile then without unity. |
Enabling unity build will not be done by default. The end user will have to enable it explictly if he wants to. We have a mix of non-unity and unity builds in the CI to be able to catch bug specifics to both type of configuration.
I've added the following note in install.rst:
|
Cf https://en.wikipedia.org/wiki/Unity_build and https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html
Timings on Linux with Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz, 12 vCPUS, and "make -j12 proj"
Before:
After with -DCMAKE_UNITY_BUILD=ON
Debug builds with 12-threads are almost twice faster.
Release builds with 12-threads are 30% faster
And single-threaded release compilation in default mode takes 4m00s , and with CMAKE_UNITY_BUILD enabled only 1m50s