aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorDylan Baker <[email protected]>2019-05-22 15:49:01 -0700
committerDylan Baker <[email protected]>2019-06-27 22:12:02 +0000
commit0ba0c0c15c633a5a3b7a4651a743f800f30bcbf6 (patch)
treea9d126d57218cf20d0d1aaeaa49070bd6e857ccb /src/gallium
parent5157a4276500c77e2210e853b262be1d1b30aedf (diff)
meson: try to use cmake as a finder for clang
Clang (like LLVM), very annoyingly refuses to provide pkg-config, and only provides cmake (unlike LLVM which at least provides llvm-config, even if llvm-config is terrible). Meson has gained the ability to use cmake to find dependencies, and can successfully find Clang. This change attempts to use cmake to find clang instead of a bunch of library searches, when paired with -Dcmake_prefix_path we can much more reliably use cmake to control which clang we're getting. This is only enabled for meson >= 0.51, which adds the required options. Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/targets/opencl/meson.build43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
index 676e0e13174..042307c9db0 100644
--- a/src/gallium/targets/opencl/meson.build
+++ b/src/gallium/targets/opencl/meson.build
@@ -1,4 +1,4 @@
-# Copyright © 2017 Intel Corporation
+# Copyright © 2017-2019 Intel Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -29,10 +29,33 @@ if with_ld_version_script
opencl_link_deps += files('opencl.sym')
endif
+_clang_modules = [
+ 'clangCodeGen',
+ 'clangFrontendTool',
+ 'clangFrontend',
+ 'clangDriver',
+ 'clangSerialization',
+ 'clangParse',
+ 'clangSema',
+ 'clangAnalysis',
+ 'clangAST',
+ 'clangEdit',
+ 'clangLex',
+ 'clangBasic',
+]
+
+dep_clang = null_dep
if meson.version().version_compare('>=0.51')
- llvm_libdir = dep_llvm.get_variable(configtool : 'libdir', cmake : 'LLVM_LIBRARY_DIR')
+ dep_clang = dependency('Clang', modules : _clang_modules, required : false)
+ _llvm_libdir = dep_llvm.get_variable(configtool : 'libdir', cmake : 'LLVM_LIBRARY_DIR')
else
- llvm_libdir = dep_llvm.get_configtool_variable('libdir')
+ _llvm_libdir = dep_llvm.get_configtool_variable('libdir')
+endif
+if not dep_clang.found()
+ dep_clang = []
+ foreach m : _clang_modules
+ dep_clang += cpp.find_library(m, dirs : _llvm_libdir)
+ endforeach
endif
opencl_libname = with_opencl_icd ? 'MesaOpenCL' : 'OpenCL'
@@ -45,19 +68,7 @@ libopencl = shared_library(
link_whole : libclover,
link_with : [libpipe_loader_dynamic, libgallium, libmesa_util],
dependencies : [
- dep_thread, dep_clock, dep_dl, dep_unwind, dep_elf, dep_expat,
- cpp.find_library('clangCodeGen', dirs : llvm_libdir),
- cpp.find_library('clangFrontendTool', dirs : llvm_libdir),
- cpp.find_library('clangFrontend', dirs : llvm_libdir),
- cpp.find_library('clangDriver', dirs : llvm_libdir),
- cpp.find_library('clangSerialization', dirs : llvm_libdir),
- cpp.find_library('clangParse', dirs : llvm_libdir),
- cpp.find_library('clangSema', dirs : llvm_libdir),
- cpp.find_library('clangAnalysis', dirs : llvm_libdir),
- cpp.find_library('clangAST', dirs : llvm_libdir),
- cpp.find_library('clangEdit', dirs : llvm_libdir),
- cpp.find_library('clangLex', dirs : llvm_libdir),
- cpp.find_library('clangBasic', dirs : llvm_libdir),
+ dep_thread, dep_clock, dep_dl, dep_unwind, dep_elf, dep_expat, dep_clang,
],
version : '@[email protected]'.format(opencl_version),
install : true,