1# Copyright © 2017 Intel Corporation 2# SPDX-License-Identifier: MIT 3 4libglsl_util = static_library( 5 'glsl_util', 6 glsl_util_files, 7 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 8 dependencies : [dep_valgrind, idep_mesautil], 9 gnu_symbol_visibility : 'hidden', 10 build_by_default : false, 11) 12 13subdir('glcpp') 14 15bison_command = [] 16if yacc_is_bison 17 bison_command = [ 18 prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@', 19 '@INPUT@', 20 ] 21else 22 bison_command = [ 23 prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '-H', '@OUTPUT1@', 24 '@INPUT@', 25 ] 26endif 27 28glsl_parser = custom_target( 29 'glsl_parser', 30 input : 'glsl_parser.yy', 31 output : ['glsl_parser.cpp', 'glsl_parser.h'], 32 command : bison_command 33) 34 35glsl_lexer_cpp = custom_target( 36 'glsl_lexer_cpp', 37 input : 'glsl_lexer.ll', 38 output : 'glsl_lexer.cpp', 39 command : [prog_flex_cpp, '-o', '@OUTPUT@', '@INPUT@'], 40) 41 42ir_expression_operation_constant_h = custom_target( 43 'ir_expression_operation_constant.h', 44 input : 'ir_expression_operation.py', 45 output : 'ir_expression_operation_constant.h', 46 command : [prog_python, '@INPUT@', 'constant'], 47 capture : true, 48) 49 50ir_expression_operation_strings_h = custom_target( 51 'ir_expression_operation_strings.h', 52 input : 'ir_expression_operation.py', 53 output : 'ir_expression_operation_strings.h', 54 command : [prog_python, '@INPUT@', 'strings'], 55 capture : true, 56) 57 58float64_glsl_h = custom_target( 59 'float64_glsl.h', 60 input : [files_xxd, 'float64.glsl'], 61 output : 'float64_glsl.h', 62 command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'float64_source'], 63) 64 65cross_platform_settings_piece_all_h = custom_target( 66 'cross_platform_settings_piece_all.h', 67 input : [files_xxd, 'CrossPlatformSettings_piece_all.glsl'], 68 output : 'cross_platform_settings_piece_all.h', 69 command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'cross_platform_settings_piece_all_header'], 70) 71 72bc1_glsl_h = custom_target( 73 'bc1_glsl.h', 74 input : [files_xxd, 'bc1.glsl'], 75 output : 'bc1_glsl.h', 76 command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'bc1_source'], 77) 78 79bc4_glsl_h = custom_target( 80 'bc4_glsl.h', 81 input : [files_xxd, 'bc4.glsl'], 82 output : 'bc4_glsl.h', 83 command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'bc4_source'], 84) 85 86etc2_rgba_stitch_glsl_h = custom_target( 87 'etc2_rgba_stitch_glsl.h', 88 input : [files_xxd, 'etc2_rgba_stitch.glsl'], 89 output : 'etc2_rgba_stitch_glsl.h', 90 command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'etc2_rgba_stitch_source'], 91) 92 93astc_glsl_h = custom_target( 94 'astc_glsl.h', 95 input : [files_xxd, 'astc_decoder.glsl'], 96 output : 'astc_glsl.h', 97 command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'astc_source'], 98) 99 100files_libglsl = files( 101 'ast.h', 102 'ast_array_index.cpp', 103 'ast_expr.cpp', 104 'ast_function.cpp', 105 'ast_to_hir.cpp', 106 'ast_type.cpp', 107 'builtin_functions.cpp', 108 'builtin_functions.h', 109 'builtin_types.cpp', 110 'builtin_variables.cpp', 111 'gl_nir_detect_function_recursion.c', 112 'gl_nir_lower_atomics.c', 113 'gl_nir_lower_images.c', 114 'gl_nir_lower_blend_equation_advanced.c', 115 'gl_nir_lower_buffers.c', 116 'gl_nir_lower_discard_flow.c', 117 'gl_nir_lower_named_interface_blocks.c', 118 'gl_nir_lower_packed_varyings.c', 119 'gl_nir_lower_samplers.c', 120 'gl_nir_lower_samplers_as_deref.c', 121 'gl_nir_lower_xfb_varying.c', 122 'gl_nir_link_atomics.c', 123 'gl_nir_link_interface_blocks.c', 124 'gl_nir_link_uniform_blocks.c', 125 'gl_nir_link_uniform_initializers.c', 126 'gl_nir_link_uniforms.c', 127 'gl_nir_link_varyings.c', 128 'gl_nir_link_varyings.h', 129 'gl_nir_link_xfb.c', 130 'gl_nir_linker.c', 131 'gl_nir_linker.h', 132 'gl_nir_opt_dead_builtin_varyings.c', 133 'gl_nir.h', 134 'glsl_parser_extras.cpp', 135 'glsl_parser_extras.h', 136 'glsl_symbol_table.cpp', 137 'glsl_symbol_table.h', 138 'glsl_to_nir.cpp', 139 'glsl_to_nir.h', 140 'hir_field_selection.cpp', 141 'ir_array_refcount.cpp', 142 'ir_array_refcount.h', 143 'ir_basic_block.cpp', 144 'ir_basic_block.h', 145 'ir_builder.cpp', 146 'ir_builder.h', 147 'ir_clone.cpp', 148 'ir_constant_expression.cpp', 149 'ir.cpp', 150 'ir.h', 151 'ir_equals.cpp', 152 'ir_expression_flattening.cpp', 153 'ir_expression_flattening.h', 154 'ir_function_detect_recursion.cpp', 155 'ir_function.cpp', 156 'ir_hierarchical_visitor.cpp', 157 'ir_hierarchical_visitor.h', 158 'ir_hv_accept.cpp', 159 'ir_optimization.h', 160 'ir_print_visitor.cpp', 161 'ir_print_visitor.h', 162 'ir_reader.cpp', 163 'ir_reader.h', 164 'ir_rvalue_visitor.cpp', 165 'ir_rvalue_visitor.h', 166 'ir_uniform.h', 167 'ir_validate.cpp', 168 'ir_variable_refcount.cpp', 169 'ir_variable_refcount.h', 170 'ir_visitor.h', 171 'linker.cpp', 172 'linker.h', 173 'linker_util.h', 174 'linker_util.cpp', 175 'link_functions.cpp', 176 'link_interface_blocks.cpp', 177 'list.h', 178 'lower_builtins.cpp', 179 'lower_instructions.cpp', 180 'lower_jumps.cpp', 181 'lower_mat_op_to_vec.cpp', 182 'lower_packing_builtins.cpp', 183 'lower_precision.cpp', 184 'lower_subroutine.cpp', 185 'lower_vec_index_to_cond_assign.cpp', 186 'lower_vector_derefs.cpp', 187 'opt_algebraic.cpp', 188 'opt_dead_builtin_variables.cpp', 189 'opt_dead_code.cpp', 190 'opt_dead_code_local.cpp', 191 'opt_flatten_nested_if_blocks.cpp', 192 'opt_flip_matrices.cpp', 193 'opt_function_inlining.cpp', 194 'opt_if_simplification.cpp', 195 'opt_minmax.cpp', 196 'opt_rebalance_tree.cpp', 197 'opt_tree_grafting.cpp', 198 'program.h', 199 'propagate_invariance.cpp', 200 's_expression.cpp', 201 's_expression.h', 202 'string_to_uint_map.cpp', 203 'string_to_uint_map.h', 204 'serialize.cpp', 205 'serialize.h', 206 'shader_cache.cpp', 207 'shader_cache.h', 208) 209 210files_libglsl_standalone = files( 211 'standalone_scaffolding.cpp', 212 'standalone_scaffolding.h', 213 'standalone.cpp', 214 'standalone.h', 215) 216 217libglsl_headers = [ 218 ir_expression_operation_h, cross_platform_settings_piece_all_h, bc1_glsl_h, 219 bc4_glsl_h, etc2_rgba_stitch_glsl_h, astc_glsl_h 220] 221 222libglsl = static_library( 223 'glsl', 224 [files_libglsl, glsl_parser, glsl_lexer_cpp, libglsl_headers, 225 ir_expression_operation_strings_h, ir_expression_operation_constant_h, 226 float64_glsl_h], 227 c_args : [c_msvc_compat_args, no_override_init_args], 228 cpp_args : [cpp_msvc_compat_args], 229 gnu_symbol_visibility : 'hidden', 230 link_with : libglcpp, 231 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 232 dependencies : [idep_nir, idep_mesautil], 233 build_by_default : false, 234) 235 236idep_libglsl = declare_dependency( 237 sources: libglsl_headers, 238 link_with: libglsl, 239) 240 241libglsl_standalone = static_library( 242 'glsl_standalone', 243 [files_libglsl_standalone, ir_expression_operation_h], 244 c_args : [c_msvc_compat_args, no_override_init_args], 245 cpp_args : [cpp_msvc_compat_args], 246 gnu_symbol_visibility : 'hidden', 247 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 248 link_with : [libglsl, libglsl_util, libglcpp_standalone], 249 dependencies : [idep_mesautil, idep_getopt, idep_compiler], 250 build_by_default : false, 251) 252 253glsl_compiler = executable( 254 'glsl_compiler', 255 'main.cpp', 256 c_args : [c_msvc_compat_args, no_override_init_args], 257 cpp_args : [cpp_msvc_compat_args], 258 gnu_symbol_visibility : 'hidden', 259 dependencies : [dep_clock, dep_thread, idep_getopt, idep_mesautil], 260 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 261 link_with : [libglsl_standalone], 262 build_by_default : with_tools.contains('glsl'), 263 install : with_tools.contains('glsl'), 264) 265 266glsl_test = executable( 267 'glsl_test', 268 ['test.cpp', 'test_optpass.cpp', 'test_optpass.h', 269 ir_expression_operation_h], 270 c_args : [c_msvc_compat_args, no_override_init_args], 271 cpp_args : [cpp_msvc_compat_args], 272 gnu_symbol_visibility : 'hidden', 273 include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], 274 dependencies : [dep_clock, dep_thread, idep_getopt, idep_mesautil, idep_compiler], 275 link_with : [libglsl, libglsl_standalone, libglsl_util], 276 build_by_default : with_tools.contains('glsl'), 277 install : with_tools.contains('glsl'), 278) 279 280if with_any_opengl and with_tests 281 subdir('tests') 282endif 283