OSDN Git Service

meson: Use cmake to find LLVM when building for windows
authorDylan Baker <dylan@pnwbakers.com>
Thu, 25 Jul 2019 21:27:43 +0000 (14:27 -0700)
committerDylan Baker <dylan@pnwbakers.com>
Fri, 18 Oct 2019 20:02:58 +0000 (13:02 -0700)
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 <ajax@redhat.com>
meson.build

index 2d8668e..00cf3e0 100644 (file)
@@ -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()