summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2018-03-16 11:49:47 +0100
committerThierry Reding <treding@nvidia.com>2018-04-04 16:25:38 +0200
commit23054838e31624c426c5123694151af0754ead23 (patch)
tree284d6d2e883bf6b7bdabdfa988ad743cc172f49d
parent5a88b4626396bc50ec1199ead11dd0ae3e11b039 (diff)
meson: Use dep_llvm when finding clang modulesHEADmaster
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--src/gallium/targets/opencl/meson.build26
1 files changed, 12 insertions, 14 deletions
diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
index bebe0547d45..4c9e72ab9ee 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(
@@ -42,18 +40,18 @@ libopencl = shared_library(
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),
+ 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('clangEdit', dependencies : dep_llvm),
+ cpp.find_library('clangLex', dependencies : dep_llvm),
+ cpp.find_library('clangBasic', dependencies : dep_llvm),
],
version : opencl_version,
install : true,