101e04c3fSmrg# Copyright © 2017 Intel Corporation
201e04c3fSmrg
301e04c3fSmrg# Permission is hereby granted, free of charge, to any person obtaining a copy
401e04c3fSmrg# of this software and associated documentation files (the "Software"), to deal
501e04c3fSmrg# in the Software without restriction, including without limitation the rights
601e04c3fSmrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
701e04c3fSmrg# copies of the Software, and to permit persons to whom the Software is
801e04c3fSmrg# furnished to do so, subject to the following conditions:
901e04c3fSmrg
1001e04c3fSmrg# The above copyright notice and this permission notice shall be included in
1101e04c3fSmrg# all copies or substantial portions of the Software.
1201e04c3fSmrg
1301e04c3fSmrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1401e04c3fSmrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1501e04c3fSmrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1601e04c3fSmrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1701e04c3fSmrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1801e04c3fSmrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1901e04c3fSmrg# SOFTWARE.
2001e04c3fSmrg
2101e04c3fSmrgfiles_libintel_common = files(
227ec681f3Smrg  'intel_aux_map.c',
237ec681f3Smrg  'intel_aux_map.h',
247ec681f3Smrg  'intel_buffer_alloc.h',
257ec681f3Smrg  'intel_clflush.h',
267ec681f3Smrg  'intel_decoder.h',
277ec681f3Smrg  'intel_disasm.c',
287ec681f3Smrg  'intel_disasm.h',
297ec681f3Smrg  'intel_gem.c',
307ec681f3Smrg  'intel_gem.h',
317ec681f3Smrg  'intel_guardband.h',
327ec681f3Smrg  'intel_l3_config.c',
337ec681f3Smrg  'intel_l3_config.h',
347ec681f3Smrg  'intel_urb_config.c',
357ec681f3Smrg  'intel_sample_positions.c',
367ec681f3Smrg  'intel_sample_positions.h',
377ec681f3Smrg  'intel_uuid.c',
387ec681f3Smrg  'intel_uuid.h',
397ec681f3Smrg  'intel_measure.c',
407ec681f3Smrg  'intel_measure.h',
417ec681f3Smrg)
427ec681f3Smrg
437ec681f3Smrgfiles_batch_decoder = files(
447ec681f3Smrg  'intel_batch_decoder.c',
457ec681f3Smrg  'intel_decoder.c',
4601e04c3fSmrg)
4701e04c3fSmrg
487ec681f3Smrgbatch_decoder_dependencies = []
497ec681f3Smrgif with_platform_android
507ec681f3Smrg  files_libintel_common += 'intel_batch_decoder_stub.c'
517ec681f3Smrgelse
527ec681f3Smrg  batch_decoder_dependencies += dep_expat
537ec681f3Smrg  files_libintel_common += files_batch_decoder
547ec681f3Smrgendif
557ec681f3Smrg
5601e04c3fSmrglibintel_common = static_library(
577ec681f3Smrg  'intel_common',
587ec681f3Smrg  [files_libintel_common, genX_xml_h, sha1_h],
597ec681f3Smrg  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_intel],
607ec681f3Smrg  c_args : [no_override_init_args],
617ec681f3Smrg  gnu_symbol_visibility : 'hidden',
6201e04c3fSmrg  link_with : [libisl],
637ec681f3Smrg  dependencies : [batch_decoder_dependencies, dep_libdrm, dep_thread, idep_genxml, idep_mesautil],
647ec681f3Smrg)
657ec681f3Smrg
667ec681f3Smrglibintel_extra_dependencies = []
677ec681f3Smrgif with_platform_android
687ec681f3Smrg  libintel_extra_dependencies += dep_android
697ec681f3Smrgendif
707ec681f3Smrg
717ec681f3Smrgidep_libintel_common = declare_dependency(
727ec681f3Smrg  link_with: [libintel_common],
737ec681f3Smrg  dependencies: [libintel_extra_dependencies],
7401e04c3fSmrg)
759f464c52Smaya
769f464c52Smayainstall_intel_gpu_tests = get_option('install-intel-gpu-tests')
779f464c52Smaya
789f464c52Smayaif install_intel_gpu_tests
797ec681f3Smrg  foreach g : [['70', 'gfx7'], ['75', 'hsw'], ['80', 'gfx8'],
807ec681f3Smrg               ['90', 'gfx9'], ['110', 'gfx11'], ['120', 'gfx12'],
817ec681f3Smrg               ['125', 'gfx125']]
829f464c52Smaya    executable(
839f464c52Smaya      'intel_@0@_mi_builder_test'.format(g[1]),
847ec681f3Smrg      files('tests/mi_builder_test.cpp'),
859f464c52Smaya      cpp_args : [
867ec681f3Smrg        cpp_msvc_compat_args,
877ec681f3Smrg        '-DGFX_VERx10=@0@'.format(g[0])
889f464c52Smaya      ],
897ec681f3Smrg      gnu_symbol_visibility : 'hidden',
907ec681f3Smrg      include_directories : [inc_include, inc_src, inc_intel],
917ec681f3Smrg      link_with : [libintel_dev],
927ec681f3Smrg      dependencies : [dep_libdrm, idep_gtest, idep_genxml, idep_mesautil],
939f464c52Smaya      install : install_intel_gpu_tests,
949f464c52Smaya    )
959f464c52Smaya  endforeach
969f464c52Smayaendif
977ec681f3Smrg
987ec681f3Smrgif with_tests and not with_platform_android
997ec681f3Smrg  gentest_xml = files('tests/gentest.xml')
1007ec681f3Smrg  _name = 'gentest_pack.h'
1017ec681f3Smrg  gentest_pack = custom_target(
1027ec681f3Smrg    _name,
1037ec681f3Smrg    input : [gen_pack_header_py, gentest_xml],
1047ec681f3Smrg    output : _name,
1057ec681f3Smrg    command : [prog_python, '@INPUT@'],
1067ec681f3Smrg    capture : true,
1077ec681f3Smrg  )
1087ec681f3Smrg
1097ec681f3Smrg  genxml_path = join_paths(meson.source_root(),
1107ec681f3Smrg                           '@0@'.format(gentest_xml[0]))
1117ec681f3Smrg
1127ec681f3Smrg  test(
1137ec681f3Smrg    'genxml_test',
1147ec681f3Smrg    executable(
1157ec681f3Smrg      'genxml_test',
1167ec681f3Smrg      ['tests/genxml_test.c', gentest_pack],
1177ec681f3Smrg      include_directories : [inc_include, inc_src, inc_intel],
1187ec681f3Smrg      dependencies : idep_mesautil,
1197ec681f3Smrg      link_with : libintel_common,
1207ec681f3Smrg      c_args : [
1217ec681f3Smrg        '-DGENXML_PATH="@0@"'.format(genxml_path)
1227ec681f3Smrg      ],
1237ec681f3Smrg    ),
1247ec681f3Smrg    args : ['-quiet'],
1257ec681f3Smrg    suite : ['intel'],
1267ec681f3Smrg  )
1277ec681f3Smrgendif
128