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