summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2018-03-16 11:49:47 +0100
committerThierry Reding <treding@nvidia.com>2019-12-04 12:00:11 +0100
commit493b8999f9e152a104d5e7b464aaf948e6d96b9a (patch)
tree5058b19816a1fd30cb02106e12e7ac098044021b
parent4b3e7db671883b74267cdf8a5e7034d08b658d81 (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 92e45d28640..1a24591f051 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 907cc74337d..a1f8680c88c 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,