meson: inline `inc_common`
[mesa.git] / src / compiler / nir / 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 nir_depends = files('nir_opcodes.py', 'nir_intrinsics.py')
22
23 nir_builder_opcodes_h = custom_target(
24 'nir_builder_opcodes.h',
25 input : 'nir_builder_opcodes_h.py',
26 output : 'nir_builder_opcodes.h',
27 command : [prog_python, '@INPUT@'],
28 capture : true,
29 depend_files : nir_depends,
30 )
31
32 nir_constant_expressions_c = custom_target(
33 'nir_constant_expressions.c',
34 input : 'nir_constant_expressions.py',
35 output : 'nir_constant_expressions.c',
36 command : [prog_python, '@INPUT@'],
37 capture : true,
38 depend_files : nir_depends,
39 )
40
41 nir_opcodes_h = custom_target(
42 'nir_opcodes.h',
43 input : 'nir_opcodes_h.py',
44 output : 'nir_opcodes.h',
45 command : [prog_python, '@INPUT@'],
46 capture : true,
47 depend_files : nir_depends,
48 )
49
50 nir_opcodes_c = custom_target(
51 'nir_opcodes.c',
52 input : 'nir_opcodes_c.py',
53 output : 'nir_opcodes.c',
54 command : [prog_python, '@INPUT@'],
55 capture : true,
56 depend_files : nir_depends,
57 )
58
59 nir_opt_algebraic_c = custom_target(
60 'nir_opt_algebraic.c',
61 input : 'nir_opt_algebraic.py',
62 output : 'nir_opt_algebraic.c',
63 command : [prog_python, '@INPUT@'],
64 capture : true,
65 depend_files : files('nir_algebraic.py'),
66 )
67
68 nir_intrinsics_h = custom_target(
69 'nir_intrinsics.h',
70 input : 'nir_intrinsics_h.py',
71 output : 'nir_intrinsics.h',
72 command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
73 capture : false,
74 depend_files : files('nir_intrinsics.py'),
75 )
76
77 nir_intrinsics_c = custom_target(
78 'nir_intrinsic.c',
79 input : 'nir_intrinsics_c.py',
80 output : 'nir_intrinsics.c',
81 command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
82 capture: false,
83 depend_files : files('nir_intrinsics.py'),
84 )
85
86 files_libnir = files(
87 'nir.c',
88 'nir.h',
89 'nir_builder.h',
90 'nir_builtin_builder.c',
91 'nir_builtin_builder.h',
92 'nir_clone.c',
93 'nir_constant_expressions.h',
94 'nir_control_flow.c',
95 'nir_control_flow.h',
96 'nir_control_flow_private.h',
97 'nir_deref.c',
98 'nir_deref.h',
99 'nir_divergence_analysis.c',
100 'nir_dominance.c',
101 'nir_format_convert.h',
102 'nir_from_ssa.c',
103 'nir_gather_info.c',
104 'nir_gather_ssa_types.c',
105 'nir_gather_xfb_info.c',
106 'nir_gs_count_vertices.c',
107 'nir_inline_functions.c',
108 'nir_instr_set.c',
109 'nir_instr_set.h',
110 'nir_linking_helpers.c',
111 'nir_liveness.c',
112 'nir_loop_analyze.c',
113 'nir_loop_analyze.h',
114 'nir_lower_alu.c',
115 'nir_lower_alu_to_scalar.c',
116 'nir_lower_alpha_test.c',
117 'nir_lower_amul.c',
118 'nir_lower_array_deref_of_vec.c',
119 'nir_lower_atomics_to_ssbo.c',
120 'nir_lower_bitmap.c',
121 'nir_lower_bool_to_bitsize.c',
122 'nir_lower_bool_to_float.c',
123 'nir_lower_bool_to_int32.c',
124 'nir_lower_clamp_color_outputs.c',
125 'nir_lower_clip.c',
126 'nir_lower_clip_cull_distance_arrays.c',
127 'nir_lower_clip_halfz.c',
128 'nir_lower_variable_initializers.c',
129 'nir_lower_discard_to_demote.c',
130 'nir_lower_double_ops.c',
131 'nir_lower_drawpixels.c',
132 'nir_lower_fb_read.c',
133 'nir_lower_flatshade.c',
134 'nir_lower_flrp.c',
135 'nir_lower_fragcoord_wtrans.c',
136 'nir_lower_frexp.c',
137 'nir_lower_global_vars_to_local.c',
138 'nir_lower_gs_intrinsics.c',
139 'nir_lower_load_const_to_scalar.c',
140 'nir_lower_locals_to_regs.c',
141 'nir_lower_idiv.c',
142 'nir_lower_indirect_derefs.c',
143 'nir_lower_input_attachments.c',
144 'nir_lower_int64.c',
145 'nir_lower_interpolation.c',
146 'nir_lower_int_to_float.c',
147 'nir_lower_io.c',
148 'nir_lower_io_arrays_to_elements.c',
149 'nir_lower_io_to_temporaries.c',
150 'nir_lower_io_to_scalar.c',
151 'nir_lower_io_to_vector.c',
152 'nir_lower_non_uniform_access.c',
153 'nir_lower_packing.c',
154 'nir_lower_passthrough_edgeflags.c',
155 'nir_lower_patch_vertices.c',
156 'nir_lower_phis_to_scalar.c',
157 'nir_lower_point_size.c',
158 'nir_lower_point_size_mov.c',
159 'nir_lower_regs_to_ssa.c',
160 'nir_lower_returns.c',
161 'nir_lower_samplers.c',
162 'nir_lower_scratch.c',
163 'nir_lower_ssbo.c',
164 'nir_lower_subgroups.c',
165 'nir_lower_system_values.c',
166 'nir_lower_tex.c',
167 'nir_lower_to_source_mods.c',
168 'nir_lower_two_sided_color.c',
169 'nir_lower_vars_to_ssa.c',
170 'nir_lower_var_copies.c',
171 'nir_lower_vec_to_movs.c',
172 'nir_lower_viewport_transform.c',
173 'nir_lower_wpos_center.c',
174 'nir_lower_wpos_ytransform.c',
175 'nir_lower_bit_size.c',
176 'nir_lower_uniforms_to_ubo.c',
177 'nir_metadata.c',
178 'nir_move_vec_src_uses_to_dest.c',
179 'nir_normalize_cubemap_coords.c',
180 'nir_opt_access.c',
181 'nir_opt_barriers.c',
182 'nir_opt_combine_stores.c',
183 'nir_opt_comparison_pre.c',
184 'nir_opt_conditional_discard.c',
185 'nir_opt_constant_folding.c',
186 'nir_opt_copy_prop_vars.c',
187 'nir_opt_copy_propagate.c',
188 'nir_opt_cse.c',
189 'nir_opt_dce.c',
190 'nir_opt_dead_cf.c',
191 'nir_opt_dead_write_vars.c',
192 'nir_opt_find_array_copies.c',
193 'nir_opt_gcm.c',
194 'nir_opt_idiv_const.c',
195 'nir_opt_if.c',
196 'nir_opt_intrinsics.c',
197 'nir_opt_large_constants.c',
198 'nir_opt_load_store_vectorize.c',
199 'nir_opt_loop_unroll.c',
200 'nir_opt_move.c',
201 'nir_opt_peephole_select.c',
202 'nir_opt_rematerialize_compares.c',
203 'nir_opt_remove_phis.c',
204 'nir_opt_shrink_load.c',
205 'nir_opt_sink.c',
206 'nir_opt_trivial_continues.c',
207 'nir_opt_undef.c',
208 'nir_opt_vectorize.c',
209 'nir_phi_builder.c',
210 'nir_phi_builder.h',
211 'nir_print.c',
212 'nir_propagate_invariant.c',
213 'nir_range_analysis.c',
214 'nir_range_analysis.h',
215 'nir_remove_dead_variables.c',
216 'nir_repair_ssa.c',
217 'nir_schedule.c',
218 'nir_search.c',
219 'nir_search.h',
220 'nir_search_helpers.h',
221 'nir_serialize.c',
222 'nir_serialize.h',
223 'nir_split_per_member_structs.c',
224 'nir_split_var_copies.c',
225 'nir_split_vars.c',
226 'nir_sweep.c',
227 'nir_to_lcssa.c',
228 'nir_validate.c',
229 'nir_vla.h',
230 'nir_worklist.c',
231 'nir_worklist.h',
232 'nir_xfb_info.h',
233 '../spirv/GLSL.ext.AMD.h',
234 '../spirv/GLSL.std.450.h',
235 '../spirv/gl_spirv.c',
236 '../spirv/nir_spirv.h',
237 '../spirv/OpenCL.std.h',
238 '../spirv/spirv.h',
239 '../spirv/spirv_info.h',
240 '../spirv/spirv_to_nir.c',
241 '../spirv/vtn_alu.c',
242 '../spirv/vtn_amd.c',
243 '../spirv/vtn_cfg.c',
244 '../spirv/vtn_glsl450.c',
245 '../spirv/vtn_opencl.c',
246 '../spirv/vtn_private.h',
247 '../spirv/vtn_subgroup.c',
248 '../spirv/vtn_variables.c',
249 )
250
251 _libnir = static_library(
252 'nir',
253 [files_libnir, spirv_info_c, nir_opt_algebraic_c, nir_opcodes_c,
254 nir_opcodes_h, nir_constant_expressions_c, nir_builder_opcodes_h,
255 vtn_gather_types_c, nir_intrinsics_c, nir_intrinsics_h],
256 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_compiler, include_directories('../spirv')],
257 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
258 link_with : libcompiler,
259 build_by_default : false,
260 )
261
262 # Headers-only dependency
263 idep_nir_headers = declare_dependency(
264 sources : [nir_opcodes_h, nir_builder_opcodes_h, nir_intrinsics_h],
265 include_directories : include_directories('.'),
266 )
267
268 # Also link with nir
269 idep_nir = declare_dependency(
270 dependencies : idep_nir_headers,
271 link_with : _libnir,
272 )
273
274 nir_algebraic_py = files('nir_algebraic.py')
275
276 if with_tests
277 test(
278 'nir_builder',
279 executable(
280 'nir_builder_test',
281 files('tests/builder_tests.cpp'),
282 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
283 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
284 dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
285 ),
286 suite : ['compiler', 'nir'],
287 )
288
289 test(
290 'nir_control_flow',
291 executable(
292 'nir_control_flow_test',
293 files('tests/control_flow_tests.cpp'),
294 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
295 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
296 dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
297 ),
298 suite : ['compiler', 'nir'],
299 )
300
301 test(
302 'nir_vars',
303 executable(
304 'nir_vars_test',
305 files('tests/vars_tests.cpp'),
306 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
307 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
308 dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
309 ),
310 suite : ['compiler', 'nir'],
311 )
312
313 test(
314 'nir_algebraic_parser',
315 prog_python,
316 args : [
317 join_paths(meson.current_source_dir(), 'tests/algebraic_parser_test.py')
318 ],
319 suite : ['compiler', 'nir'],
320 )
321
322 test(
323 'negative_equal',
324 executable(
325 'negative_equal',
326 files('tests/negative_equal_tests.cpp'),
327 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
328 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
329 dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
330 ),
331 suite : ['compiler', 'nir'],
332 )
333
334 test(
335 'comparison_pre',
336 executable(
337 'comparison_pre',
338 files('tests/comparison_pre_tests.cpp'),
339 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
340 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
341 dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
342 ),
343 suite : ['compiler', 'nir'],
344 )
345
346 test(
347 'load_store_vectorizer',
348 executable(
349 'load_store_vectorizer',
350 files('tests/load_store_vectorizer_tests.cpp'),
351 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
352 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
353 dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
354 ),
355 suite : ['compiler', 'nir'],
356 should_fail : meson.get_cross_property('xfail', '').contains('load_store_vectorizer'),
357 )
358
359 test(
360 'nir_serialize_test',
361 executable(
362 'nir_serialize_test',
363 files('tests/serialize_tests.cpp'),
364 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
365 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
366 dependencies : [dep_thread, idep_gtest, idep_nir, idep_mesautil],
367 ),
368 suite : ['compiler', 'nir'],
369 )
370 endif