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_python, '@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_python, '@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',
79 'glsl_parser_extras.cpp',
80 'glsl_parser_extras.h',
81 'glsl_symbol_table.cpp',
82 'glsl_symbol_table.h',
85 'hir_field_selection.cpp',
86 'ir_array_refcount.cpp',
87 'ir_array_refcount.h',
93 'ir_constant_expression.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',
103 'ir_hierarchical_visitor.cpp',
104 'ir_hierarchical_visitor.h',
107 'ir_print_visitor.cpp',
108 'ir_print_visitor.h',
111 'ir_rvalue_visitor.cpp',
112 'ir_rvalue_visitor.h',
113 'ir_set_program_inouts.cpp',
116 'ir_variable_refcount.cpp',
117 'ir_variable_refcount.h',
124 'link_functions.cpp',
125 'link_interface_blocks.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',
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',
143 'lower_discard_flow.cpp',
144 'lower_distance.cpp',
145 'lower_if_to_cond_assign.cpp',
146 'lower_instructions.cpp',
149 'lower_mat_op_to_vec.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',
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',
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',
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',
185 'opt_rebalance_tree.cpp',
186 'opt_redundant_jumps.cpp',
187 'opt_structure_splitting.cpp',
189 'opt_tree_grafting.cpp',
192 'propagate_invariance.cpp',
195 'string_to_uint_map.cpp',
196 'string_to_uint_map.h',
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',
213 libglsl = static_library(
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,
225 libglsl_standalone = static_library(
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,
236 glsl_compiler = executable(
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'),
248 glsl_test = executable(
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'),