intel: add stub_gpu tool
[mesa.git] / src / intel / tools / meson.build
1 # Copyright © 2017 Intel Corporation
2
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to deal
5 # in the Software without restriction, including without limitation the rights
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 # copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
9
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
12
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 # SOFTWARE.
20
21 libaub = static_library(
22 'aub',
23 files('aub_read.c', 'aub_mem.c'),
24 include_directories : [inc_include, inc_src, inc_intel],
25 dependencies : idep_mesautil,
26 link_with : [libintel_common, libintel_dev],
27 c_args : [c_vis_args, no_override_init_args],
28 install : false
29 )
30
31 aubinator = executable(
32 'aubinator',
33 files('aubinator.c'),
34 dependencies : [idep_mesautil, dep_expat, dep_zlib, dep_dl, dep_thread, dep_m],
35 include_directories : [inc_include, inc_src, inc_intel],
36 link_with : [libintel_common, libintel_compiler, libintel_dev, libaub],
37 c_args : [c_vis_args, no_override_init_args],
38 install : true
39 )
40
41 aubinator_error_decode = executable(
42 'aubinator_error_decode',
43 files('aubinator_error_decode.c'),
44 dependencies : [idep_mesautil, dep_zlib, dep_thread],
45 include_directories : [inc_include, inc_src, inc_intel],
46 link_with : [libintel_common, libintel_compiler, libintel_dev],
47 c_args : [c_vis_args, no_override_init_args],
48 install : true
49 )
50
51 i965_disasm = executable(
52 'i965_disasm',
53 files('i965_disasm.c'),
54 dependencies : [idep_mesautil, dep_thread],
55 include_directories : [inc_include, inc_src, inc_mesa, inc_intel],
56 link_with : [libintel_common, libintel_compiler, libintel_dev],
57 c_args : [c_vis_args, no_override_init_args],
58 install : true
59 )
60
61 error2aub = executable(
62 'intel_error2aub',
63 files('aub_write.h', 'aub_write.c', 'error2aub.c'),
64 dependencies : [dep_zlib, dep_dl, dep_thread, dep_m],
65 include_directories : [inc_include, inc_src, inc_intel],
66 link_with : [libintel_dev],
67 c_args : [c_vis_args, no_override_init_args],
68 install : true
69 )
70
71 sanitize_data = configuration_data()
72 sanitize_data.set(
73 'install_libexecdir',
74 join_paths(get_option('prefix'), get_option('libexecdir'))
75 )
76 sanitize_data.set(
77 'install_libdir',
78 join_paths(get_option('prefix'), get_option('libdir'))
79 )
80 configure_file(
81 input : 'intel_sanitize_gpu.in',
82 output : '@BASENAME@',
83 install_dir : get_option('bindir'),
84 install : true,
85 configuration : sanitize_data
86 )
87
88 libintel_sanitize_gpu = shared_library(
89 'intel_sanitize_gpu',
90 files('intel_sanitize_gpu.c'),
91 dependencies : [idep_mesautil, dep_dl, dep_thread],
92 include_directories : [inc_include, inc_src, inc_intel],
93 link_with : libintel_common,
94 c_args : [c_vis_args, no_override_init_args, c_sse2_args],
95 install_dir : get_option('libexecdir'),
96 install : true
97 )
98
99 configure_file(
100 input : 'intel_dump_gpu.in',
101 output : '@BASENAME@',
102 install_dir : get_option('bindir'),
103 configuration : sanitize_data,
104 install : true
105 )
106
107 libintel_dump_gpu = shared_library(
108 'intel_dump_gpu',
109 files(
110 'gen_context.h', 'gen8_context.h', 'gen10_context.h', 'intel_aub.h',
111 'aub_write.h', 'aub_write.c', 'intel_dump_gpu.c',
112 ),
113 dependencies : dep_dl,
114 include_directories : [inc_include, inc_src, inc_intel],
115 link_with : libintel_dev,
116 c_args : [c_vis_args, no_override_init_args],
117 install_dir : get_option('libexecdir'),
118 install : true
119 )
120
121 if with_tools.contains('drm-shim')
122 configure_file(
123 input : 'intel_stub_gpu.in',
124 output : '@BASENAME@',
125 install_dir : get_option('bindir'),
126 configuration : sanitize_data,
127 install : true
128 )
129
130 libintel_stub_gpu = shared_library(
131 ['intel_noop_drm_shim'],
132 'intel_noop_drm_shim.c',
133 include_directories: [inc_include, inc_src, inc_intel],
134 link_with: libintel_dev,
135 dependencies: [dep_libdrm, dep_drm_shim, idep_mesautil, idep_libintel_common],
136 c_args : c_vis_args,
137 install : true,
138 )
139 endif
140
141 if with_tools.contains('intel-ui')
142 subdir('imgui')
143
144 aubinator_viewer = executable(
145 'aubinator_viewer',
146 files('aubinator_viewer.cpp', 'aubinator_viewer_decoder.cpp'),
147 dependencies : [idep_mesautil, dep_zlib, dep_dl, dep_thread, dep_m, libintel_imgui_gtk_dep],
148 include_directories : [inc_include, inc_src, inc_intel],
149 link_with : [libintel_common, libintel_compiler, libintel_dev, libaub],
150 c_args : [c_vis_args, no_override_init_args],
151 cpp_args : ['-fpermissive', '-Wno-parentheses', '-Wno-class-memaccess'],
152 install : true
153 )
154 endif
155
156 i965_gram_tab = custom_target(
157 'i965_gram.tab.[ch]',
158 input : 'i965_gram.y',
159 output : ['i965_gram.tab.c', 'i965_gram.tab.h'],
160 command : [
161 prog_bison, '@INPUT@', '--defines=@OUTPUT1@',
162 '--output=@OUTPUT0@'
163 ]
164 )
165
166 i965_lex_yy_c = custom_target(
167 'i965_lex.yy.c',
168 input : 'i965_lex.l',
169 output : 'i965_lex.yy.c',
170 command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@']
171 )
172
173 i965_asm = executable(
174 'i965_asm',
175 ['i965_asm.c', i965_gram_tab[0], i965_gram_tab[1], i965_lex_yy_c],
176 dependencies : [idep_mesautil, dep_thread],
177 include_directories : [inc_include, inc_src, inc_mesa, inc_intel],
178 link_with : [libintel_common, libintel_compiler, libintel_dev],
179 c_args : [c_vis_args, no_override_init_args],
180 install : true
181 )
182
183 asm_testcases = [
184 ['brw', 'tests/gen4'],
185 ['g4x', 'tests/gen4.5'],
186 ['ilk', 'tests/gen5'],
187 ['snb', 'tests/gen6'],
188 ['ivb', 'tests/gen7'],
189 ['hsw', 'tests/gen7.5'],
190 ['bdw', 'tests/gen8'],
191 ['skl', 'tests/gen9'],
192 ['icl', 'tests/gen11'],
193 ]
194
195 test_runner = find_program('tests/run-test.sh')
196 foreach testcase : asm_testcases
197 test('i965_asm : ' + testcase[1], test_runner,
198 args : [i965_asm, testcase[1], testcase[0]],
199 env : ['srcdir=' + meson.current_source_dir()])
200 endforeach