meson.build revision b8e80941
1b8e80941Smrg# Copyright © 2017 Intel Corporation 2b8e80941Smrg 3b8e80941Smrg# Permission is hereby granted, free of charge, to any person obtaining a copy 4b8e80941Smrg# of this software and associated documentation files (the "Software"), to deal 5b8e80941Smrg# in the Software without restriction, including without limitation the rights 6b8e80941Smrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7b8e80941Smrg# copies of the Software, and to permit persons to whom the Software is 8b8e80941Smrg# furnished to do so, subject to the following conditions: 9b8e80941Smrg 10b8e80941Smrg# The above copyright notice and this permission notice shall be included in 11b8e80941Smrg# all copies or substantial portions of the Software. 12b8e80941Smrg 13b8e80941Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14b8e80941Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15b8e80941Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16b8e80941Smrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17b8e80941Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18b8e80941Smrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19b8e80941Smrg# SOFTWARE. 20b8e80941Smrg 21b8e80941Smrgsubdir('glcpp') 22b8e80941Smrg 23b8e80941Smrgglsl_parser = custom_target( 24b8e80941Smrg 'glsl_parser', 25b8e80941Smrg input : 'glsl_parser.yy', 26b8e80941Smrg output : ['glsl_parser.cpp', 'glsl_parser.h'], 27b8e80941Smrg command : [ 28b8e80941Smrg prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@', 29b8e80941Smrg '@INPUT@', 30b8e80941Smrg ], 31b8e80941Smrg) 32b8e80941Smrg 33b8e80941Smrgglsl_lexer_cpp = custom_target( 34b8e80941Smrg 'glsl_lexer_cpp', 35b8e80941Smrg input : 'glsl_lexer.ll', 36b8e80941Smrg output : 'glsl_lexer.cpp', 37b8e80941Smrg command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'], 38b8e80941Smrg) 39b8e80941Smrg 40b8e80941Smrgir_expression_operation_constant_h = custom_target( 41b8e80941Smrg 'ir_expression_operation_constant.h', 42b8e80941Smrg input : 'ir_expression_operation.py', 43b8e80941Smrg output : 'ir_expression_operation_constant.h', 44b8e80941Smrg command : [prog_python, '@INPUT@', 'constant'], 45b8e80941Smrg capture : true, 46b8e80941Smrg) 47b8e80941Smrg 48b8e80941Smrgir_expression_operation_strings_h = custom_target( 49b8e80941Smrg 'ir_expression_operation_strings.h', 50b8e80941Smrg input : 'ir_expression_operation.py', 51b8e80941Smrg output : 'ir_expression_operation_strings.h', 52b8e80941Smrg command : [prog_python, '@INPUT@', 'strings'], 53b8e80941Smrg capture : true, 54b8e80941Smrg) 55b8e80941Smrg 56b8e80941Smrgfloat64_glsl_h = custom_target( 57b8e80941Smrg 'float64_glsl.h', 58b8e80941Smrg input : ['xxd.py', 'float64.glsl'], 59b8e80941Smrg output : 'float64_glsl.h', 60b8e80941Smrg command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'float64_source'], 61b8e80941Smrg) 62b8e80941Smrg 63b8e80941Smrgfiles_libglsl = files( 64b8e80941Smrg 'ast.h', 65b8e80941Smrg 'ast_array_index.cpp', 66b8e80941Smrg 'ast_expr.cpp', 67b8e80941Smrg 'ast_function.cpp', 68b8e80941Smrg 'ast_to_hir.cpp', 69b8e80941Smrg 'ast_type.cpp', 70b8e80941Smrg 'builtin_functions.cpp', 71b8e80941Smrg 'builtin_functions.h', 72b8e80941Smrg 'builtin_int64.h', 73b8e80941Smrg 'builtin_types.cpp', 74b8e80941Smrg 'builtin_variables.cpp', 75b8e80941Smrg 'generate_ir.cpp', 76b8e80941Smrg 'gl_nir_lower_atomics.c', 77b8e80941Smrg 'gl_nir_lower_bindless_images.c', 78b8e80941Smrg 'gl_nir_lower_buffers.c', 79b8e80941Smrg 'gl_nir_lower_samplers.c', 80b8e80941Smrg 'gl_nir_lower_samplers_as_deref.c', 81b8e80941Smrg 'gl_nir_link_atomics.c', 82b8e80941Smrg 'gl_nir_link_uniform_initializers.c', 83b8e80941Smrg 'gl_nir_link_uniforms.c', 84b8e80941Smrg 'gl_nir_link_xfb.c', 85b8e80941Smrg 'gl_nir_linker.c', 86b8e80941Smrg 'gl_nir_linker.h', 87b8e80941Smrg 'gl_nir.h', 88b8e80941Smrg 'glsl_parser_extras.cpp', 89b8e80941Smrg 'glsl_parser_extras.h', 90b8e80941Smrg 'glsl_symbol_table.cpp', 91b8e80941Smrg 'glsl_symbol_table.h', 92b8e80941Smrg 'glsl_to_nir.cpp', 93b8e80941Smrg 'glsl_to_nir.h', 94b8e80941Smrg 'hir_field_selection.cpp', 95b8e80941Smrg 'ir_array_refcount.cpp', 96b8e80941Smrg 'ir_array_refcount.h', 97b8e80941Smrg 'ir_basic_block.cpp', 98b8e80941Smrg 'ir_basic_block.h', 99b8e80941Smrg 'ir_builder.cpp', 100b8e80941Smrg 'ir_builder.h', 101b8e80941Smrg 'ir_clone.cpp', 102b8e80941Smrg 'ir_constant_expression.cpp', 103b8e80941Smrg 'ir.cpp', 104b8e80941Smrg 'ir.h', 105b8e80941Smrg 'ir_equals.cpp', 106b8e80941Smrg 'ir_expression_flattening.cpp', 107b8e80941Smrg 'ir_expression_flattening.h', 108b8e80941Smrg 'ir_function_can_inline.cpp', 109b8e80941Smrg 'ir_function_detect_recursion.cpp', 110b8e80941Smrg 'ir_function_inlining.h', 111b8e80941Smrg 'ir_function.cpp', 112b8e80941Smrg 'ir_hierarchical_visitor.cpp', 113b8e80941Smrg 'ir_hierarchical_visitor.h', 114b8e80941Smrg 'ir_hv_accept.cpp', 115b8e80941Smrg 'ir_optimization.h', 116b8e80941Smrg 'ir_print_visitor.cpp', 117b8e80941Smrg 'ir_print_visitor.h', 118b8e80941Smrg 'ir_reader.cpp', 119b8e80941Smrg 'ir_reader.h', 120b8e80941Smrg 'ir_rvalue_visitor.cpp', 121b8e80941Smrg 'ir_rvalue_visitor.h', 122b8e80941Smrg 'ir_set_program_inouts.cpp', 123b8e80941Smrg 'ir_uniform.h', 124b8e80941Smrg 'ir_validate.cpp', 125b8e80941Smrg 'ir_variable_refcount.cpp', 126b8e80941Smrg 'ir_variable_refcount.h', 127b8e80941Smrg 'ir_visitor.h', 128b8e80941Smrg 'linker.cpp', 129b8e80941Smrg 'linker.h', 130b8e80941Smrg 'linker_util.h', 131b8e80941Smrg 'linker_util.cpp', 132b8e80941Smrg 'link_atomics.cpp', 133b8e80941Smrg 'link_functions.cpp', 134b8e80941Smrg 'link_interface_blocks.cpp', 135b8e80941Smrg 'link_uniforms.cpp', 136b8e80941Smrg 'link_uniform_initializers.cpp', 137b8e80941Smrg 'link_uniform_block_active_visitor.cpp', 138b8e80941Smrg 'link_uniform_block_active_visitor.h', 139b8e80941Smrg 'link_uniform_blocks.cpp', 140b8e80941Smrg 'link_varyings.cpp', 141b8e80941Smrg 'link_varyings.h', 142b8e80941Smrg 'list.h', 143b8e80941Smrg 'loop_analysis.cpp', 144b8e80941Smrg 'loop_analysis.h', 145b8e80941Smrg 'loop_unroll.cpp', 146b8e80941Smrg 'lower_blend_equation_advanced.cpp', 147b8e80941Smrg 'lower_buffer_access.cpp', 148b8e80941Smrg 'lower_buffer_access.h', 149b8e80941Smrg 'lower_const_arrays_to_uniforms.cpp', 150b8e80941Smrg 'lower_cs_derived.cpp', 151b8e80941Smrg 'lower_discard.cpp', 152b8e80941Smrg 'lower_discard_flow.cpp', 153b8e80941Smrg 'lower_distance.cpp', 154b8e80941Smrg 'lower_if_to_cond_assign.cpp', 155b8e80941Smrg 'lower_instructions.cpp', 156b8e80941Smrg 'lower_int64.cpp', 157b8e80941Smrg 'lower_jumps.cpp', 158b8e80941Smrg 'lower_mat_op_to_vec.cpp', 159b8e80941Smrg 'lower_noise.cpp', 160b8e80941Smrg 'lower_offset_array.cpp', 161b8e80941Smrg 'lower_packed_varyings.cpp', 162b8e80941Smrg 'lower_named_interface_blocks.cpp', 163b8e80941Smrg 'lower_packing_builtins.cpp', 164b8e80941Smrg 'lower_subroutine.cpp', 165b8e80941Smrg 'lower_tess_level.cpp', 166b8e80941Smrg 'lower_texture_projection.cpp', 167b8e80941Smrg 'lower_variable_index_to_cond_assign.cpp', 168b8e80941Smrg 'lower_vec_index_to_cond_assign.cpp', 169b8e80941Smrg 'lower_vec_index_to_swizzle.cpp', 170b8e80941Smrg 'lower_vector.cpp', 171b8e80941Smrg 'lower_vector_derefs.cpp', 172b8e80941Smrg 'lower_vector_insert.cpp', 173b8e80941Smrg 'lower_vertex_id.cpp', 174b8e80941Smrg 'lower_output_reads.cpp', 175b8e80941Smrg 'lower_shared_reference.cpp', 176b8e80941Smrg 'lower_ubo_reference.cpp', 177b8e80941Smrg 'opt_algebraic.cpp', 178b8e80941Smrg 'opt_array_splitting.cpp', 179b8e80941Smrg 'opt_conditional_discard.cpp', 180b8e80941Smrg 'opt_constant_folding.cpp', 181b8e80941Smrg 'opt_constant_propagation.cpp', 182b8e80941Smrg 'opt_constant_variable.cpp', 183b8e80941Smrg 'opt_copy_propagation_elements.cpp', 184b8e80941Smrg 'opt_dead_builtin_variables.cpp', 185b8e80941Smrg 'opt_dead_builtin_varyings.cpp', 186b8e80941Smrg 'opt_dead_code.cpp', 187b8e80941Smrg 'opt_dead_code_local.cpp', 188b8e80941Smrg 'opt_dead_functions.cpp', 189b8e80941Smrg 'opt_flatten_nested_if_blocks.cpp', 190b8e80941Smrg 'opt_flip_matrices.cpp', 191b8e80941Smrg 'opt_function_inlining.cpp', 192b8e80941Smrg 'opt_if_simplification.cpp', 193b8e80941Smrg 'opt_minmax.cpp', 194b8e80941Smrg 'opt_rebalance_tree.cpp', 195b8e80941Smrg 'opt_redundant_jumps.cpp', 196b8e80941Smrg 'opt_structure_splitting.cpp', 197b8e80941Smrg 'opt_swizzle.cpp', 198b8e80941Smrg 'opt_tree_grafting.cpp', 199b8e80941Smrg 'opt_vectorize.cpp', 200b8e80941Smrg 'program.h', 201b8e80941Smrg 'propagate_invariance.cpp', 202b8e80941Smrg 's_expression.cpp', 203b8e80941Smrg 's_expression.h', 204b8e80941Smrg 'string_to_uint_map.cpp', 205b8e80941Smrg 'string_to_uint_map.h', 206b8e80941Smrg 'serialize.cpp', 207b8e80941Smrg 'serialize.h', 208b8e80941Smrg 'shader_cache.cpp', 209b8e80941Smrg 'shader_cache.h', 210b8e80941Smrg) 211b8e80941Smrg 212b8e80941Smrgfiles_libglsl_standalone = files( 213b8e80941Smrg 'ir_builder_print_visitor.cpp', 214b8e80941Smrg 'ir_builder_print_visitor.h', 215b8e80941Smrg 'opt_add_neg_to_sub.h', 216b8e80941Smrg 'standalone_scaffolding.cpp', 217b8e80941Smrg 'standalone_scaffolding.h', 218b8e80941Smrg 'standalone.cpp', 219b8e80941Smrg 'standalone.h', 220b8e80941Smrg) 221b8e80941Smrg 222b8e80941Smrglibglsl = static_library( 223b8e80941Smrg 'glsl', 224b8e80941Smrg [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h, 225b8e80941Smrg ir_expression_operation_strings_h, ir_expression_operation_constant_h, 226b8e80941Smrg float64_glsl_h], 227b8e80941Smrg c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 228b8e80941Smrg cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 229b8e80941Smrg link_with : libglcpp, 230b8e80941Smrg include_directories : [inc_common, inc_compiler, inc_nir], 231b8e80941Smrg dependencies : idep_nir, 232b8e80941Smrg build_by_default : false, 233b8e80941Smrg) 234b8e80941Smrg 235b8e80941Smrglibglsl_standalone = static_library( 236b8e80941Smrg 'glsl_standalone', 237b8e80941Smrg [files_libglsl_standalone, ir_expression_operation_h], 238b8e80941Smrg c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 239b8e80941Smrg cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 240b8e80941Smrg include_directories : [inc_common], 241b8e80941Smrg link_with : [libglsl, libglsl_util, libmesa_util], 242b8e80941Smrg dependencies : [dep_thread], 243b8e80941Smrg build_by_default : false, 244b8e80941Smrg) 245b8e80941Smrg 246b8e80941Smrgglsl_compiler = executable( 247b8e80941Smrg 'glsl_compiler', 248b8e80941Smrg 'main.cpp', 249b8e80941Smrg c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 250b8e80941Smrg cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 251b8e80941Smrg dependencies : [dep_clock, dep_thread], 252b8e80941Smrg include_directories : [inc_common], 253b8e80941Smrg link_with : [libglsl_standalone], 254b8e80941Smrg build_by_default : with_tools.contains('glsl'), 255b8e80941Smrg install : with_tools.contains('glsl'), 256b8e80941Smrg) 257b8e80941Smrg 258b8e80941Smrgglsl_test = executable( 259b8e80941Smrg 'glsl_test', 260b8e80941Smrg ['test.cpp', 'test_optpass.cpp', 'test_optpass.h', 261b8e80941Smrg ir_expression_operation_h], 262b8e80941Smrg c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args], 263b8e80941Smrg cpp_args : [cpp_vis_args, cpp_msvc_compat_args], 264b8e80941Smrg include_directories : [inc_common], 265b8e80941Smrg dependencies : [dep_clock, dep_thread], 266b8e80941Smrg link_with : [libglsl, libglsl_standalone, libglsl_util], 267b8e80941Smrg build_by_default : with_tools.contains('glsl'), 268b8e80941Smrg install : with_tools.contains('glsl'), 269b8e80941Smrg) 270b8e80941Smrg 271b8e80941Smrgif with_any_opengl and with_tests 272b8e80941Smrg subdir('tests') 273b8e80941Smrgendif 274