[PROJ] "Unity" builds

Greg Troxel gdt at lexort.com
Mon Nov 27 10:41:57 PST 2023


Even Rouault via PROJ <proj at lists.osgeo.org> writes:

> Basically CMake concatenates a few .cpp file until it generates a
> translation unit that is big enough but not too big. That can result
> in twice faster builds (at least for libproj, excluding tests or
> proj.db generation). But as code is not always ready to be
> concatenated with other files, I had to do quite a lot of changes for
> that (like making sure to #undef stuff at end of .cpp files, or that
> structures in anonymous namespaces or static functions have unique
> names), which by themselves should be harmless (and also makes it
> easier to debug, as instead of having >10 static setup() functions,
> they have a distinct name now) when doing regular builds.

This strikes me as very strange, and a departure from the documented
semantics of the language.  Without thinking too much, I would be -1 on
committing workarounds to code to make this work, or support for it.
It feels like a lot of complexity for no real gain.

Assuming you have set up ccache if you are concerned about build times,
do you find that it's a real issue?


More information about the PROJ mailing list