diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-05-22 11:01:17 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-06-27 22:12:02 +0000 |
commit | 5157a4276500c77e2210e853b262be1d1b30aedf (patch) | |
tree | 438de28db2d49f827138ba883c4bee4d9d2fda42 /meson.build | |
parent | 3d3685d3548f7e4fbabafb5b3a184486a5274c23 (diff) |
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: 0d59459432cf077d768164091318af8fb1612500
("meson: Force the use of config-tool for llvm")
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/meson.build b/meson.build index 31bb0dd04eab..ff529d339226 100644 --- a/meson.build +++ b/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 |