meson.build revision 7e102996
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 : ['xxd.py', '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_bindless_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_initializers.c', 83 'gl_nir_link_uniforms.c', 84 'gl_nir_link_xfb.c', 85 'gl_nir_linker.c', 86 'gl_nir_linker.h', 87 'gl_nir.h', 88 'glsl_parser_extras.cpp', 89 'glsl_parser_extras.h', 90 'glsl_symbol_table.cpp', 91 'glsl_symbol_table.h', 92 'glsl_to_nir.cpp', 93 'glsl_to_nir.h', 94 'hir_field_selection.cpp', 95 'ir_array_refcount.cpp', 96 'ir_array_refcount.h', 97 'ir_basic_block.cpp', 98 'ir_basic_block.h', 99 'ir_builder.cpp', 100 'ir_builder.h', 101 'ir_clone.cpp', 102 'ir_constant_expression.cpp', 103 'ir.cpp', 104 'ir.h', 105 'ir_equals.cpp', 106 'ir_expression_flattening.cpp', 107 'ir_expression_flattening.h', 108 'ir_function_can_inline.cpp', 109 'ir_function_detect_recursion.cpp', 110 'ir_function_inlining.h', 111 'ir_function.cpp', 112 'ir_hierarchical_visitor.cpp', 113 'ir_hierarchical_visitor.h', 114 'ir_hv_accept.cpp', 115 'ir_optimization.h', 116 'ir_print_visitor.cpp', 117 'ir_print_visitor.h', 118 'ir_reader.cpp', 119 'ir_reader.h', 120 'ir_rvalue_visitor.cpp', 121 'ir_rvalue_visitor.h', 122 'ir_set_program_inouts.cpp', 123 'ir_uniform.h', 124 'ir_validate.cpp', 125 'ir_variable_refcount.cpp', 126 'ir_variable_refcount.h', 127 'ir_visitor.h', 128 'linker.cpp', 129 'linker.h', 130 'linker_util.h', 131 'linker_util.cpp', 132 'link_atomics.cpp', 133 'link_functions.cpp', 134 'link_interface_blocks.cpp', 135 'link_uniforms.cpp', 136 'link_uniform_initializers.cpp', 137 'link_uniform_block_active_visitor.cpp', 138 'link_uniform_block_active_visitor.h', 139 'link_uniform_blocks.cpp', 140 'link_varyings.cpp', 141 'link_varyings.h', 142 'list.h', 143 'loop_analysis.cpp', 144 'loop_analysis.h', 145 'loop_unroll.cpp', 146 'lower_blend_equation_advanced.cpp', 147 'lower_buffer_access.cpp', 148 'lower_buffer_access.h', 149 'lower_const_arrays_to_uniforms.cpp', 150 'lower_cs_derived.cpp', 151 'lower_discard.cpp', 152 'lower_discard_flow.cpp', 153 'lower_distance.cpp', 154 'lower_if_to_cond_assign.cpp', 155 'lower_instructions.cpp', 156 'lower_int64.cpp', 157 'lower_jumps.cpp', 158 'lower_mat_op_to_vec.cpp', 159 'lower_noise.cpp', 160 'lower_offset_array.cpp', 161 'lower_packed_varyings.cpp', 162 'lower_named_interface_blocks.cpp', 163 'lower_packing_builtins.cpp', 164 'lower_subroutine.cpp', 165 'lower_tess_level.cpp', 166 'lower_texture_projection.cpp', 167 'lower_variable_index_to_cond_assign.cpp', 168 'lower_vec_index_to_cond_assign.cpp', 169 'lower_vec_index_to_swizzle.cpp', 170 'lower_vector.cpp', 171 'lower_vector_derefs.cpp', 172 'lower_vector_insert.cpp', 173 'lower_vertex_id.cpp', 174 'lower_output_reads.cpp', 175 'lower_shared_reference.cpp', 176 'lower_ubo_reference.cpp', 177 'opt_algebraic.cpp', 178 'opt_array_splitting.cpp', 179 'opt_conditional_discard.cpp', 180 'opt_constant_folding.cpp', 181 'opt_constant_propagation.cpp', 182 'opt_constant_variable.cpp', 183 'opt_copy_propagation_elements.cpp', 184 'opt_dead_builtin_variables.cpp', 185 'opt_dead_builtin_varyings.cpp', 186 'opt_dead_code.cpp', 187 'opt_dead_code_local.cpp', 188 'opt_dead_functions.cpp', 189 'opt_flatten_nested_if_blocks.cpp', 190 'opt_flip_matrices.cpp', 191 'opt_function_inlining.cpp', 192 'opt_if_simplification.cpp', 193 'opt_minmax.cpp', 194 'opt_rebalance_tree.cpp', 195 'opt_redundant_jumps.cpp', 196 'opt_structure_splitting.cpp', 197 'opt_swizzle.cpp', 198 'opt_tree_grafting.cpp', 199 'opt_vectorize.cpp', 200 'program.h', 201 'propagate_invariance.cpp', 202 's_expression.cpp', 203 's_expression.h', 204 'string_to_uint_map.cpp', 205 'string_to_uint_map.h', 206 'serialize.cpp', 207 'serialize.h', 208 'shader_cache.cpp', 209 'shader_cache.h', 210) 211 212files_libglsl_standalone = files( 213 'ir_builder_print_visitor.cpp', 214 'ir_builder_print_visitor.h', 215 'opt_add_neg_to_sub.h', 216 'standalone_scaffolding.cpp', 217 'standalone_scaffolding.h', 218 'standalone.cpp', 219 'standalone.h', 220) 221 222libglsl = static_library( 223 'glsl', 224 [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h, 225 ir_expression_operation_strings_h, ir_expression_operation_constant_h, 226 float64_glsl_h], 227 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 228 cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 229 link_with : libglcpp, 230 include_directories : [inc_common, inc_compiler, inc_nir], 231 dependencies : idep_nir, 232 build_by_default : false, 233) 234 235libglsl_standalone = static_library( 236 'glsl_standalone', 237 [files_libglsl_standalone, ir_expression_operation_h], 238 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 239 cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 240 include_directories : [inc_common], 241 link_with : [libglsl, libglsl_util, libmesa_util], 242 dependencies : [dep_thread], 243 build_by_default : false, 244) 245 246glsl_compiler = executable( 247 'glsl_compiler', 248 'main.cpp', 249 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 250 cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 251 dependencies : [dep_clock, dep_thread], 252 include_directories : [inc_common], 253 link_with : [libglsl_standalone], 254 build_by_default : with_tools.contains('glsl'), 255 install : with_tools.contains('glsl'), 256) 257 258glsl_test = executable( 259 'glsl_test', 260 ['test.cpp', 'test_optpass.cpp', 'test_optpass.h', 261 ir_expression_operation_h], 262 c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 263 cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 264 include_directories : [inc_common], 265 dependencies : [dep_clock, dep_thread], 266 link_with : [libglsl, libglsl_standalone, libglsl_util], 267 build_by_default : with_tools.contains('glsl'), 268 install : with_tools.contains('glsl'), 269) 270 271if with_any_opengl and with_tests 272 subdir('tests') 273endif 274