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',
73 'glsl_parser_extras.cpp',
74 'glsl_parser_extras.h',
75 'glsl_symbol_table.cpp',
76 'glsl_symbol_table.h',
79 'hir_field_selection.cpp',
80 'ir_array_refcount.cpp',
81 'ir_array_refcount.h',
87 'ir_constant_expression.cpp',
91 'ir_expression_flattening.cpp',
92 'ir_expression_flattening.h',
93 'ir_function_can_inline.cpp',
94 'ir_function_detect_recursion.cpp',
95 'ir_function_inlining.h',
97 'ir_hierarchical_visitor.cpp',
98 'ir_hierarchical_visitor.h',
101 'ir_print_visitor.cpp',
102 'ir_print_visitor.h',
105 'ir_rvalue_visitor.cpp',
106 'ir_rvalue_visitor.h',
107 'ir_set_program_inouts.cpp',
110 'ir_variable_refcount.cpp',
111 'ir_variable_refcount.h',
117 'link_functions.cpp',
118 'link_interface_blocks.cpp',
120 'link_uniform_initializers.cpp',
121 'link_uniform_block_active_visitor.cpp',
122 'link_uniform_block_active_visitor.h',
123 'link_uniform_blocks.cpp',
130 'lower_blend_equation_advanced.cpp',
131 'lower_buffer_access.cpp',
132 'lower_buffer_access.h',
133 'lower_const_arrays_to_uniforms.cpp',
134 'lower_cs_derived.cpp',
136 'lower_discard_flow.cpp',
137 'lower_distance.cpp',
138 'lower_if_to_cond_assign.cpp',
139 'lower_instructions.cpp',
142 'lower_mat_op_to_vec.cpp',
144 'lower_offset_array.cpp',
145 'lower_packed_varyings.cpp',
146 'lower_named_interface_blocks.cpp',
147 'lower_packing_builtins.cpp',
148 'lower_subroutine.cpp',
149 'lower_tess_level.cpp',
150 'lower_texture_projection.cpp',
151 'lower_variable_index_to_cond_assign.cpp',
152 'lower_vec_index_to_cond_assign.cpp',
153 'lower_vec_index_to_swizzle.cpp',
155 'lower_vector_derefs.cpp',
156 'lower_vector_insert.cpp',
157 'lower_vertex_id.cpp',
158 'lower_output_reads.cpp',
159 'lower_shared_reference.cpp',
160 'lower_ubo_reference.cpp',
162 'opt_array_splitting.cpp',
163 'opt_conditional_discard.cpp',
164 'opt_constant_folding.cpp',
165 'opt_constant_propagation.cpp',
166 'opt_constant_variable.cpp',
167 'opt_copy_propagation.cpp',
168 'opt_copy_propagation_elements.cpp',
169 'opt_dead_builtin_variables.cpp',
170 'opt_dead_builtin_varyings.cpp',
172 'opt_dead_code_local.cpp',
173 'opt_dead_functions.cpp',
174 'opt_flatten_nested_if_blocks.cpp',
175 'opt_flip_matrices.cpp',
176 'opt_function_inlining.cpp',
177 'opt_if_simplification.cpp',
179 'opt_rebalance_tree.cpp',
180 'opt_redundant_jumps.cpp',
181 'opt_structure_splitting.cpp',
183 'opt_tree_grafting.cpp',
186 'propagate_invariance.cpp',
189 'string_to_uint_map.cpp',
190 'string_to_uint_map.h',
197 files_libglsl_standalone = files(
198 'ir_builder_print_visitor.cpp',
199 'ir_builder_print_visitor.h',
200 'opt_add_neg_to_sub.h',
201 'standalone_scaffolding.cpp',
202 'standalone_scaffolding.h',
207 libglsl = static_library(
209 [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h,
210 ir_expression_operation_strings_h, ir_expression_operation_constant_h],
211 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
212 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
213 link_with : libglcpp,
214 include_directories : [inc_common, inc_compiler, inc_nir],
215 dependencies : idep_nir,
216 build_by_default : false,
219 libglsl_standalone = static_library(
221 [files_libglsl_standalone, ir_expression_operation_h],
222 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
223 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
224 include_directories : [inc_common],
225 link_with : [libglsl, libglsl_util, libmesa_util],
226 dependencies : [dep_thread],
227 build_by_default : false,
230 glsl_compiler = executable(
233 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
234 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
235 dependencies : [dep_clock, dep_thread],
236 include_directories : [inc_common],
237 link_with : [libglsl_standalone],
238 build_by_default : with_tools.contains('glsl'),
239 install : with_tools.contains('glsl'),
242 glsl_test = executable(
244 ['test.cpp', 'test_optpass.cpp', 'test_optpass.h',
245 ir_expression_operation_h],
246 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
247 cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
248 include_directories : [inc_common],
249 dependencies : [dep_clock, dep_thread],
250 link_with : [libglsl, libglsl_standalone, libglsl_util],
251 build_by_default : with_tools.contains('glsl'),
252 install : with_tools.contains('glsl'),