Skip to content

meson: Only look for LLVM when necessary

Dylan Baker requested to merge dbaker/mesa:submit/smarter-llvm-detect into main

meson: Only look for LLVM when necessary

Currently, Meson will search for LLVM unless it's explicitly disabled. This is less than optimal as it will search for LLVM when it doesn't need it, and may end up linking it even in that case. Meson 1.1 adds some new helper methods that allow us more accurately express when a feature is and isn't required, and with these we can ensure that LLVM is enabled when required, auto when optional, and disabled when not required.

This also allows us to pass the feature option directly to dependency() which allows Meson to provide better error messages

This does require a pretty serious bump in the Meson version, to 1.1 (1.3 is current). This would also open up more cleanups of a similar sort, but this is the only use that actually gives us a behavioral change I could find, the other cases would just be cleanups.

I'm not 100% sure on the logic here, especially in the cases where we can use LLVM if it's available, but it's not required

Edited by Dylan Baker

Merge request reports