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 float64_glsl_h = custom_target(
58 input : ['xxd.py', 'float64.glsl'],
59 output : 'float64_glsl.h',
60 command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'float64_source'],
63 files_libglsl = files(
65 'ast_array_index.cpp',
70 'builtin_functions.cpp',
71 'builtin_functions.h',
74 'builtin_variables.cpp',
76 'gl_nir_lower_atomics.c',
77 'gl_nir_lower_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',
89 'glsl_parser_extras.cpp',
90 'glsl_parser_extras.h',
91 'glsl_symbol_table.cpp',
92 'glsl_symbol_table.h',
95 'hir_field_selection.cpp',
96 'ir_array_refcount.cpp',
97 'ir_array_refcount.h',
103 'ir_constant_expression.cpp',
107 'ir_expression_flattening.cpp',
108 'ir_expression_flattening.h',
109 'ir_function_can_inline.cpp',
110 'ir_function_detect_recursion.cpp',
111 'ir_function_inlining.h',
113 'ir_hierarchical_visitor.cpp',
114 'ir_hierarchical_visitor.h',
117 'ir_print_visitor.cpp',
118 'ir_print_visitor.h',
121 'ir_rvalue_visitor.cpp',
122 'ir_rvalue_visitor.h',
123 'ir_set_program_inouts.cpp',
126 'ir_variable_refcount.cpp',
127 'ir_variable_refcount.h',
134 'link_functions.cpp',
135 'link_interface_blocks.cpp',
137 'link_uniform_initializers.cpp',
138 'link_uniform_block_active_visitor.cpp',
139 'link_uniform_block_active_visitor.h',
140 'link_uniform_blocks.cpp',
147 'lower_blend_equation_advanced.cpp',
148 'lower_buffer_access.cpp',
149 'lower_buffer_access.h',
150 'lower_builtins.cpp',
151 'lower_const_arrays_to_uniforms.cpp',
152 'lower_cs_derived.cpp',
154 'lower_discard_flow.cpp',
155 'lower_distance.cpp',
156 'lower_if_to_cond_assign.cpp',
157 'lower_instructions.cpp',
160 'lower_mat_op_to_vec.cpp',
161 'lower_offset_array.cpp',
162 'lower_packed_varyings.cpp',
163 'lower_named_interface_blocks.cpp',
164 'lower_packing_builtins.cpp',
165 'lower_precision.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',
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 'lower_xfb_varying.cpp',
181 'opt_array_splitting.cpp',
182 'opt_conditional_discard.cpp',
183 'opt_constant_folding.cpp',
184 'opt_constant_propagation.cpp',
185 'opt_constant_variable.cpp',
186 'opt_copy_propagation_elements.cpp',
187 'opt_dead_builtin_variables.cpp',
188 'opt_dead_builtin_varyings.cpp',
190 'opt_dead_code_local.cpp',
191 'opt_dead_functions.cpp',
192 'opt_flatten_nested_if_blocks.cpp',
193 'opt_flip_matrices.cpp',
194 'opt_function_inlining.cpp',
195 'opt_if_simplification.cpp',
197 'opt_rebalance_tree.cpp',
198 'opt_redundant_jumps.cpp',
199 'opt_structure_splitting.cpp',
201 'opt_tree_grafting.cpp',
204 'propagate_invariance.cpp',
207 'string_to_uint_map.cpp',
208 'string_to_uint_map.h',
215 files_libglsl_standalone = files(
216 'ir_builder_print_visitor.cpp',
217 'ir_builder_print_visitor.h',
218 'opt_add_neg_to_sub.h',
219 'standalone_scaffolding.cpp',
220 'standalone_scaffolding.h',
225 libglsl = static_library(
227 [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h,
228 ir_expression_operation_strings_h, ir_expression_operation_constant_h,
230 c_args : [c_msvc_compat_args, no_override_init_args],
231 cpp_args : [cpp_msvc_compat_args],
232 gnu_symbol_visibility : 'hidden',
233 link_with : libglcpp,
234 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_compiler],
235 dependencies : idep_nir,
236 build_by_default : false,
239 libglsl_standalone = static_library(
241 [files_libglsl_standalone, ir_expression_operation_h],
242 c_args : [c_msvc_compat_args, no_override_init_args],
243 cpp_args : [cpp_msvc_compat_args],
244 gnu_symbol_visibility : 'hidden',
245 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
246 link_with : [libglsl, libglsl_util, libglcpp_standalone],
247 dependencies : [idep_mesautil, idep_getopt],
248 build_by_default : false,
251 glsl_compiler = executable(
254 c_args : [c_msvc_compat_args, no_override_init_args],
255 cpp_args : [cpp_msvc_compat_args],
256 gnu_symbol_visibility : 'hidden',
257 dependencies : [dep_clock, dep_thread, idep_getopt],
258 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
259 link_with : [libglsl_standalone],
260 build_by_default : with_tools.contains('glsl'),
261 install : with_tools.contains('glsl'),
264 glsl_test = executable(
266 ['test.cpp', 'test_optpass.cpp', 'test_optpass.h',
267 ir_expression_operation_h],
268 c_args : [c_msvc_compat_args, no_override_init_args],
269 cpp_args : [cpp_msvc_compat_args],
270 gnu_symbol_visibility : 'hidden',
271 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
272 dependencies : [dep_clock, dep_thread, idep_getopt],
273 link_with : [libglsl, libglsl_standalone, libglsl_util],
274 build_by_default : with_tools.contains('glsl'),
275 install : with_tools.contains('glsl'),
278 if with_any_opengl and with_tests