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