• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
23bison_command = []
24if yacc_is_bison
25  bison_command = [
26    prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '--defines=@OUTPUT1@',
27    '@INPUT@',
28  ]
29else
30  bison_command = [
31    prog_bison, '-o', '@OUTPUT0@', '-p', '_mesa_glsl_', '-H', '@OUTPUT1@',
32    '@INPUT@',
33  ]
34endif
35
36glsl_parser = custom_target(
37  'glsl_parser',
38  input : 'glsl_parser.yy',
39  output : ['glsl_parser.cpp', 'glsl_parser.h'],
40  command : bison_command
41)
42
43glsl_lexer_cpp = custom_target(
44  'glsl_lexer_cpp',
45  input : 'glsl_lexer.ll',
46  output : 'glsl_lexer.cpp',
47  command : [prog_flex_cpp, '-o', '@OUTPUT@', '@INPUT@'],
48)
49
50ir_expression_operation_constant_h = custom_target(
51  'ir_expression_operation_constant.h',
52  input : 'ir_expression_operation.py',
53  output : 'ir_expression_operation_constant.h',
54  command : [prog_python, '@INPUT@', 'constant'],
55  capture : true,
56)
57
58ir_expression_operation_strings_h = custom_target(
59  'ir_expression_operation_strings.h',
60  input : 'ir_expression_operation.py',
61  output : 'ir_expression_operation_strings.h',
62  command : [prog_python, '@INPUT@', 'strings'],
63  capture : true,
64)
65
66float64_glsl_h = custom_target(
67  'float64_glsl.h',
68  input : [files_xxd, 'float64.glsl'],
69  output : 'float64_glsl.h',
70  command : [prog_python, '@INPUT@', '@OUTPUT@', '-n', 'float64_source'],
71)
72
73files_libglsl = files(
74  'ast.h',
75  'ast_array_index.cpp',
76  'ast_expr.cpp',
77  'ast_function.cpp',
78  'ast_to_hir.cpp',
79  'ast_type.cpp',
80  'builtin_functions.cpp',
81  'builtin_functions.h',
82  'builtin_int64.h',
83  'builtin_types.cpp',
84  'builtin_variables.cpp',
85  'generate_ir.cpp',
86  'gl_nir_lower_atomics.c',
87  'gl_nir_lower_images.c',
88  'gl_nir_lower_buffers.c',
89  'gl_nir_lower_packed_varyings.c',
90  'gl_nir_lower_samplers.c',
91  'gl_nir_lower_samplers_as_deref.c',
92  'gl_nir_lower_xfb_varying.c',
93  'gl_nir_link_atomics.c',
94  'gl_nir_link_uniform_blocks.c',
95  'gl_nir_link_uniform_initializers.c',
96  'gl_nir_link_uniforms.c',
97  'gl_nir_link_varyings.c',
98  'gl_nir_link_varyings.h',
99  'gl_nir_link_xfb.c',
100  'gl_nir_linker.c',
101  'gl_nir_linker.h',
102  'gl_nir_opt_dead_builtin_varyings.c',
103  'gl_nir.h',
104  'glsl_parser_extras.cpp',
105  'glsl_parser_extras.h',
106  'glsl_symbol_table.cpp',
107  'glsl_symbol_table.h',
108  'glsl_to_nir.cpp',
109  'glsl_to_nir.h',
110  'hir_field_selection.cpp',
111  'ir_array_refcount.cpp',
112  'ir_array_refcount.h',
113  'ir_basic_block.cpp',
114  'ir_basic_block.h',
115  'ir_builder.cpp',
116  'ir_builder.h',
117  'ir_clone.cpp',
118  'ir_constant_expression.cpp',
119  'ir.cpp',
120  'ir.h',
121  'ir_equals.cpp',
122  'ir_expression_flattening.cpp',
123  'ir_expression_flattening.h',
124  'ir_function_can_inline.cpp',
125  'ir_function_detect_recursion.cpp',
126  'ir_function_inlining.h',
127  'ir_function.cpp',
128  'ir_hierarchical_visitor.cpp',
129  'ir_hierarchical_visitor.h',
130  'ir_hv_accept.cpp',
131  'ir_optimization.h',
132  'ir_print_visitor.cpp',
133  'ir_print_visitor.h',
134  'ir_reader.cpp',
135  'ir_reader.h',
136  'ir_rvalue_visitor.cpp',
137  'ir_rvalue_visitor.h',
138  'ir_set_program_inouts.cpp',
139  'ir_uniform.h',
140  'ir_validate.cpp',
141  'ir_variable_refcount.cpp',
142  'ir_variable_refcount.h',
143  'ir_visitor.h',
144  'linker.cpp',
145  'linker.h',
146  'linker_util.h',
147  'linker_util.cpp',
148  'link_functions.cpp',
149  'link_interface_blocks.cpp',
150  'link_uniforms.cpp',
151  'link_uniform_block_active_visitor.cpp',
152  'link_uniform_block_active_visitor.h',
153  'link_uniform_blocks.cpp',
154  'link_varyings.cpp',
155  'link_varyings.h',
156  'list.h',
157  'lower_blend_equation_advanced.cpp',
158  'lower_builtins.cpp',
159  'lower_cs_derived.cpp',
160  'lower_discard.cpp',
161  'lower_discard_flow.cpp',
162  'lower_distance.cpp',
163  'lower_instructions.cpp',
164  'lower_int64.cpp',
165  'lower_jumps.cpp',
166  'lower_mat_op_to_vec.cpp',
167  'lower_named_interface_blocks.cpp',
168  'lower_packing_builtins.cpp',
169  'lower_precision.cpp',
170  'lower_subroutine.cpp',
171  'lower_tess_level.cpp',
172  'lower_vec_index_to_cond_assign.cpp',
173  'lower_vec_index_to_swizzle.cpp',
174  'lower_vector_derefs.cpp',
175  'lower_vector_insert.cpp',
176  'lower_vertex_id.cpp',
177  'lower_output_reads.cpp',
178  'opt_algebraic.cpp',
179  'opt_array_splitting.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_code.cpp',
186  'opt_dead_code_local.cpp',
187  'opt_dead_functions.cpp',
188  'opt_flatten_nested_if_blocks.cpp',
189  'opt_flip_matrices.cpp',
190  'opt_function_inlining.cpp',
191  'opt_if_simplification.cpp',
192  'opt_minmax.cpp',
193  'opt_rebalance_tree.cpp',
194  'opt_structure_splitting.cpp',
195  'opt_tree_grafting.cpp',
196  'program.h',
197  'propagate_invariance.cpp',
198  's_expression.cpp',
199  's_expression.h',
200  'string_to_uint_map.cpp',
201  'string_to_uint_map.h',
202  'serialize.cpp',
203  'serialize.h',
204  'shader_cache.cpp',
205  'shader_cache.h',
206)
207
208files_libglsl_standalone = files(
209  'ir_builder_print_visitor.cpp',
210  'ir_builder_print_visitor.h',
211  'opt_add_neg_to_sub.h',
212  'standalone_scaffolding.cpp',
213  'standalone_scaffolding.h',
214  'standalone.cpp',
215  'standalone.h',
216)
217
218libglsl = static_library(
219  'glsl',
220  [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h,
221   ir_expression_operation_strings_h, ir_expression_operation_constant_h,
222   float64_glsl_h],
223  c_args : [c_msvc_compat_args, no_override_init_args],
224  cpp_args : [cpp_msvc_compat_args],
225  gnu_symbol_visibility : 'hidden',
226  link_with : libglcpp,
227  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_compiler],
228  dependencies : idep_nir,
229  build_by_default : false,
230)
231
232libglsl_standalone = static_library(
233  'glsl_standalone',
234  [files_libglsl_standalone, ir_expression_operation_h],
235  c_args : [c_msvc_compat_args, no_override_init_args],
236  cpp_args : [cpp_msvc_compat_args],
237  gnu_symbol_visibility : 'hidden',
238  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
239  link_with : [libglsl, libglsl_util, libglcpp_standalone],
240  dependencies : [idep_mesautil, idep_getopt],
241  build_by_default : false,
242)
243
244glsl_compiler = executable(
245  'glsl_compiler',
246  'main.cpp',
247  c_args : [c_msvc_compat_args, no_override_init_args],
248  cpp_args : [cpp_msvc_compat_args],
249  gnu_symbol_visibility : 'hidden',
250  dependencies : [dep_clock, dep_thread, idep_getopt, idep_mesautil],
251  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
252  link_with : [libglsl_standalone],
253  build_by_default : with_tools.contains('glsl'),
254  install : with_tools.contains('glsl'),
255)
256
257glsl_test = executable(
258  'glsl_test',
259  ['test.cpp', 'test_optpass.cpp', 'test_optpass.h',
260   ir_expression_operation_h],
261  c_args : [c_msvc_compat_args, no_override_init_args],
262  cpp_args : [cpp_msvc_compat_args],
263  gnu_symbol_visibility : 'hidden',
264  include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
265  dependencies : [dep_clock, dep_thread, idep_getopt, idep_mesautil],
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