Home | History | Annotate | Download | only in glsl
      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 
     21 subdir('glcpp')
     22 
     23 glsl_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 
     33 glsl_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 
     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_python2, '@INPUT@', 'constant'],
     45   capture : true,
     46 )
     47 
     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_python2, '@INPUT@', 'strings'],
     53   capture : true,
     54 )
     55 
     56 files_libglsl = files(
     57   'ast.h',
     58   'ast_array_index.cpp',
     59   'ast_expr.cpp',
     60   'ast_function.cpp',
     61   'ast_to_hir.cpp',
     62   'ast_type.cpp',
     63   'builtin_functions.cpp',
     64   'builtin_functions.h',
     65   'builtin_int64.h',
     66   'builtin_types.cpp',
     67   'builtin_variables.cpp',
     68   'generate_ir.cpp',
     69   'glsl_parser_extras.cpp',
     70   'glsl_parser_extras.h',
     71   'glsl_symbol_table.cpp',
     72   'glsl_symbol_table.h',
     73   'glsl_to_nir.cpp',
     74   'glsl_to_nir.h',
     75   'hir_field_selection.cpp',
     76   'ir_array_refcount.cpp',
     77   'ir_array_refcount.h',
     78   'ir_basic_block.cpp',
     79   'ir_basic_block.h',
     80   'ir_builder.cpp',
     81   'ir_builder.h',
     82   'ir_clone.cpp',
     83   'ir_constant_expression.cpp',
     84   'ir.cpp',
     85   'ir.h',
     86   'ir_equals.cpp',
     87   'ir_expression_flattening.cpp',
     88   'ir_expression_flattening.h',
     89   'ir_function_can_inline.cpp',
     90   'ir_function_detect_recursion.cpp',
     91   'ir_function_inlining.h',
     92   'ir_function.cpp',
     93   'ir_hierarchical_visitor.cpp',
     94   'ir_hierarchical_visitor.h',
     95   'ir_hv_accept.cpp',
     96   'ir_optimization.h',
     97   'ir_print_visitor.cpp',
     98   'ir_print_visitor.h',
     99   'ir_reader.cpp',
    100   'ir_reader.h',
    101   'ir_rvalue_visitor.cpp',
    102   'ir_rvalue_visitor.h',
    103   'ir_set_program_inouts.cpp',
    104   'ir_uniform.h',
    105   'ir_validate.cpp',
    106   'ir_variable_refcount.cpp',
    107   'ir_variable_refcount.h',
    108   'ir_visitor.h',
    109   'linker.cpp',
    110   'linker.h',
    111   'link_atomics.cpp',
    112   'link_functions.cpp',
    113   'link_interface_blocks.cpp',
    114   'link_uniforms.cpp',
    115   'link_uniform_initializers.cpp',
    116   'link_uniform_block_active_visitor.cpp',
    117   'link_uniform_block_active_visitor.h',
    118   'link_uniform_blocks.cpp',
    119   'link_varyings.cpp',
    120   'link_varyings.h',
    121   'list.h',
    122   'loop_analysis.cpp',
    123   'loop_analysis.h',
    124   'loop_unroll.cpp',
    125   'lower_blend_equation_advanced.cpp',
    126   'lower_buffer_access.cpp',
    127   'lower_buffer_access.h',
    128   'lower_const_arrays_to_uniforms.cpp',
    129   'lower_cs_derived.cpp',
    130   'lower_discard.cpp',
    131   'lower_discard_flow.cpp',
    132   'lower_distance.cpp',
    133   'lower_if_to_cond_assign.cpp',
    134   'lower_instructions.cpp',
    135   'lower_int64.cpp',
    136   'lower_jumps.cpp',
    137   'lower_mat_op_to_vec.cpp',
    138   'lower_noise.cpp',
    139   'lower_offset_array.cpp',
    140   'lower_packed_varyings.cpp',
    141   'lower_named_interface_blocks.cpp',
    142   'lower_packing_builtins.cpp',
    143   'lower_subroutine.cpp',
    144   'lower_tess_level.cpp',
    145   'lower_texture_projection.cpp',
    146   'lower_variable_index_to_cond_assign.cpp',
    147   'lower_vec_index_to_cond_assign.cpp',
    148   'lower_vec_index_to_swizzle.cpp',
    149   'lower_vector.cpp',
    150   'lower_vector_derefs.cpp',
    151   'lower_vector_insert.cpp',
    152   'lower_vertex_id.cpp',
    153   'lower_output_reads.cpp',
    154   'lower_shared_reference.cpp',
    155   'lower_ubo_reference.cpp',
    156   'opt_algebraic.cpp',
    157   'opt_array_splitting.cpp',
    158   'opt_conditional_discard.cpp',
    159   'opt_constant_folding.cpp',
    160   'opt_constant_propagation.cpp',
    161   'opt_constant_variable.cpp',
    162   'opt_copy_propagation.cpp',
    163   'opt_copy_propagation_elements.cpp',
    164   'opt_dead_builtin_variables.cpp',
    165   'opt_dead_builtin_varyings.cpp',
    166   'opt_dead_code.cpp',
    167   'opt_dead_code_local.cpp',
    168   'opt_dead_functions.cpp',
    169   'opt_flatten_nested_if_blocks.cpp',
    170   'opt_flip_matrices.cpp',
    171   'opt_function_inlining.cpp',
    172   'opt_if_simplification.cpp',
    173   'opt_minmax.cpp',
    174   'opt_rebalance_tree.cpp',
    175   'opt_redundant_jumps.cpp',
    176   'opt_structure_splitting.cpp',
    177   'opt_swizzle.cpp',
    178   'opt_tree_grafting.cpp',
    179   'opt_vectorize.cpp',
    180   'program.h',
    181   'propagate_invariance.cpp',
    182   's_expression.cpp',
    183   's_expression.h',
    184   'string_to_uint_map.cpp',
    185   'string_to_uint_map.h',
    186   'serialize.cpp',
    187   'serialize.h',
    188   'shader_cache.cpp',
    189   'shader_cache.h',
    190 )
    191 
    192 files_libglsl_standalone = files(
    193   'ir_builder_print_visitor.cpp',
    194   'ir_builder_print_visitor.h',
    195   'opt_add_neg_to_sub.h',
    196   'standalone_scaffolding.cpp',
    197   'standalone_scaffolding.h',
    198   'standalone.cpp',
    199   'standalone.h',
    200 )
    201 
    202 libglsl = static_library(
    203   'glsl',
    204   [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h,
    205    ir_expression_operation_strings_h, ir_expression_operation_constant_h],
    206   c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
    207   cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
    208   link_with : libglcpp,
    209   include_directories : [inc_common, inc_compiler, inc_nir],
    210   dependencies : idep_nir,
    211   build_by_default : false,
    212 )
    213 
    214 libglsl_standalone = static_library(
    215   'glsl_standalone',
    216   [files_libglsl_standalone, ir_expression_operation_h],
    217   c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
    218   cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
    219   include_directories : [inc_common],
    220   link_with : [libglsl, libglsl_util, libmesa_util],
    221   dependencies : [dep_thread],
    222   build_by_default : false,
    223 )
    224 
    225 glsl_compiler = executable(
    226   'glsl_compiler',
    227   'main.cpp',
    228   c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
    229   cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
    230   dependencies : [dep_clock, dep_thread],
    231   include_directories : [inc_common],
    232   link_with : [libglsl_standalone],
    233   build_by_default : false,
    234 )
    235 
    236 glsl_test = executable(
    237   'glsl_test',
    238   ['test.cpp', 'test_optpass.cpp', 'test_optpass.h',
    239    ir_expression_operation_h],
    240   c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
    241   cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
    242   include_directories : [inc_common],
    243   dependencies : [dep_clock, dep_thread],
    244   link_with : [libglsl, libglsl_standalone, libglsl_util],
    245   build_by_default : false,
    246 )
    247 
    248 if with_tests
    249   subdir('tests')
    250 endif
    251