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
2141687f09Smrglibdrm_intel = library(
2200a23bdaSmrg  'drm_intel',
2300a23bdaSmrg  [
2400a23bdaSmrg    files(
2500a23bdaSmrg      'intel_bufmgr.c', 'intel_bufmgr_fake.c', 'intel_bufmgr_gem.c',
26bbff01ceSmrg      'intel_decode.c', 'mm.c',
2700a23bdaSmrg    ),
2800a23bdaSmrg    config_file,
2900a23bdaSmrg  ],
3000a23bdaSmrg  include_directories : [inc_root, inc_drm],
3100a23bdaSmrg  link_with : libdrm,
32bbff01ceSmrg  dependencies : [dep_pciaccess, dep_threads, dep_rt, dep_valgrind, dep_atomic_ops],
337cdc0497Smrg  c_args : libdrm_c_args,
340ed5401bSmrg  gnu_symbol_visibility : 'hidden',
356acbc0e0Smrg  version : '1.@0@.0'.format(patch_ver),
3600a23bdaSmrg  install : true,
3700a23bdaSmrg)
3800a23bdaSmrg
3900a23bdaSmrgext_libdrm_intel = declare_dependency(
4000a23bdaSmrg  link_with : [libdrm, libdrm_intel],
4100a23bdaSmrg  include_directories : [inc_drm, include_directories('.')],
4200a23bdaSmrg)
4300a23bdaSmrg
440ed5401bSmrgif meson.version().version_compare('>= 0.54.0')
450ed5401bSmrg  meson.override_dependency('libdrm_intel', ext_libdrm_intel)
460ed5401bSmrgendif
470ed5401bSmrg
4800a23bdaSmrginstall_headers(
4900a23bdaSmrg  'intel_bufmgr.h', 'intel_aub.h', 'intel_debug.h',
5000a23bdaSmrg  subdir : 'libdrm',
5100a23bdaSmrg)
5200a23bdaSmrg
5300a23bdaSmrgpkg.generate(
540ed5401bSmrg  libdrm_intel,
5500a23bdaSmrg  name : 'libdrm_intel',
5600a23bdaSmrg  subdirs : ['.', 'libdrm'],
5700a23bdaSmrg  requires : 'libdrm',
5800a23bdaSmrg  description : 'Userspace interface to intel kernel DRM services',
5900a23bdaSmrg)
6000a23bdaSmrg
6100a23bdaSmrgtest_decode = executable(
6200a23bdaSmrg  'test_decode',
6300a23bdaSmrg  files('test_decode.c'),
6400a23bdaSmrg  include_directories : [inc_root, inc_drm],
6500a23bdaSmrg  link_with : [libdrm, libdrm_intel],
667cdc0497Smrg  c_args : libdrm_c_args,
670ed5401bSmrg  gnu_symbol_visibility : 'hidden',
6800a23bdaSmrg)
6900a23bdaSmrg
7000a23bdaSmrgtest(
7100a23bdaSmrg  'gen4-3d.batch',
7288f8a8d2Smrg  find_program('tests/gen4-3d.batch.sh'),
7300a23bdaSmrg  workdir : meson.current_build_dir(),
7400a23bdaSmrg)
7500a23bdaSmrgtest(
7600a23bdaSmrg  'gen45-3d.batch',
7788f8a8d2Smrg  find_program('tests/gm45-3d.batch.sh'),
7800a23bdaSmrg  workdir : meson.current_build_dir(),
7900a23bdaSmrg)
8000a23bdaSmrgtest(
8100a23bdaSmrg  'gen5-3d.batch',
8288f8a8d2Smrg  find_program('tests/gen5-3d.batch.sh'),
8300a23bdaSmrg  workdir : meson.current_build_dir(),
8400a23bdaSmrg)
8500a23bdaSmrgtest(
8600a23bdaSmrg  'gen6-3d.batch',
8788f8a8d2Smrg  find_program('tests/gen6-3d.batch.sh'),
8800a23bdaSmrg  workdir : meson.current_build_dir(),
8900a23bdaSmrg)
9000a23bdaSmrgtest(
9100a23bdaSmrg  'gen7-3d.batch',
9288f8a8d2Smrg  find_program('tests/gen7-3d.batch.sh'),
9300a23bdaSmrg  workdir : meson.current_build_dir(),
9400a23bdaSmrg)
9500a23bdaSmrgtest(
9600a23bdaSmrg  'gen7-2d-copy.batch',
9788f8a8d2Smrg  find_program('tests/gen7-2d-copy.batch.sh'),
9800a23bdaSmrg  workdir : meson.current_build_dir(),
9900a23bdaSmrg)
1009bd392adSmrg
10100a23bdaSmrgtest(
1029bd392adSmrg  'intel-symbols-check',
1039bd392adSmrg  symbols_check,
1049bd392adSmrg  args : [
1059bd392adSmrg    '--lib', libdrm_intel,
1069bd392adSmrg    '--symbols-file', files('intel-symbols.txt'),
107bbff01ceSmrg    '--nm', prog_nm.full_path(),
1089bd392adSmrg  ],
10900a23bdaSmrg)
110