meson: Build with Python 3
[mesa.git] / src / compiler / glsl / 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 subdir('glcpp')
22
23 glsl_parser = custom_target(
24 'glsl_parser',
25 input : 'glsl_parser.yy',
26 output : ['glsl_parser.cpp', 'glsl_parser.h'],
27 command : [
28 prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@',
29 '@INPUT@',
30 ],
31 )
32
33 glsl_lexer_cpp = custom_target(
34 'glsl_lexer_cpp',
35 input : 'glsl_lexer.ll',
36 output : 'glsl_lexer.cpp',
37 command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
38 )
39
40 ir_expression_operation_constant_h = custom_target(
41 'ir_expression_operation_constant.h',
42 input : 'ir_expression_operation.py',
43 output : 'ir_expression_operation_constant.h',
44 command : [prog_python, '@INPUT@', 'constant'],
45 capture : true,
46 )
47
48 ir_expression_operation_strings_h = custom_target(
49 'ir_expression_operation_strings.h',
50 input : 'ir_expression_operation.py',
51 output : 'ir_expression_operation_strings.h',
52 command : [prog_python, '@INPUT@', 'strings'],
53 capture : true,
54 )
55
56 files_libglsl = files(
57 'ast.h',
58 'ast_array_index.cpp',
59 'ast_expr.cpp',
60 'ast_function.cpp',
61 'ast_to_hir.cpp',
62 'ast_type.cpp',
63 'builtin_functions.cpp',
64 'builtin_functions.h',
65 'builtin_int64.h',
66 'builtin_types.cpp',
67 'builtin_variables.cpp',
68 'generate_ir.cpp',
69 'gl_nir_lower_atomics.c',
70 'gl_nir_lower_samplers.c',
71 'gl_nir_lower_samplers_as_deref.c',
72 'gl_nir_link_atomics.c',
73 'gl_nir_link_uniform_initializers.c',
74 'gl_nir_link_uniforms.c',
75 'gl_nir_link_xfb.c',
76 'gl_nir_linker.c',
77 'gl_nir_linker.h',
78 'gl_nir.h',
79 'glsl_parser_extras.cpp',
80 'glsl_parser_extras.h',
81 'glsl_symbol_table.cpp',
82 'glsl_symbol_table.h',
83 'glsl_to_nir.cpp',
84 'glsl_to_nir.h',
85 'hir_field_selection.cpp',
86 'ir_array_refcount.cpp',
87 'ir_array_refcount.h',
88 'ir_basic_block.cpp',
89 'ir_basic_block.h',
90 'ir_builder.cpp',
91 'ir_builder.h',
92 'ir_clone.cpp',
93 'ir_constant_expression.cpp',
94 'ir.cpp',
95 'ir.h',
96 'ir_equals.cpp',
97 'ir_expression_flattening.cpp',
98 'ir_expression_flattening.h',
99 'ir_function_can_inline.cpp',
100 'ir_function_detect_recursion.cpp',
101 'ir_function_inlining.h',
102 'ir_function.cpp',
103 'ir_hierarchical_visitor.cpp',
104 'ir_hierarchical_visitor.h',
105 'ir_hv_accept.cpp',
106 'ir_optimization.h',
107 'ir_print_visitor.cpp',
108 'ir_print_visitor.h',
109 'ir_reader.cpp',
110 'ir_reader.h',
111 'ir_rvalue_visitor.cpp',
112 'ir_rvalue_visitor.h',
113 'ir_set_program_inouts.cpp',
114 'ir_uniform.h',
115 'ir_validate.cpp',
116 'ir_variable_refcount.cpp',
117 'ir_variable_refcount.h',
118 'ir_visitor.h',
119 'linker.cpp',
120 'linker.h',
121 'linker_util.h',
122 'linker_util.cpp',
123 'link_atomics.cpp',
124 'link_functions.cpp',
125 'link_interface_blocks.cpp',
126 'link_uniforms.cpp',
127 'link_uniform_initializers.cpp',
128 'link_uniform_block_active_visitor.cpp',
129 'link_uniform_block_active_visitor.h',
130 'link_uniform_blocks.cpp',
131 'link_varyings.cpp',
132 'link_varyings.h',
133 'list.h',
134 'loop_analysis.cpp',
135 'loop_analysis.h',
136 'loop_unroll.cpp',
137 'lower_blend_equation_advanced.cpp',
138 'lower_buffer_access.cpp',
139 'lower_buffer_access.h',
140 'lower_const_arrays_to_uniforms.cpp',
141 'lower_cs_derived.cpp',
142 'lower_discard.cpp',
143 'lower_discard_flow.cpp',
144 'lower_distance.cpp',
145 'lower_if_to_cond_assign.cpp',
146 'lower_instructions.cpp',
147 'lower_int64.cpp',
148 'lower_jumps.cpp',
149 'lower_mat_op_to_vec.cpp',
150 'lower_noise.cpp',
151 'lower_offset_array.cpp',
152 'lower_packed_varyings.cpp',
153 'lower_named_interface_blocks.cpp',
154 'lower_packing_builtins.cpp',
155 'lower_subroutine.cpp',
156 'lower_tess_level.cpp',
157 'lower_texture_projection.cpp',
158 'lower_variable_index_to_cond_assign.cpp',
159 'lower_vec_index_to_cond_assign.cpp',
160 'lower_vec_index_to_swizzle.cpp',
161 'lower_vector.cpp',
162 'lower_vector_derefs.cpp',
163 'lower_vector_insert.cpp',
164 'lower_vertex_id.cpp',
165 'lower_output_reads.cpp',
166 'lower_shared_reference.cpp',
167 'lower_ubo_reference.cpp',
168 'opt_algebraic.cpp',
169 'opt_array_splitting.cpp',
170 'opt_conditional_discard.cpp',
171 'opt_constant_folding.cpp',
172 'opt_constant_propagation.cpp',
173 'opt_constant_variable.cpp',
174 'opt_copy_propagation_elements.cpp',
175 'opt_dead_builtin_variables.cpp',
176 'opt_dead_builtin_varyings.cpp',
177 'opt_dead_code.cpp',
178 'opt_dead_code_local.cpp',
179 'opt_dead_functions.cpp',
180 'opt_flatten_nested_if_blocks.cpp',
181 'opt_flip_matrices.cpp',
182 'opt_function_inlining.cpp',
183 'opt_if_simplification.cpp',
184 'opt_minmax.cpp',
185 'opt_rebalance_tree.cpp',
186 'opt_redundant_jumps.cpp',
187 'opt_structure_splitting.cpp',
188 'opt_swizzle.cpp',
189 'opt_tree_grafting.cpp',
190 'opt_vectorize.cpp',
191 'program.h',
192 'propagate_invariance.cpp',
193 's_expression.cpp',
194 's_expression.h',
195 'string_to_uint_map.cpp',
196 'string_to_uint_map.h',
197 'serialize.cpp',
198 'serialize.h',
199 'shader_cache.cpp',
200 'shader_cache.h',
201 )
202
203 files_libglsl_standalone = files(
204 'ir_builder_print_visitor.cpp',
205 'ir_builder_print_visitor.h',
206 'opt_add_neg_to_sub.h',
207 'standalone_scaffolding.cpp',
208 'standalone_scaffolding.h',
209 'standalone.cpp',
210 'standalone.h',
211 )
212
213 libglsl = static_library(
214 'glsl',
215 [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h,
216 ir_expression_operation_strings_h, ir_expression_operation_constant_h],
217 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
218 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
219 link_with : libglcpp,
220 include_directories : [inc_common, inc_compiler, inc_nir],
221 dependencies : idep_nir,
222 build_by_default : false,
223 )
224
225 libglsl_standalone = static_library(
226 'glsl_standalone',
227 [files_libglsl_standalone, ir_expression_operation_h],
228 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
229 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
230 include_directories : [inc_common],
231 link_with : [libglsl, libglsl_util, libmesa_util],
232 dependencies : [dep_thread],
233 build_by_default : false,
234 )
235
236 glsl_compiler = executable(
237 'glsl_compiler',
238 'main.cpp',
239 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
240 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
241 dependencies : [dep_clock, dep_thread],
242 include_directories : [inc_common],
243 link_with : [libglsl_standalone],
244 build_by_default : with_tools.contains('glsl'),
245 install : with_tools.contains('glsl'),
246 )
247
248 glsl_test = executable(
249 'glsl_test',
250 ['test.cpp', 'test_optpass.cpp', 'test_optpass.h',
251 ir_expression_operation_h],
252 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
253 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
254 include_directories : [inc_common],
255 dependencies : [dep_clock, dep_thread],
256 link_with : [libglsl, libglsl_standalone, libglsl_util],
257 build_by_default : with_tools.contains('glsl'),
258 install : with_tools.contains('glsl'),
259 )
260
261 if with_tests
262 subdir('tests')
263 endif