meson.build revision 41687f09
100a23bdaSmrg# Copyright © 2017-2018 Intel Corporation
200a23bdaSmrg
300a23bdaSmrg# Permission is hereby granted, free of charge, to any person obtaining a copy
400a23bdaSmrg# of this software and associated documentation files (the "Software"), to deal
500a23bdaSmrg# in the Software without restriction, including without limitation the rights
600a23bdaSmrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
700a23bdaSmrg# copies of the Software, and to permit persons to whom the Software is
800a23bdaSmrg# furnished to do so, subject to the following conditions:
900a23bdaSmrg
1000a23bdaSmrg# The above copyright notice and this permission notice shall be included in
1100a23bdaSmrg# all copies or substantial portions of the Software.
1200a23bdaSmrg
1300a23bdaSmrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1400a23bdaSmrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1500a23bdaSmrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1600a23bdaSmrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1700a23bdaSmrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1800a23bdaSmrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1900a23bdaSmrg# SOFTWARE.
2000a23bdaSmrg
2100a23bdaSmrg
2200a23bdaSmrgdatadir_amdgpu = join_paths(get_option('prefix'), get_option('datadir'), 'libdrm')
2300a23bdaSmrg
2441687f09Smrglibdrm_amdgpu = library(
2500a23bdaSmrg  'drm_amdgpu',
2600a23bdaSmrg  [
2700a23bdaSmrg    files(
2800a23bdaSmrg      'amdgpu_asic_id.c', 'amdgpu_bo.c', 'amdgpu_cs.c', 'amdgpu_device.c',
297cdc0497Smrg      'amdgpu_gpu_info.c', 'amdgpu_vamgr.c', 'amdgpu_vm.c', 'handle_table.c',
3000a23bdaSmrg    ),
3100a23bdaSmrg    config_file,
3200a23bdaSmrg  ],
3300a23bdaSmrg  c_args : [
347cdc0497Smrg    libdrm_c_args,
3500a23bdaSmrg    '-DAMDGPU_ASIC_ID_TABLE="@0@"'.format(join_paths(datadir_amdgpu, 'amdgpu.ids')),
3600a23bdaSmrg  ],
3700a23bdaSmrg  include_directories : [inc_root, inc_drm],
3800a23bdaSmrg  link_with : libdrm,
3941687f09Smrg  dependencies : [dep_pthread_stubs, dep_atomic_ops, dep_rt],
4000a23bdaSmrg  version : '1.0.0',
4100a23bdaSmrg  install : true,
4200a23bdaSmrg)
4300a23bdaSmrg
4400a23bdaSmrginstall_headers('amdgpu.h', subdir : 'libdrm')
4500a23bdaSmrg
4600a23bdaSmrgpkg.generate(
4700a23bdaSmrg  name : 'libdrm_amdgpu',
4800a23bdaSmrg  libraries : libdrm_amdgpu,
4900a23bdaSmrg  subdirs : ['.', 'libdrm'],
5000a23bdaSmrg  version : meson.project_version(),
5100a23bdaSmrg  requires_private : 'libdrm',
5200a23bdaSmrg  description : 'Userspace interface to kernel DRM services for amdgpu',
5300a23bdaSmrg)
5400a23bdaSmrg
5500a23bdaSmrgext_libdrm_amdgpu = declare_dependency(
5600a23bdaSmrg  link_with : [libdrm, libdrm_amdgpu],
5700a23bdaSmrg  include_directories : [inc_drm, include_directories('.')],
5800a23bdaSmrg)
5900a23bdaSmrg
6000a23bdaSmrgtest(
619bd392adSmrg  'amdgpu-symbols-check',
629bd392adSmrg  symbols_check,
639bd392adSmrg  args : [
649bd392adSmrg    '--lib', libdrm_amdgpu,
659bd392adSmrg    '--symbols-file', files('amdgpu-symbols.txt'),
669bd392adSmrg    '--nm', prog_nm.path(),
679bd392adSmrg  ],
6800a23bdaSmrg)
69