1 # Copyright © 2017 Intel Corporation
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:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
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
23 glsl_parser = custom_target(
25 input : 'glsl_parser.yy',
26 output : ['glsl_parser.cpp', 'glsl_parser.h'],
28 prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@',
33 glsl_lexer_cpp = custom_target(
35 input : 'glsl_lexer.ll',
36 output : 'glsl_lexer.cpp',
37 command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
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_python2, '@INPUT@', 'constant'],
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_python2, '@INPUT@', 'strings'],
56 files_libglsl = files(
58 'ast_array_index.cpp',
63 'builtin_functions.cpp',
64 'builtin_functions.h',
67 'builtin_variables.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',
78 'glsl_parser_extras.cpp',
79 'glsl_parser_extras.h',
80 'glsl_symbol_table.cpp',
81 'glsl_symbol_table.h',
84 'hir_field_selection.cpp',
85 'ir_array_refcount.cpp',
86 'ir_array_refcount.h',
92 'ir_constant_expression.cpp',
96 'ir_expression_flattening.cpp',
97 'ir_expression_flattening.h',
98 'ir_function_can_inline.cpp',
99 'ir_function_detect_recursion.cpp',
100 'ir_function_inlining.h',
102 'ir_hierarchical_visitor.cpp',
103 'ir_hierarchical_visitor.h',
106 'ir_print_visitor.cpp',
107 'ir_print_visitor.h',
110 'ir_rvalue_visitor.cpp',
111 'ir_rvalue_visitor.h',
112 'ir_set_program_inouts.cpp',
115 'ir_variable_refcount.cpp',
116 'ir_variable_refcount.h',
123 'link_functions.cpp',
124 'link_interface_blocks.cpp',
126 'link_uniform_initializers.cpp',
127 'link_uniform_block_active_visitor.cpp',
128 'link_uniform_block_active_visitor.h',
129 'link_uniform_blocks.cpp',
136 'lower_blend_equation_advanced.cpp',
137 'lower_buffer_access.cpp',
138 'lower_buffer_access.h',
139 'lower_const_arrays_to_uniforms.cpp',
140 'lower_cs_derived.cpp',
142 'lower_discard_flow.cpp',
143 'lower_distance.cpp',
144 'lower_if_to_cond_assign.cpp',
145 'lower_instructions.cpp',
148 'lower_mat_op_to_vec.cpp',
150 'lower_offset_array.cpp',
151 'lower_packed_varyings.cpp',
152 'lower_named_interface_blocks.cpp',
153 'lower_packing_builtins.cpp',
154 'lower_subroutine.cpp',
155 'lower_tess_level.cpp',
156 'lower_texture_projection.cpp',
157 'lower_variable_index_to_cond_assign.cpp',
158 'lower_vec_index_to_cond_assign.cpp',
159 'lower_vec_index_to_swizzle.cpp',
161 'lower_vector_derefs.cpp',
162 'lower_vector_insert.cpp',
163 'lower_vertex_id.cpp',
164 'lower_output_reads.cpp',
165 'lower_shared_reference.cpp',
166 'lower_ubo_reference.cpp',
168 'opt_array_splitting.cpp',
169 'opt_conditional_discard.cpp',
170 'opt_constant_folding.cpp',
171 'opt_constant_propagation.cpp',
172 'opt_constant_variable.cpp',
173 'opt_copy_propagation_elements.cpp',
174 'opt_dead_builtin_variables.cpp',
175 'opt_dead_builtin_varyings.cpp',
177 'opt_dead_code_local.cpp',
178 'opt_dead_functions.cpp',
179 'opt_flatten_nested_if_blocks.cpp',
180 'opt_flip_matrices.cpp',
181 'opt_function_inlining.cpp',
182 'opt_if_simplification.cpp',
184 'opt_rebalance_tree.cpp',
185 'opt_redundant_jumps.cpp',
186 'opt_structure_splitting.cpp',
188 'opt_tree_grafting.cpp',
191 'propagate_invariance.cpp',
194 'string_to_uint_map.cpp',
195 'string_to_uint_map.h',
202 files_libglsl_standalone = files(
203 'ir_builder_print_visitor.cpp',
204 'ir_builder_print_visitor.h',
205 'opt_add_neg_to_sub.h',
206 'standalone_scaffolding.cpp',
207 'standalone_scaffolding.h',
212 libglsl = static_library(
214 [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h,
215 ir_expression_operation_strings_h, ir_expression_operation_constant_h],
216 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
217 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
218 link_with : libglcpp,
219 include_directories : [inc_common, inc_compiler, inc_nir],
220 dependencies : idep_nir,
221 build_by_default : false,
224 libglsl_standalone = static_library(
226 [files_libglsl_standalone, ir_expression_operation_h],
227 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
228 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
229 include_directories : [inc_common],
230 link_with : [libglsl, libglsl_util, libmesa_util],
231 dependencies : [dep_thread],
232 build_by_default : false,
235 glsl_compiler = executable(
238 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
239 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
240 dependencies : [dep_clock, dep_thread],
241 include_directories : [inc_common],
242 link_with : [libglsl_standalone],
243 build_by_default : with_tools.contains('glsl'),
244 install : with_tools.contains('glsl'),
247 glsl_test = executable(
249 ['test.cpp', 'test_optpass.cpp', 'test_optpass.h',
250 ir_expression_operation_h],
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 include_directories : [inc_common],
254 dependencies : [dep_clock, dep_thread],
255 link_with : [libglsl, libglsl_standalone, libglsl_util],
256 build_by_default : with_tools.contains('glsl'),
257 install : with_tools.contains('glsl'),