• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright © 2017 Intel Corporation
2# SPDX-License-Identifier: MIT
3
4opencl_link_args = []
5opencl_link_deps = []
6opencl_version = '1'
7
8if with_ld_version_script
9  opencl_link_args += [
10    '-Wl,--version-script', join_paths(meson.current_source_dir(), 'opencl.sym')
11  ]
12  opencl_link_deps += files('opencl.sym')
13endif
14
15llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
16opencl_libname = with_opencl_icd ? 'MesaOpenCL' : 'OpenCL'
17
18polly_dep = null_dep
19polly_isl_dep = null_dep
20if dep_llvm.version().version_compare('>=10.0.0')
21  polly_dep = cpp.find_library('Polly', dirs : llvm_libdir, required : false)
22  polly_isl_dep = cpp.find_library('PollyISL', dirs : llvm_libdir, required : false)
23endif
24
25ocldef_in = files(opencl_libname + '.def.in')[0]
26ocldef = custom_target(
27  'ocldef.def',
28  input: ocldef_in,
29  output : 'ocldef.def',
30  command : gen_vs_module_defs_normal_command,
31)
32
33libopencl = shared_library(
34  opencl_libname,
35  [],
36  vs_module_defs : ocldef,
37  link_args : [ld_args_gc_sections, opencl_link_args],
38  link_depends : opencl_link_deps,
39  link_whole : libclover,
40  link_with : [libpipe_loader_dynamic, libgallium],
41  dependencies : [
42    idep_mesautil,
43    dep_clock, dep_dl, dep_unwind, dep_elf, dep_clang, polly_dep, polly_isl_dep, dep_version
44  ],
45  name_prefix : host_machine.system() == 'windows' ? '' : [],  # otherwise mingw will create libOpenCL-1.dll or libMesaOpenCL-1.dll
46  version : '@0@.0.0'.format(opencl_version),
47  soversion : host_machine.system() == 'windows' ? '' : opencl_version,
48  install : true,
49)
50
51if with_opencl_icd
52  _config = configuration_data()
53  _config.set('OPENCL_LIBNAME', 'MesaOpenCL')
54  _config.set('OPENCL_VERSION', opencl_version)
55  configure_file(
56    configuration : _config,
57    input : 'mesa.icd.in',
58    output : 'mesa.icd',
59    install : true,
60    install_tag : 'runtime',
61    install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
62  )
63
64  # .so is hardcoded in the icd as well
65  devenv.prepend(
66    'OCL_ICD_FILENAMES',
67    meson.current_build_dir() / 'libMesaOpenCL.so.@0@'.format(opencl_version)
68  )
69endif
70