meson.build revision b8e80941
1# Copyright © 2017 Intel Corporation
2
3# Permission is hereby granted, free of charge, to any person obtaining a copy
4# of this software and associated documentation files (the "Software"), to deal
5# in the Software without restriction, including without limitation the rights
6# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7# copies of the Software, and to permit persons to whom the Software is
8# furnished to do so, subject to the following conditions:
9
10# The above copyright notice and this permission notice shall be included in
11# all copies or substantial portions of the Software.
12
13# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19# SOFTWARE.
20
21opencl_link_args = []
22opencl_link_deps = []
23opencl_version = '1'
24
25if with_ld_version_script
26  opencl_link_args += [
27    '-Wl,--version-script', join_paths(meson.current_source_dir(), 'opencl.sym')
28  ]
29  opencl_link_deps += files('opencl.sym')
30endif
31
32llvm_libdir = dep_llvm.get_configtool_variable('libdir')
33
34opencl_libname = with_opencl_icd ? 'MesaOpenCL' : 'OpenCL'
35
36libopencl = shared_library(
37  opencl_libname,
38  [],
39  link_args : [ld_args_gc_sections, opencl_link_args],
40  link_depends : opencl_link_deps,
41  link_whole : libclover,
42  link_with : [libpipe_loader_dynamic, libgallium, libmesa_util],
43  dependencies : [
44    dep_thread, dep_clock, dep_dl, dep_unwind, dep_elf, dep_expat,
45    cpp.find_library('clangCodeGen', dirs : llvm_libdir),
46    cpp.find_library('clangFrontendTool', dirs : llvm_libdir),
47    cpp.find_library('clangFrontend', dirs : llvm_libdir),
48    cpp.find_library('clangDriver', dirs : llvm_libdir),
49    cpp.find_library('clangSerialization', dirs : llvm_libdir),
50    cpp.find_library('clangParse', dirs : llvm_libdir),
51    cpp.find_library('clangSema', dirs : llvm_libdir),
52    cpp.find_library('clangAnalysis', dirs : llvm_libdir),
53    cpp.find_library('clangAST', dirs : llvm_libdir),
54    cpp.find_library('clangEdit', dirs : llvm_libdir),
55    cpp.find_library('clangLex', dirs : llvm_libdir),
56    cpp.find_library('clangBasic', dirs : llvm_libdir),
57  ],
58  version : '@0@.0.0'.format(opencl_version),
59  install : true,
60)
61
62if with_opencl_icd
63  _config = configuration_data()
64  _config.set('OPENCL_LIBNAME', 'MesaOpenCL')
65  _config.set('OPENCL_VERSION', opencl_version)
66  configure_file(
67    configuration : _config,
68    input : 'mesa.icd.in',
69    output : 'mesa.icd',
70    install : true,
71    install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
72  )
73endif
74