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 21subdir('glcpp') 22 23glsl_parser = custom_target( 24 'glsl_parser', 25 input : 'glsl_parser.yy', 26 output : ['glsl_parser.cpp', 'glsl_parser.h'], 27 command : [ 28 prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@', 29 '@INPUT@', 30 ], 31) 32 33glsl_lexer_cpp = custom_target( 34 'glsl_lexer_cpp', 35 input : 'glsl_lexer.ll', 36 output : 'glsl_lexer.cpp', 37 command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'], 38) 39 40ir_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'], 45 capture : true, 46) 47 48ir_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'], 53 capture : true, 54) 55 56float64_glsl_h = custom_target( 57 'float64_glsl.h', 58 input : [files_xxd, 'float64.glsl'], 59 output : 'float64_glsl.h', 60 command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'float64_source'], 61) 62 63files_libglsl = files( 64 'ast.h', 65 'ast_array_index.cpp', 66 'ast_expr.cpp', 67 'ast_function.cpp', 68 'ast_to_hir.cpp', 69 'ast_type.cpp', 70 'builtin_functions.cpp', 71 'builtin_functions.h', 72 'builtin_int64.h', 73 'builtin_types.cpp', 74 'builtin_variables.cpp', 75 'generate_ir.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', 85 'gl_nir_link_xfb.c', 86 'gl_nir_linker.c', 87 'gl_nir_linker.h', 88 'gl_nir.h', 89 'glsl_parser_extras.cpp', 90 'glsl_parser_extras.h', 91 'glsl_symbol_table.cpp', 92 'glsl_symbol_table.h', 93 'glsl_to_nir.cpp', 94 'glsl_to_nir.h', 95 'hir_field_selection.cpp', 96 'ir_array_refcount.cpp', 97 'ir_array_refcount.h', 98 'ir_basic_block.cpp', 99 'ir_basic_block.h', 100 'ir_builder.cpp', 101 'ir_builder.h', 102 'ir_clone.cpp', 103 'ir_constant_expression.cpp', 104 'ir.cpp', 105 'ir.h', 106 'ir_equals.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', 112 'ir_function.cpp', 113 'ir_hierarchical_visitor.cpp', 114 'ir_hierarchical_visitor.h', 115 'ir_hv_accept.cpp', 116 'ir_optimization.h', 117 'ir_print_visitor.cpp', 118 'ir_print_visitor.h', 119 'ir_reader.cpp', 120 'ir_reader.h', 121 'ir_rvalue_visitor.cpp', 122 'ir_rvalue_visitor.h', 123 'ir_set_program_inouts.cpp', 124 'ir_uniform.h', 125 'ir_validate.cpp', 126 'ir_variable_refcount.cpp', 127 'ir_variable_refcount.h', 128 'ir_visitor.h', 129 'linker.cpp', 130 'linker.h', 131 'linker_util.h', 132 'linker_util.cpp', 133 'link_atomics.cpp', 134 'link_functions.cpp', 135 'link_interface_blocks.cpp', 136 'link_uniforms.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', 141 'link_varyings.cpp', 142 'link_varyings.h', 143 'list.h', 144 'loop_analysis.cpp', 145 'loop_analysis.h', 146 'loop_unroll.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', 153 'lower_discard.cpp', 154 'lower_discard_flow.cpp', 155 'lower_distance.cpp', 156 'lower_if_to_cond_assign.cpp', 157 'lower_instructions.cpp', 158 'lower_int64.cpp', 159 'lower_jumps.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', 172 'lower_vector.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', 180 'opt_algebraic.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', 189 'opt_dead_code.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', 196 'opt_minmax.cpp', 197 'opt_rebalance_tree.cpp', 198 'opt_redundant_jumps.cpp', 199 'opt_structure_splitting.cpp', 200 'opt_swizzle.cpp', 201 'opt_tree_grafting.cpp', 202 'opt_vectorize.cpp', 203 'program.h', 204 'propagate_invariance.cpp', 205 's_expression.cpp', 206 's_expression.h', 207 'string_to_uint_map.cpp', 208 'string_to_uint_map.h', 209 'serialize.cpp', 210 'serialize.h', 211 'shader_cache.cpp', 212 'shader_cache.h', 213) 214 215files_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', 221 'standalone.cpp', 222 'standalone.h', 223) 224 225libglsl = static_library( 226 'glsl', 227 [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h, 228 ir_expression_operation_strings_h, ir_expression_operation_constant_h, 229 float64_glsl_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, 237) 238 239libglsl_standalone = static_library( 240 'glsl_standalone', 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, 249) 250 251glsl_compiler = executable( 252 'glsl_compiler', 253 'main.cpp', 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'), 262) 263 264glsl_test = executable( 265 'glsl_test', 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'), 276) 277 278if with_any_opengl and with_tests 279 subdir('tests') 280endif 281