summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2018-03-16 11:49:47 +0100
committerThierry Reding <treding@nvidia.com>2019-08-23 18:16:36 +0200
commit7c8c52ff30b939a41df1233e38566024114e6d79 (patch)
treeb5e4d4fd51c50aeece603a90b0c1090923d80f36
parentaecfc014722b88607d8d852f8c110231b83f9d86 (diff)
meson: Use dep_llvm when finding clang modules
When cross-compiling OpenCL support, clover will encode the LLVM library path so that it can add the proper directory (containing opencl-c.h) to the include path during runtime compilation of programs. In order for that to work, the LLVM library directory needs to be an absolute path in the host filesystem. However, during cross-compilation the LLVM library directory will also be used to find the clang modules to link against. But at build time the clang modules will have to be looked up in th LLVM library directory within the host sysroot, which is a cross-compilation staging area that is located in an arbitrary directory on the build filesystem. However, the library search path provided by the dep_llvm dependency contains the correct path to the clang modules at build time, so the dependency can be passed to the cc.find_library() command to properly check for the existence of the library and whether it can actually be linked to. NOTE: This depends on a patch that hasn't been merged into Meson yet. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--meson.build2
-rw-r--r--src/gallium/targets/opencl/meson.build28
2 files changed, 14 insertions, 16 deletions
diff --git a/meson.build b/meson.build
index 501957e35e1a..8c770d77c1c8 100644
--- a/meson.build
+++ b/meson.build
@@ -25,7 +25,7 @@ project(
[find_program('python', 'python2', 'python3'), 'bin/meson_get_version.py']
).stdout(),
license : 'MIT',
- meson_version : '>= 0.46',
+ meson_version : '>= 0.50',
default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c99', 'cpp_std=c++14']
)
diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
index 907cc74337dd..a1f8680c88cc 100644
--- a/src/gallium/targets/opencl/meson.build
+++ b/src/gallium/targets/opencl/meson.build
@@ -29,8 +29,6 @@ if with_ld_version_script
opencl_link_deps += files('opencl.sym')
endif
-llvm_libdir = dep_llvm.get_configtool_variable('libdir')
-
opencl_libname = with_opencl_icd ? 'MesaOpenCL' : 'OpenCL'
libopencl = shared_library(
@@ -43,19 +41,19 @@ libopencl = shared_library(
dependencies : [
idep_mesautil,
dep_clock, dep_dl, dep_unwind, dep_elf,
- 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('clangASTMatchers', dirs : llvm_libdir),
- cpp.find_library('clangEdit', dirs : llvm_libdir),
- cpp.find_library('clangLex', dirs : llvm_libdir),
- cpp.find_library('clangBasic', dirs : llvm_libdir),
+ cpp.find_library('clangCodeGen', dependencies : dep_llvm),
+ cpp.find_library('clangFrontendTool', dependencies : dep_llvm),
+ cpp.find_library('clangFrontend', dependencies : dep_llvm),
+ cpp.find_library('clangDriver', dependencies : dep_llvm),
+ cpp.find_library('clangSerialization', dependencies : dep_llvm),
+ cpp.find_library('clangParse', dependencies : dep_llvm),
+ cpp.find_library('clangSema', dependencies : dep_llvm),
+ cpp.find_library('clangAnalysis', dependencies : dep_llvm),
+ cpp.find_library('clangAST', dependencies : dep_llvm),
+ cpp.find_library('clangASTMatchers', dependencies : dep_llvm),
+ cpp.find_library('clangEdit', dependencies : dep_llvm),
+ cpp.find_library('clangLex', dependencies : dep_llvm),
+ cpp.find_library('clangBasic', dependencies : dep_llvm),
],
version : '@0@.0.0'.format(opencl_version),
install : true,