1bf215546Sopenharmony_ci# Copyright © 2017 Intel Corporation
2bf215546Sopenharmony_ci
3bf215546Sopenharmony_ci# Permission is hereby granted, free of charge, to any person obtaining a copy
4bf215546Sopenharmony_ci# of this software and associated documentation files (the "Software"), to deal
5bf215546Sopenharmony_ci# in the Software without restriction, including without limitation the rights
6bf215546Sopenharmony_ci# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7bf215546Sopenharmony_ci# copies of the Software, and to permit persons to whom the Software is
8bf215546Sopenharmony_ci# furnished to do so, subject to the following conditions:
9bf215546Sopenharmony_ci
10bf215546Sopenharmony_ci# The above copyright notice and this permission notice shall be included in
11bf215546Sopenharmony_ci# all copies or substantial portions of the Software.
12bf215546Sopenharmony_ci
13bf215546Sopenharmony_ci# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14bf215546Sopenharmony_ci# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15bf215546Sopenharmony_ci# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16bf215546Sopenharmony_ci# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17bf215546Sopenharmony_ci# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18bf215546Sopenharmony_ci# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19bf215546Sopenharmony_ci# SOFTWARE.
20bf215546Sopenharmony_ci
21bf215546Sopenharmony_cifiles_libintel_common = files(
22bf215546Sopenharmony_ci  'intel_aux_map.c',
23bf215546Sopenharmony_ci  'intel_aux_map.h',
24bf215546Sopenharmony_ci  'intel_buffer_alloc.h',
25bf215546Sopenharmony_ci  'intel_clflush.h',
26bf215546Sopenharmony_ci  'intel_decoder.h',
27bf215546Sopenharmony_ci  'intel_disasm.c',
28bf215546Sopenharmony_ci  'intel_disasm.h',
29bf215546Sopenharmony_ci  'intel_gem.c',
30bf215546Sopenharmony_ci  'intel_gem.h',
31bf215546Sopenharmony_ci  'intel_guardband.h',
32bf215546Sopenharmony_ci  'intel_l3_config.c',
33bf215546Sopenharmony_ci  'intel_l3_config.h',
34bf215546Sopenharmony_ci  'intel_urb_config.c',
35bf215546Sopenharmony_ci  'intel_sample_positions.c',
36bf215546Sopenharmony_ci  'intel_sample_positions.h',
37bf215546Sopenharmony_ci  'intel_uuid.c',
38bf215546Sopenharmony_ci  'intel_uuid.h',
39bf215546Sopenharmony_ci  'intel_measure.c',
40bf215546Sopenharmony_ci  'intel_measure.h',
41bf215546Sopenharmony_ci  'intel_pixel_hash.h'
42bf215546Sopenharmony_ci)
43bf215546Sopenharmony_ci
44bf215546Sopenharmony_cifiles_batch_decoder = files(
45bf215546Sopenharmony_ci  'intel_batch_decoder.c',
46bf215546Sopenharmony_ci  'intel_decoder.c',
47bf215546Sopenharmony_ci)
48bf215546Sopenharmony_ci
49bf215546Sopenharmony_cibatch_decoder_dependencies = []
50bf215546Sopenharmony_ciif with_platform_android
51bf215546Sopenharmony_ci  files_libintel_common += 'intel_batch_decoder_stub.c'
52bf215546Sopenharmony_cielse
53bf215546Sopenharmony_ci  batch_decoder_dependencies += dep_expat
54bf215546Sopenharmony_ci  files_libintel_common += files_batch_decoder
55bf215546Sopenharmony_ciendif
56bf215546Sopenharmony_ci
57bf215546Sopenharmony_cilibintel_common = static_library(
58bf215546Sopenharmony_ci  'intel_common',
59bf215546Sopenharmony_ci  [files_libintel_common, genX_xml_h, sha1_h],
60bf215546Sopenharmony_ci  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel],
61bf215546Sopenharmony_ci  c_args : [no_override_init_args],
62bf215546Sopenharmony_ci  gnu_symbol_visibility : 'hidden',
63bf215546Sopenharmony_ci  link_with : [libisl],
64bf215546Sopenharmony_ci  dependencies : [batch_decoder_dependencies, dep_libdrm, dep_thread, idep_genxml, idep_mesautil],
65bf215546Sopenharmony_ci)
66bf215546Sopenharmony_ci
67bf215546Sopenharmony_cilibintel_extra_dependencies = []
68bf215546Sopenharmony_ciif with_platform_android
69bf215546Sopenharmony_ci  libintel_extra_dependencies += dep_android
70bf215546Sopenharmony_ciendif
71bf215546Sopenharmony_ci
72bf215546Sopenharmony_ciidep_libintel_common = declare_dependency(
73bf215546Sopenharmony_ci  link_with: [libintel_common],
74bf215546Sopenharmony_ci  dependencies: [libintel_extra_dependencies],
75bf215546Sopenharmony_ci)
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ciinstall_intel_gpu_tests = get_option('install-intel-gpu-tests')
78bf215546Sopenharmony_ciif install_intel_gpu_tests and not with_tests
79bf215546Sopenharmony_ci  error('`install-intel-gpu-tests` requires `build-tests`')
80bf215546Sopenharmony_ciendif
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_ciif with_tests and not with_platform_android
83bf215546Sopenharmony_ci  gentest_xml = files('tests/gentest.xml')
84bf215546Sopenharmony_ci  _name = 'gentest_pack.h'
85bf215546Sopenharmony_ci  gentest_pack = custom_target(
86bf215546Sopenharmony_ci    _name,
87bf215546Sopenharmony_ci    input : [gen_pack_header_py, gentest_xml],
88bf215546Sopenharmony_ci    output : _name,
89bf215546Sopenharmony_ci    command : [prog_python, '@INPUT@'],
90bf215546Sopenharmony_ci    capture : true,
91bf215546Sopenharmony_ci    depend_files: gen_pack_header_deps
92bf215546Sopenharmony_ci  )
93bf215546Sopenharmony_ci
94bf215546Sopenharmony_ci  genxml_path = join_paths(meson.source_root(),
95bf215546Sopenharmony_ci                           '@0@'.format(gentest_xml[0]))
96bf215546Sopenharmony_ci
97bf215546Sopenharmony_ci  test(
98bf215546Sopenharmony_ci    'genxml_test',
99bf215546Sopenharmony_ci    executable(
100bf215546Sopenharmony_ci      'genxml_test',
101bf215546Sopenharmony_ci      ['tests/genxml_test.c', gentest_pack],
102bf215546Sopenharmony_ci      include_directories : [inc_include, inc_src, inc_intel],
103bf215546Sopenharmony_ci      dependencies : idep_mesautil,
104bf215546Sopenharmony_ci      link_with : libintel_common,
105bf215546Sopenharmony_ci      c_args : [
106bf215546Sopenharmony_ci        '-DGENXML_PATH="@0@"'.format(genxml_path)
107bf215546Sopenharmony_ci      ],
108bf215546Sopenharmony_ci    ),
109bf215546Sopenharmony_ci    args : ['-quiet'],
110bf215546Sopenharmony_ci    suite : ['intel'],
111bf215546Sopenharmony_ci  )
112bf215546Sopenharmony_ci
113bf215546Sopenharmony_ci  foreach g : [['70', 'gfx7'], ['75', 'hsw'], ['80', 'gfx8'],
114bf215546Sopenharmony_ci               ['90', 'gfx9'], ['110', 'gfx11'], ['120', 'gfx12'],
115bf215546Sopenharmony_ci               ['125', 'gfx125']]
116bf215546Sopenharmony_ci    executable(
117bf215546Sopenharmony_ci      'intel_@0@_mi_builder_test'.format(g[1]),
118bf215546Sopenharmony_ci      files('tests/mi_builder_test.cpp'),
119bf215546Sopenharmony_ci      cpp_args : [
120bf215546Sopenharmony_ci        cpp_msvc_compat_args,
121bf215546Sopenharmony_ci        '-DGFX_VERx10=@0@'.format(g[0])
122bf215546Sopenharmony_ci      ],
123bf215546Sopenharmony_ci      gnu_symbol_visibility : 'hidden',
124bf215546Sopenharmony_ci      include_directories : [inc_include, inc_src, inc_intel],
125bf215546Sopenharmony_ci      link_with : [libintel_dev],
126bf215546Sopenharmony_ci      dependencies : [dep_libdrm, idep_gtest, idep_genxml, idep_mesautil],
127bf215546Sopenharmony_ci      install : install_intel_gpu_tests,
128bf215546Sopenharmony_ci    )
129bf215546Sopenharmony_ci  endforeach
130bf215546Sopenharmony_ciendif
131