• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5{
6  'variables': {
7    'xmlfiles': [
8      'src/src/mapi/glapi/gen/EXT_draw_buffers2.xml',
9      'src/src/mapi/glapi/gen/NV_texture_barrier.xml',
10      'src/src/mapi/glapi/gen/NV_primitive_restart.xml',
11      'src/src/mapi/glapi/gen/ARB_base_instance.xml',
12      'src/src/mapi/glapi/gen/EXT_packed_depth_stencil.xml',
13      'src/src/mapi/glapi/gen/ARB_sync.xml',
14      'src/src/mapi/glapi/gen/ARB_draw_buffers.xml',
15      'src/src/mapi/glapi/gen/ARB_geometry_shader4.xml',
16      'src/src/mapi/glapi/gen/ARB_draw_buffers_blend.xml',
17      'src/src/mapi/glapi/gen/GL3x.xml',
18      'src/src/mapi/glapi/gen/ARB_blend_func_extended.xml',
19      'src/src/mapi/glapi/gen/EXT_gpu_shader4.xml',
20      'src/src/mapi/glapi/gen/ARB_robustness.xml',
21      'src/src/mapi/glapi/gen/ARB_ES2_compatibility.xml',
22      'src/src/mapi/glapi/gen/ARB_map_buffer_range.xml',
23      'src/src/mapi/glapi/gen/OES_single_precision.xml',
24      'src/src/mapi/glapi/gen/ARB_debug_output.xml',
25      'src/src/mapi/glapi/gen/ARB_draw_instanced.xml',
26      'src/src/mapi/glapi/gen/ARB_copy_buffer.xml',
27      'src/src/mapi/glapi/gen/glX_API.xml',
28      'src/src/mapi/glapi/gen/ARB_framebuffer_object.xml',
29      'src/src/mapi/glapi/gen/OES_EGL_image.xml',
30      'src/src/mapi/glapi/gen/gl_and_es_API.xml',
31      'src/src/mapi/glapi/gen/ARB_color_buffer_float.xml',
32      'src/src/mapi/glapi/gen/ARB_instanced_arrays.xml',
33      'src/src/mapi/glapi/gen/APPLE_object_purgeable.xml',
34      'src/src/mapi/glapi/gen/APPLE_vertex_array_object.xml',
35      'src/src/mapi/glapi/gen/ARB_texture_rgb10_a2ui.xml',
36      'src/src/mapi/glapi/gen/ARB_sampler_objects.xml',
37      'src/src/mapi/glapi/gen/OES_fixed_point.xml',
38      'src/src/mapi/glapi/gen/EXT_provoking_vertex.xml',
39      'src/src/mapi/glapi/gen/ARB_texture_float.xml',
40      'src/src/mapi/glapi/gen/EXT_texture_integer.xml',
41      'src/src/mapi/glapi/gen/es_EXT.xml',
42      'src/src/mapi/glapi/gen/gl_and_glX_API.xml',
43      'src/src/mapi/glapi/gen/EXT_transform_feedback.xml',
44      'src/src/mapi/glapi/gen/ARB_texture_buffer_object.xml',
45      'src/src/mapi/glapi/gen/EXT_framebuffer_object.xml',
46      'src/src/mapi/glapi/gen/ARB_uniform_buffer_object.xml',
47      'src/src/mapi/glapi/gen/ARB_texture_rg.xml',
48      'src/src/mapi/glapi/gen/ARB_vertex_type_2_10_10_10_rev.xml',
49      'src/src/mapi/glapi/gen/ARB_seamless_cube_map.xml',
50      'src/src/mapi/glapi/gen/EXT_texture_array.xml',
51      'src/src/mapi/glapi/gen/ARB_vertex_array_object.xml',
52      'src/src/mapi/glapi/gen/ARB_invalidate_subdata.xml',
53      'src/src/mapi/glapi/gen/ARB_draw_elements_base_vertex.xml',
54      'src/src/mapi/glapi/gen/AMD_draw_buffers_blend.xml',
55      'src/src/mapi/glapi/gen/ARB_get_program_binary.xml',
56      'src/src/mapi/glapi/gen/gl_API.xml',
57      'src/src/mapi/glapi/gen/ARB_depth_clamp.xml',
58      'src/src/mapi/glapi/gen/ARB_texture_storage.xml',
59      'src/src/mapi/glapi/gen/ARB_depth_buffer_float.xml',
60      'src/src/mapi/glapi/gen/EXT_separate_shader_objects.xml',
61      'src/src/mapi/glapi/gen/ARB_texture_compression_rgtc.xml',
62      'src/src/mapi/glapi/gen/NV_conditional_render.xml',
63      'src/src/mesa/main/APIspec.xml',
64    ],
65  },
66
67  'targets': [
68    # The targets below generate all of the sources Mesa generates
69    # during its build process. Mesa's XML processors like gl_XML.py
70    # rely heavily on Python's libxml2 bindings. Specifically, the
71    # processors require validation against the DTD for default values
72    # for attributes, and none of Python's built-in XML parsers support
73    # validation. It's infeasible to use any third-party XML parser for
74    # Python which relies on native code due to the large number of
75    # host platforms Chromium must build on, and pure Python validators
76    # are in short supply.
77
78    # The main target is generate_mesa_sources, which must be run
79    # manually on a host platform with libxml2's Python bindings
80    # installed. (Most Linux distributions should fulfill this
81    # requirement.)
82    {
83      'target_name': 'mesa_builtin_compiler',
84      'type': 'executable',
85      'include_dirs': [
86        'src/src/gallium/auxiliary',
87        'src/src/gallium/include',
88        'src/src/glsl',
89        'src/src/glsl/glcpp',
90        'src/src/mapi',
91        'src/src/mapi/glapi',
92        'src/src/mesa',
93        'src/src/mesa/main',
94        '<(generated_src_dir)/mesa/',
95        '<(generated_src_dir)/mesa/main',
96        '<(generated_src_dir)/mesa/program',
97        '<(generated_src_dir)/mesa/glapi',
98      ],
99      'dependencies': [
100        'generate_main_mesa_sources',
101        'mesa_headers',
102        'mesa_libglslcommon', # implicit dependency on generate_main_mesa_sources
103      ],
104      'sources': [
105        'src/src/mesa/program/hash_table.c',
106        'src/src/mesa/program/symbol_table.c',
107        'src/src/glsl/standalone_scaffolding.cpp',
108        'src/src/glsl/main.cpp',
109        'src/src/glsl/builtin_stubs.cpp',
110      ],
111      'conditions': [
112        ['clang == 1', {
113          'xcode_settings': {
114            'WARNING_CFLAGS': [
115              '-Wno-tautological-constant-out-of-range-compare',
116            ],
117            'WARNING_CFLAGS!': [
118              # Don't warn about string->bool used in asserts.
119              '-Wstring-conversion',
120            ],
121          },
122          'cflags': [
123            '-Wtautological-constant-out-of-range-compare',
124          ],
125          'cflags!': [
126            '-Wstring-conversion',
127          ],
128        }],
129      ],
130    },
131    {
132      'target_name': 'generate_mesa_sources',
133      'type': 'none',
134      'dependencies': [
135        'mesa_builtin_compiler',
136      ],
137      'actions': [
138        {
139          'action_name': 'generateBuiltins',
140          'inputs': [
141            '<(PRODUCT_DIR)/mesa_builtin_compiler',
142            'src/src/glsl/builtins/tools/generate_builtins.py'
143          ],
144          'outputs': [
145            '<(generated_src_dir)/mesa/builtin_function.cpp',
146          ],
147          'action': [
148            'python',
149            'redirectoutput.py',
150            '<(generated_src_dir)/mesa/builtin_function.cpp',
151            'src/src/glsl/builtins/tools/generate_builtins.py',
152            '<(PRODUCT_DIR)/mesa_builtin_compiler',
153          ],
154          'message': "Generating Mesa builtins ...",
155        }
156      ],
157    },
158    {
159      'target_name': 'generate_main_mesa_sources',
160      'type': 'none',
161      'actions': [
162        {
163          'action_name': 'glsl_parser_cc',
164          'inputs': [
165            'src/src/glsl/glsl_parser.yy',
166          ],
167          'outputs': [
168            '<(generated_src_dir)/mesa/glsl_parser.cc',
169            '<(generated_src_dir)/mesa/glsl_parser.h',
170          ],
171          'action': [
172            'bison',
173            '-y',
174            '-v',
175            '-o',
176            '<(generated_src_dir)/mesa/glsl_parser.cc',
177            '-p',
178            '_mesa_glsl_',
179            '--defines=<(generated_src_dir)/mesa/glsl_parser.h',
180            'src/src/glsl/glsl_parser.yy'
181          ],
182          'message': "Generating glsl parser ...",
183        },
184        {
185          'action_name': 'lex_yy_c',
186          'inputs': [
187            'src/src/mesa/program/program_lexer.l',
188          ],
189          'outputs': [
190            '<(generated_src_dir)/mesa/lex.yy.c',
191          ],
192          'action': [
193            'flex',
194            '--never-interactive',
195            '--outfile=<(generated_src_dir)/mesa/lex.yy.c',
196            'src/src/mesa/program/program_lexer.l'
197          ],
198          'message': "Generating lex.yy.c ...",
199        },
200        {
201          'action_name': 'glsl_lexer_cc',
202          'inputs': [
203            'src/src/glsl/glsl_lexer.ll',
204          ],
205          'outputs': [
206            '<(generated_src_dir)/mesa/glsl_lexer.cc',
207          ],
208          'action': [
209            'flex',
210            '--nounistd',
211            '--outfile=<(generated_src_dir)/mesa/glsl_lexer.cc',
212            'src/src/glsl/glsl_lexer.ll',
213          ],
214          'message': "Generating glsl lexer ...",
215        },
216        {
217          'action_name': 'glcpp_lex_c',
218          'inputs': [
219            'src/src/glsl/glcpp/glcpp-lex.l',
220          ],
221          'outputs': [
222            '<(generated_src_dir)/mesa/glcpp-lex.c',
223          ],
224          'action': [
225            'flex',
226            '--nounistd',
227            '--outfile=<(generated_src_dir)/mesa/glcpp-lex.c',
228            'src/src/glsl/glcpp/glcpp-lex.l',
229          ],
230          'message': "Generating glcpp-lex.c ...",
231        },
232        {
233          'action_name': 'glcpp_parse_c',
234          'inputs': [
235            'src/src/glsl/glcpp/glcpp-parse.y',
236          ],
237          'outputs': [
238            '<(generated_src_dir)/mesa/glcpp-parse.c',
239            '<(generated_src_dir)/mesa/glcpp-parse.h',
240          ],
241          'action': [
242            'bison',
243            '-y',
244            '-v',
245            '-d',
246            '-p',
247            'glcpp_parser_',
248            '-o',
249            '<(generated_src_dir)/mesa/glcpp-parse.c',
250            '--defines=<(generated_src_dir)/mesa/glcpp-parse.h',
251            'src/src/glsl/glcpp/glcpp-parse.y',
252          ],
253          'message': "Generating glcpp parser ...",
254        },
255        {
256          'action_name': 'program_parse_tab_c',
257          'inputs': [
258            'src/src/mesa/program/program_parse.y',
259          ],
260          'outputs': [
261            '<(generated_src_dir)/mesa/program/program_parse.tab.c',
262          ],
263          'action': [
264            'bison',
265            '-y',
266            '-v',
267            '-d',
268            '-p',
269            '_mesa_program_',
270            '--output=<(generated_src_dir)/mesa/program/program_parse.tab.c',
271            'src/src/mesa/program/program_parse.y',
272          ],
273          'message': "Generating program_parse.y ...",
274        },
275        {
276          'action_name': 'glapi_mapi_tmp_h',
277          'inputs': [
278            '<@(xmlfiles)',
279            'redirectoutput.py',
280            'src/src/mapi/mapi/mapi_abi.py',
281          ],
282          'outputs': [
283            '<(generated_src_dir)/mesa/glapi_mapi_tmp.h',
284          ],
285          'action': [
286            'python',
287            'redirectoutput.py',
288            '<(generated_src_dir)/mesa/glapi_mapi_tmp.h',
289            'src/src/mapi/mapi/mapi_abi.py',
290            '--printer',
291            'glapi',
292            '--mode',
293            'lib',
294            'src/src/mapi/glapi/gen/gl_and_es_API.xml',
295          ],
296          'message': "Generating glapi_mapi_tmp.h ...",
297        },
298        {
299          'action_name': 'glapi_mapi_tmp_shared_h',
300          'inputs': [
301            '<@(xmlfiles)',
302            'redirectoutput.py',
303            'src/src/mapi/mapi/mapi_abi.py',
304          ],
305          'outputs': [
306            '<(generated_src_dir)/mesa/glapi_mapi_tmp_shared.h',
307          ],
308          'action': [
309            'python',
310            'redirectoutput.py',
311            '<(generated_src_dir)/mesa/glapi_mapi_tmp_shared.h',
312            'src/src/mapi/mapi/mapi_abi.py',
313            '--printer',
314            'shared-glapi',
315            '--mode',
316            'lib',
317            'src/src/mapi/glapi/gen/gl_and_es_API.xml',
318          ],
319          'message': "Generating glapi_mapi_tmp_shared.h ...",
320        },
321        {
322          'action_name': 'glprocs_h',
323          'inputs': [
324            '<@(xmlfiles)',
325            'redirectoutput.py',
326            'src/src/mapi/glapi/gen/gl_procs.py',
327          ],
328          'outputs': [
329            '<(generated_src_dir)/mesa/glprocs.h',
330          ],
331          'action': [
332            'python',
333            'redirectoutput.py',
334            '<(generated_src_dir)/mesa/glprocs.h',
335            'src/src/mapi/glapi/gen/gl_procs.py',
336            '-f',
337            'src/src/mapi/glapi/gen/gl_API.xml',
338          ],
339          'message': "Generating glprocs.h ...",
340        },
341        {
342          'action_name': 'glapitemp_h',
343          'inputs': [
344            '<@(xmlfiles)',
345            'redirectoutput.py',
346            'src/src/mapi/glapi/gen/gl_apitemp.py',
347          ],
348          'outputs': [
349            '<(generated_src_dir)/mesa/glapi/glapitemp.h',
350          ],
351          'action': [
352            'python',
353            'redirectoutput.py',
354            '<(generated_src_dir)/mesa/glapi/glapitemp.h',
355            'src/src/mapi/glapi/gen/gl_apitemp.py',
356            '-f',
357            'src/src/mapi/glapi/gen/gl_API.xml',
358          ],
359          'message': "Generating glapitemp.h ...",
360        },
361        {
362          'action_name': 'glapitable_h',
363          'inputs': [
364            '<@(xmlfiles)',
365            'redirectoutput.py',
366            'src/src/mapi/glapi/gen/gl_table.py',
367          ],
368          'outputs': [
369            '<(generated_src_dir)/mesa/glapi/glapitable.h',
370          ],
371          'action': [
372            'python',
373            'redirectoutput.py',
374            '<(generated_src_dir)/mesa/glapi/glapitable.h',
375            'src/src/mapi/glapi/gen/gl_table.py',
376            '-f',
377            'src/src/mapi/glapi/gen/gl_API.xml',
378          ],
379          'message': "Generating glapitable.h ...",
380        },
381        {
382          'action_name': 'glapi_gentable_c',
383          'inputs': [
384            '<@(xmlfiles)',
385            'redirectoutput.py',
386            'src/src/mapi/glapi/gen/gl_gentable.py',
387          ],
388          'outputs': [
389            '<(generated_src_dir)/mesa/glapi_gentable.c',
390          ],
391          'action': [
392            'python',
393            'redirectoutput.py',
394            '<(generated_src_dir)/mesa/glapi_gentable.c',
395            'src/src/mapi/glapi/gen/gl_gentable.py',
396            '-f',
397            'src/src/mapi/glapi/gen/gl_API.xml',
398          ],
399          'message': "Generating glapi_gentable.c ...",
400        },
401        {
402          'action_name': 'glapi_x86_64_S',
403          'inputs': [
404            '<@(xmlfiles)',
405            'redirectoutput.py',
406            'src/src/mapi/glapi/gen/gl_x86-64_asm.py',
407          ],
408          'outputs': [
409            '<(generated_src_dir)/mesa/glapi_x86-64.S',
410          ],
411          'action': [
412            'python',
413            'redirectoutput.py',
414            '<(generated_src_dir)/mesa/glapi_x86-64.S',
415            'src/src/mapi/glapi/gen/gl_x86-64_asm.py',
416            '-f',
417            'src/src/mapi/glapi/gen/gl_API.xml',
418          ],
419          'message': "Generating glapi_x86-64.S ...",
420        },
421        {
422          'action_name': 'enums_c',
423          'inputs': [
424            '<@(xmlfiles)',
425            'redirectoutput.py',
426            'src/src/mapi/glapi/gen/gl_enums.py',
427          ],
428          'outputs': [
429            '<(generated_src_dir)/mesa/enums.c',
430          ],
431          'action': [
432            'python',
433            'redirectoutput.py',
434            '<(generated_src_dir)/mesa/enums.c',
435            'src/src/mapi/glapi/gen/gl_enums.py',
436            '-f',
437            'src/src/mapi/glapi/gen/gl_and_es_API.xml',
438          ],
439          'message': "Generating enums.c ...",
440        },
441        {
442          'action_name': 'dispatch_h',
443          'inputs': [
444            '<@(xmlfiles)',
445            'redirectoutput.py',
446            'src/src/mapi/glapi/gen/gl_table.py',
447          ],
448          'outputs': [
449            '<(generated_src_dir)/mesa/main/dispatch.h',
450          ],
451          'action': [
452            'python',
453            'redirectoutput.py',
454            '<(generated_src_dir)/mesa/main/dispatch.h',
455            'src/src/mapi/glapi/gen/gl_table.py',
456            '-f',
457            'src/src/mapi/glapi/gen/gl_API.xml',
458            '-m',
459            'remap_table',
460          ],
461          'message': "Generating dispatch.h ...",
462        },
463        {
464          'action_name': 'remap_helper_h',
465          'inputs': [
466            '<@(xmlfiles)',
467            'redirectoutput.py',
468            'src/src/mapi/glapi/gen/remap_helper.py',
469          ],
470          'outputs': [
471            '<(generated_src_dir)/mesa/main/remap_helper.h',
472          ],
473          'action': [
474            'python',
475            'redirectoutput.py',
476            '<(generated_src_dir)/mesa/main/remap_helper.h',
477            'src/src/mapi/glapi/gen/remap_helper.py',
478            '-f',
479            'src/src/mapi/glapi/gen/gl_API.xml',
480          ],
481          'message': "Generating remap_helper.h ...",
482        },
483        {
484          'action_name': 'indirect_c',
485          'inputs': [
486            '<@(xmlfiles)',
487            'src/src/mapi/glapi/gen/glX_proto_send.py',
488            'redirectoutput.py',
489          ],
490          'outputs': [
491            '<(generated_src_dir)/mesa/indirect.c',
492          ],
493          'action': [
494            'python',
495            'redirectoutput.py',
496            '<(generated_src_dir)/mesa/indirect.c',
497            'src/src/mapi/glapi/gen/glX_proto_send.py',
498            '-f',
499            'src/src/mapi/glapi/gen/gl_API.xml',
500            '-m',
501            'proto',
502          ],
503          'message': "Generating indirect.c ...",
504        },
505        {
506          'action_name': 'indirect_h',
507          'inputs': [
508            '<@(xmlfiles)',
509            'redirectoutput.py',
510            'src/src/mapi/glapi/gen/glX_proto_send.py',
511          ],
512          'outputs': [
513            '<(generated_src_dir)/mesa/indirect.h',
514          ],
515          'action': [
516            'python',
517            'redirectoutput.py',
518            '<(generated_src_dir)/mesa/indirect.h',
519            'src/src/mapi/glapi/gen/glX_proto_send.py',
520            '-f',
521            'src/src/mapi/glapi/gen/gl_API.xml',
522            '-m',
523            'init_h',
524          ],
525          'message': "Generating indirect.h ...",
526        },
527        {
528          'action_name': 'indirect_init_c',
529          'inputs': [
530            '<@(xmlfiles)',
531            'redirectoutput.py',
532            'src/src/mapi/glapi/gen/glX_proto_send.py',
533          ],
534          'outputs': [
535            '<(generated_src_dir)/mesa/indirect_init.c',
536          ],
537          'action': [
538            'python',
539            'redirectoutput.py',
540            '<(generated_src_dir)/mesa/indirect_init.c',
541            'src/src/mapi/glapi/gen/glX_proto_send.py',
542            '-f',
543            'src/src/mapi/glapi/gen/gl_API.xml',
544            '-m',
545            'init_c',
546          ],
547          'message': "Generating indirect_init.c ...",
548        },
549        {
550          'action_name': 'indirect_size_h',
551          'inputs': [
552            '<@(xmlfiles)',
553            'redirectoutput.py',
554            'src/src/mapi/glapi/gen/glX_proto_size.py',
555          ],
556          'outputs': [
557            '<(generated_src_dir)/mesa/indirect_size.h',
558          ],
559          'action': [
560            'python',
561            'redirectoutput.py',
562            '<(generated_src_dir)/mesa/indirect_size.h',
563            'src/src/mapi/glapi/gen/glX_proto_size.py',
564            '-f',
565            'src/src/mapi/glapi/gen/gl_API.xml',
566            '-m',
567            'size_h',
568            '--only-set',
569            '-h',
570            '_INDIRECT_SIZE_H_',
571          ],
572          'message': "Generating indirect_size.h ...",
573        },
574        {
575          'action_name': 'indirect_size_c',
576          'inputs': [
577            '<@(xmlfiles)',
578            'redirectoutput.py',
579            'src/src/mapi/glapi/gen/glX_proto_size.py',
580          ],
581          'outputs': [
582            '<(generated_src_dir)/mesa/indirect_size.c',
583          ],
584          'action': [
585            'python',
586            'redirectoutput.py',
587            '<(generated_src_dir)/mesa/indirect_size.c',
588            'src/src/mapi/glapi/gen/glX_proto_size.py',
589            '-f',
590            'src/src/mapi/glapi/gen/gl_API.xml',
591            '-m',
592            'size_c',
593            '--only-set',
594          ],
595          'message': "Generating indirect_size.c ...",
596        },
597        {
598          'action_name': 'api_exec_es1_c',
599          'inputs': [
600            '<@(xmlfiles)',
601            'redirectoutput.py',
602            'src/src/mesa/main/es_generator.py',
603          ],
604          'outputs': [
605            '<(generated_src_dir)/mesa/api_exec_es1.c',
606          ],
607          'action': [
608            'python',
609            'redirectoutput.py',
610            '<(generated_src_dir)/mesa/api_exec_es1.c',
611            'src/src/mesa/main/es_generator.py',
612            '-S',
613            'src/src/mesa/main/APIspec.xml',
614            '-V',
615            'GLES1.1',
616          ],
617          'message': "Generating api_exec_es1.c ...",
618        },
619        {
620          'action_name': 'git_sha1_h',
621          'inputs': [
622          ],
623          'outputs': [
624            '<(generated_src_dir)/mesa/git_sha1.h',
625          ],
626          'action': [
627            'python',
628            'generate_git_sha1.py',
629            '<(generated_src_dir)/mesa/git_sha1.h',
630          ],
631          'message': "Generating Mesa sources ...",
632        },
633      ],
634    },
635  ],
636}
637