Module: Mesa
Branch: main
Commit: b1e7ce84cc6ee4612313734bc4e8055a959ea078
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b1e7ce84cc6ee4612313734bc4e8055a959ea078

Author: Lionel Landwerlin <[email protected]>
Date:   Thu Nov 18 17:24:46 2021 +0200

meson: try to find clang-cpp before going through each module

Signed-off-by: Lionel Landwerlin <[email protected]>
Acked-by: Jason Ekstrand <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13171>

---

 meson.build | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/meson.build b/meson.build
index 8ab5627fed1..1b10d85712e 100644
--- a/meson.build
+++ b/meson.build
@@ -1783,17 +1783,21 @@ dep_clang = null_dep
 if with_clc
   llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 
'libdir')
 
-  clang_modules = [
-    'clangBasic', 'clangAST', 'clangCodeGen', 'clangLex',
-    'clangDriver', 'clangFrontend', 'clangFrontendTool',
-    'clangHandleCXX', 'clangHandleLLVM', 'clangSerialization',
-    'clangSema', 'clangParse', 'clangEdit', 'clangAnalysis'
-  ]
+  dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : 
false)
+
+  if not dep_clang.found()
+    clang_modules = [
+      'clangBasic', 'clangAST', 'clangCodeGen', 'clangLex',
+      'clangDriver', 'clangFrontend', 'clangFrontendTool',
+      'clangHandleCXX', 'clangHandleLLVM', 'clangSerialization',
+      'clangSema', 'clangParse', 'clangEdit', 'clangAnalysis'
+    ]
 
-  dep_clang = []
-  foreach m : clang_modules
-    dep_clang += cpp.find_library(m, dirs : llvm_libdir, required : true)
-  endforeach
+    dep_clang = []
+    foreach m : clang_modules
+      dep_clang += cpp.find_library(m, dirs : llvm_libdir, required : true)
+    endforeach
+  endif
 endif
 
 # Be explicit about only using this lib on Windows, to avoid picking

Reply via email to