1# Copyright (C) 2020-2021 Collabora
2# Copyright (C) 2018 Rob Clark
3
4# Permission is hereby granted, free of charge, to any person obtaining a copy
5# of this software and associated documentation files (the "Software"), to deal
6# in the Software without restriction, including without limitation the rights
7# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8# copies of the Software, and to permit persons to whom the Software is
9# furnished to do so, subject to the following conditions:
10
11# The above copyright notice and this permission notice shall be included in
12# all copies or substantial portions of the Software.
13
14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20# SOFTWARE.
21
22valhall_c = custom_target(
23  'valhall_c',
24  input : ['valhall.c.py', 'ISA.xml'],
25  output : 'valhall.c',
26  command : [prog_python, '@INPUT@'],
27  capture : true,
28  depend_files : files('valhall.py'),
29)
30
31valhall_enums_h = custom_target(
32  'valhall_enums.h',
33  input : ['valhall_enums.h.py', 'ISA.xml'],
34  output : 'valhall_enums.h',
35  command : [prog_python, '@INPUT@'],
36  capture : true,
37  depend_files : files('valhall.py'),
38)
39
40idep_valhall_enums_h = declare_dependency(
41  sources : [valhall_enums_h],
42  include_directories : include_directories('.'),
43)
44
45valhall_disasm_c = custom_target(
46  'valhall_disasm_c',
47  input : ['disasm.py', 'ISA.xml'],
48  output : 'valhall_disasm.c',
49  command : [prog_python, '@INPUT@'],
50  capture : true,
51  depend_files : files('valhall.py'),
52)
53
54libpanfrost_valhall_disasm = static_library(
55  'panfrost_valhall_disasm',
56  valhall_disasm_c,
57  include_directories : [inc_include, inc_src, inc_mesa],
58  c_args : [no_override_init_args],
59  gnu_symbol_visibility : 'hidden',
60  build_by_default : false,
61)
62
63if with_tests
64  test(
65    'valhall_disasm',
66    executable(
67      'valhall_disasm_test',
68      files('test/test-disassembler.c'),
69      c_args : [c_msvc_compat_args, no_override_init_args],
70      gnu_symbol_visibility : 'hidden',
71      include_directories : [inc_include, inc_src, inc_mesa],
72      link_with : [libpanfrost_valhall_disasm],
73    ),
74    suite : ['panfrost'],
75    args : files('test/assembler-cases.txt'),
76  )
77
78  test(
79    'valhall_asm',
80    prog_python,
81    args : files('test-assembly.py', 'test/assembler-cases.txt', 'test/negative-cases.txt'),
82    suite : ['panfrost'],
83  )
84endif
85