meson: Add support for using cmake for finding LLVM
Meson has support for using cmake as a finder for some dependencies,
including LLVM. Using cmake has a lot of advantages: it needs less meson
maintenance to keep working (even for llvm updates); it works more
sanely for cross compiles (as llvm-config is a compiled binary not a
shell script). Meson 0.51.0 also has a new generic variable getter that
can be used to get information from either cmake, pkg-config, or
config-tools dependencies, which is needed for cmake. We continue to
support using llvm-config if you don't have cmake installed, or if cmake
cannot find a suitable version.
Fixes: 0d59459432
("meson: Force the use of config-tool for llvm")
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
This commit is contained in:
13
meson.build
13
meson.build
@@ -1260,7 +1260,6 @@ if _llvm != 'false'
|
||||
with_gallium_opencl or _llvm == 'true'
|
||||
),
|
||||
static : not _shared_llvm,
|
||||
method : 'config-tool',
|
||||
)
|
||||
with_llvm = dep_llvm.found()
|
||||
endif
|
||||
@@ -1274,7 +1273,17 @@ if with_llvm
|
||||
# LLVM can be built without rtti, turning off rtti changes the ABI of C++
|
||||
# programs, so we need to build all C++ code in mesa without rtti as well to
|
||||
# ensure that linking works.
|
||||
if dep_llvm.get_configtool_variable('has-rtti') == 'NO'
|
||||
#
|
||||
# In meson 0.51.0 we can use cmake to find LLVM in addittion to meson's
|
||||
# builtin llvm-config based finder. A new generic variable getter method
|
||||
# has also been added, so we'll use that if we can, to cover the cmake case.
|
||||
if meson.version().version_compare('>=0.51')
|
||||
# The CMake finder will return 'ON', the llvm-config will return 'YES'
|
||||
_rtti = ['ON', 'YES'].contains(dep_llvm.get_variable(cmake : 'LLVM_ENABLE_RTTI', configtool: 'has-rtti'))
|
||||
else
|
||||
_rtti = dep_llvm.get_configtool_variable('has-rtti') == 'YES'
|
||||
endif
|
||||
if not _rtti
|
||||
if with_gallium_nouveau
|
||||
error('The Nouveau driver requires rtti. You either need to turn off nouveau or use an LLVM built with LLVM_ENABLE_RTTI.')
|
||||
elif with_gallium_opencl
|
||||
|
Reference in New Issue
Block a user