Skip to content

WIP: fix unity builds

hanetzer requested to merge hanetzer/libinput:meson-unity into main

Unity builds are an option given by the meson build system, which concatinates source files together using an intermediate source file and #include directives, and then compiles the intermediate source file.

It generally increases compilation speed (especially for lower-threaded machines) overall and can function as a sort of poor man's lto, as multiple translation units are now presented to the compiler as one, increasing the opportunities for inlining and other forms of optimization.

Due to the source files being joined in this manner, the project overall has to be a bit more careful about redefinitions of function and variable names. I've prefixed/suffixed functions with the same name in manners similar to existing changes, and when possible moved shared variables into headers. Further, as the tests make use of interesting preprocessor macros, I've marked them all as being unable to be unity built, so you can still build the overall project with unity and run tests.

This is my best effort at it. If there are changes which you think could be handled better, do let me know. Attached is a log demonstrating the failures when using unity builds. fail.log

Merge request reports