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