From 821cf6942a390f5f64d8a2cff9933b24c84f7dc1 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 25 Jul 2019 14:27:43 -0700 Subject: [PATCH] meson: Use cmake to find LLVM when building for windows We don't use cmake normally because it always results in static linking. This is very problematic for *nix OSes which expect shared linking by default, but for windows this isn't a problem as LLVM doesn't support shared linking on windows anyway. Reviewed-by: Adam Jackson --- meson.build | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 2d8668e601b..00cf3e017ab 100644 --- a/meson.build +++ b/meson.build @@ -1368,8 +1368,16 @@ else endif _shared_llvm = get_option('shared-llvm') - _llvm = get_option('llvm') + +# The cmake method will never find libllvm.so|dylib; this is fine for windows +# because llvm doesn't support libllvm.dll +_llvm_method = 'config-tool' +if (meson.version().version_compare('>= 0.51.0') and + host_machine.system() == 'windows') + _llvm_method = 'cmake' +endif + dep_llvm = null_dep with_llvm = false if _llvm != 'false' @@ -1383,7 +1391,7 @@ if _llvm != 'false' with_gallium_opencl or _llvm == 'true' ), static : not _shared_llvm, - method : 'config-tool', + method : _llvm_method, fallback : ['llvm', 'dep_llvm'], ) with_llvm = dep_llvm.found() -- 2.30.2