Home | History | Annotate | Download | only in mesa
      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       'variables': {
    105         'clang_warning_flags': [
    106           '-Wno-tautological-constant-out-of-range-compare',
    107         ],
    108         'clang_warning_flags_unset': [
    109           # Don't warn about string->bool used in asserts.
    110           '-Wstring-conversion',
    111         ],
    112       },
    113       'sources': [
    114         'src/src/mesa/program/hash_table.c',
    115         'src/src/mesa/program/symbol_table.c',
    116         'src/src/glsl/standalone_scaffolding.cpp',
    117         'src/src/glsl/main.cpp',
    118         'src/src/glsl/builtin_stubs.cpp',
    119       ],
    120     },
    121     {
    122       'target_name': 'generate_mesa_sources',
    123       'type': 'none',
    124       'dependencies': [
    125         'mesa_builtin_compiler',
    126       ],
    127       'actions': [
    128         {
    129           'action_name': 'generateBuiltins',
    130           'inputs': [
    131             '<(PRODUCT_DIR)/mesa_builtin_compiler',
    132             'src/src/glsl/builtins/tools/generate_builtins.py'
    133           ],
    134           'outputs': [
    135             '<(generated_src_dir)/mesa/builtin_function.cpp',
    136           ],
    137           'action': [
    138             'python',
    139             'redirectoutput.py',
    140             '<(generated_src_dir)/mesa/builtin_function.cpp',
    141             'src/src/glsl/builtins/tools/generate_builtins.py',
    142             '<(PRODUCT_DIR)/mesa_builtin_compiler',
    143           ],
    144           'message': "Generating Mesa builtins ...",
    145         }
    146       ],
    147     },
    148     {
    149       'target_name': 'generate_main_mesa_sources',
    150       'type': 'none',
    151       'actions': [
    152         {
    153           'action_name': 'glsl_parser_cc',
    154           'inputs': [
    155             'src/src/glsl/glsl_parser.yy',
    156           ],
    157           'outputs': [
    158             '<(generated_src_dir)/mesa/glsl_parser.cc',
    159             '<(generated_src_dir)/mesa/glsl_parser.h',
    160           ],
    161           'action': [
    162             'bison',
    163             '-y',
    164             '-v',
    165             '-o',
    166             '<(generated_src_dir)/mesa/glsl_parser.cc',
    167             '-p',
    168             '_mesa_glsl_',
    169             '--defines=<(generated_src_dir)/mesa/glsl_parser.h',
    170             'src/src/glsl/glsl_parser.yy'
    171           ],
    172           'message': "Generating glsl parser ...",
    173         },
    174         {
    175           'action_name': 'lex_yy_c',
    176           'inputs': [
    177             'src/src/mesa/program/program_lexer.l',
    178           ],
    179           'outputs': [
    180             '<(generated_src_dir)/mesa/lex.yy.c',
    181           ],
    182           'action': [
    183             'flex',
    184             '--never-interactive',
    185             '--outfile=<(generated_src_dir)/mesa/lex.yy.c',
    186             'src/src/mesa/program/program_lexer.l'
    187           ],
    188           'message': "Generating lex.yy.c ...",
    189         },
    190         {
    191           'action_name': 'glsl_lexer_cc',
    192           'inputs': [
    193             'src/src/glsl/glsl_lexer.ll',
    194           ],
    195           'outputs': [
    196             '<(generated_src_dir)/mesa/glsl_lexer.cc',
    197           ],
    198           'action': [
    199             'flex',
    200             '--nounistd',
    201             '--outfile=<(generated_src_dir)/mesa/glsl_lexer.cc',
    202             'src/src/glsl/glsl_lexer.ll',
    203           ],
    204           'message': "Generating glsl lexer ...",
    205         },
    206         {
    207           'action_name': 'glcpp_lex_c',
    208           'inputs': [
    209             'src/src/glsl/glcpp/glcpp-lex.l',
    210           ],
    211           'outputs': [
    212             '<(generated_src_dir)/mesa/glcpp-lex.c',
    213           ],
    214           'action': [
    215             'flex',
    216             '--nounistd',
    217             '--outfile=<(generated_src_dir)/mesa/glcpp-lex.c',
    218             'src/src/glsl/glcpp/glcpp-lex.l',
    219           ],
    220           'message': "Generating glcpp-lex.c ...",
    221         },
    222         {
    223           'action_name': 'glcpp_parse_c',
    224           'inputs': [
    225             'src/src/glsl/glcpp/glcpp-parse.y',
    226           ],
    227           'outputs': [
    228             '<(generated_src_dir)/mesa/glcpp-parse.c',
    229             '<(generated_src_dir)/mesa/glcpp-parse.h',
    230           ],
    231           'action': [
    232             'bison',
    233             '-y',
    234             '-v',
    235             '-d',
    236             '-p',
    237             'glcpp_parser_',
    238             '-o',
    239             '<(generated_src_dir)/mesa/glcpp-parse.c',
    240             '--defines=<(generated_src_dir)/mesa/glcpp-parse.h',
    241             'src/src/glsl/glcpp/glcpp-parse.y',
    242           ],
    243           'message': "Generating glcpp parser ...",
    244         },
    245         {
    246           'action_name': 'program_parse_tab_c',
    247           'inputs': [
    248             'src/src/mesa/program/program_parse.y',
    249           ],
    250           'outputs': [
    251             '<(generated_src_dir)/mesa/program/program_parse.tab.c',
    252           ],
    253           'action': [
    254             'bison',
    255             '-y',
    256             '-v',
    257             '-d',
    258             '-p',
    259             '_mesa_program_',
    260             '--output=<(generated_src_dir)/mesa/program/program_parse.tab.c',
    261             'src/src/mesa/program/program_parse.y',
    262           ],
    263           'message': "Generating program_parse.y ...",
    264         },
    265         {
    266           'action_name': 'glapi_mapi_tmp_h',
    267           'inputs': [
    268             '<@(xmlfiles)',
    269             'redirectoutput.py',
    270             'src/src/mapi/mapi/mapi_abi.py',
    271           ],
    272           'outputs': [
    273             '<(generated_src_dir)/mesa/glapi_mapi_tmp.h',
    274           ],
    275           'action': [
    276             'python',
    277             'redirectoutput.py',
    278             '<(generated_src_dir)/mesa/glapi_mapi_tmp.h',
    279             'src/src/mapi/mapi/mapi_abi.py',
    280             '--printer',
    281             'glapi',
    282             '--mode',
    283             'lib',
    284             'src/src/mapi/glapi/gen/gl_and_es_API.xml',
    285           ],
    286           'message': "Generating glapi_mapi_tmp.h ...",
    287         },
    288         {
    289           'action_name': 'glapi_mapi_tmp_shared_h',
    290           'inputs': [
    291             '<@(xmlfiles)',
    292             'redirectoutput.py',
    293             'src/src/mapi/mapi/mapi_abi.py',
    294           ],
    295           'outputs': [
    296             '<(generated_src_dir)/mesa/glapi_mapi_tmp_shared.h',
    297           ],
    298           'action': [
    299             'python',
    300             'redirectoutput.py',
    301             '<(generated_src_dir)/mesa/glapi_mapi_tmp_shared.h',
    302             'src/src/mapi/mapi/mapi_abi.py',
    303             '--printer',
    304             'shared-glapi',
    305             '--mode',
    306             'lib',
    307             'src/src/mapi/glapi/gen/gl_and_es_API.xml',
    308           ],
    309           'message': "Generating glapi_mapi_tmp_shared.h ...",
    310         },
    311         {
    312           'action_name': 'glprocs_h',
    313           'inputs': [
    314             '<@(xmlfiles)',
    315             'redirectoutput.py',
    316             'src/src/mapi/glapi/gen/gl_procs.py',
    317           ],
    318           'outputs': [
    319             '<(generated_src_dir)/mesa/glprocs.h',
    320           ],
    321           'action': [
    322             'python',
    323             'redirectoutput.py',
    324             '<(generated_src_dir)/mesa/glprocs.h',
    325             'src/src/mapi/glapi/gen/gl_procs.py',
    326             '-f',
    327             'src/src/mapi/glapi/gen/gl_API.xml',
    328           ],
    329           'message': "Generating glprocs.h ...",
    330         },
    331         {
    332           'action_name': 'glapitemp_h',
    333           'inputs': [
    334             '<@(xmlfiles)',
    335             'redirectoutput.py',
    336             'src/src/mapi/glapi/gen/gl_apitemp.py',
    337           ],
    338           'outputs': [
    339             '<(generated_src_dir)/mesa/glapi/glapitemp.h',
    340           ],
    341           'action': [
    342             'python',
    343             'redirectoutput.py',
    344             '<(generated_src_dir)/mesa/glapi/glapitemp.h',
    345             'src/src/mapi/glapi/gen/gl_apitemp.py',
    346             '-f',
    347             'src/src/mapi/glapi/gen/gl_API.xml',
    348           ],
    349           'message': "Generating glapitemp.h ...",
    350         },
    351         {
    352           'action_name': 'glapitable_h',
    353           'inputs': [
    354             '<@(xmlfiles)',
    355             'redirectoutput.py',
    356             'src/src/mapi/glapi/gen/gl_table.py',
    357           ],
    358           'outputs': [
    359             '<(generated_src_dir)/mesa/glapi/glapitable.h',
    360           ],
    361           'action': [
    362             'python',
    363             'redirectoutput.py',
    364             '<(generated_src_dir)/mesa/glapi/glapitable.h',
    365             'src/src/mapi/glapi/gen/gl_table.py',
    366             '-f',
    367             'src/src/mapi/glapi/gen/gl_API.xml',
    368           ],
    369           'message': "Generating glapitable.h ...",
    370         },
    371         {
    372           'action_name': 'glapi_gentable_c',
    373           'inputs': [
    374             '<@(xmlfiles)',
    375             'redirectoutput.py',
    376             'src/src/mapi/glapi/gen/gl_gentable.py',
    377           ],
    378           'outputs': [
    379             '<(generated_src_dir)/mesa/glapi_gentable.c',
    380           ],
    381           'action': [
    382             'python',
    383             'redirectoutput.py',
    384             '<(generated_src_dir)/mesa/glapi_gentable.c',
    385             'src/src/mapi/glapi/gen/gl_gentable.py',
    386             '-f',
    387             'src/src/mapi/glapi/gen/gl_API.xml',
    388           ],
    389           'message': "Generating glapi_gentable.c ...",
    390         },
    391         {
    392           'action_name': 'glapi_x86_64_S',
    393           'inputs': [
    394             '<@(xmlfiles)',
    395             'redirectoutput.py',
    396             'src/src/mapi/glapi/gen/gl_x86-64_asm.py',
    397           ],
    398           'outputs': [
    399             '<(generated_src_dir)/mesa/glapi_x86-64.S',
    400           ],
    401           'action': [
    402             'python',
    403             'redirectoutput.py',
    404             '<(generated_src_dir)/mesa/glapi_x86-64.S',
    405             'src/src/mapi/glapi/gen/gl_x86-64_asm.py',
    406             '-f',
    407             'src/src/mapi/glapi/gen/gl_API.xml',
    408           ],
    409           'message': "Generating glapi_x86-64.S ...",
    410         },
    411         {
    412           'action_name': 'enums_c',
    413           'inputs': [
    414             '<@(xmlfiles)',
    415             'redirectoutput.py',
    416             'src/src/mapi/glapi/gen/gl_enums.py',
    417           ],
    418           'outputs': [
    419             '<(generated_src_dir)/mesa/enums.c',
    420           ],
    421           'action': [
    422             'python',
    423             'redirectoutput.py',
    424             '<(generated_src_dir)/mesa/enums.c',
    425             'src/src/mapi/glapi/gen/gl_enums.py',
    426             '-f',
    427             'src/src/mapi/glapi/gen/gl_and_es_API.xml',
    428           ],
    429           'message': "Generating enums.c ...",
    430         },
    431         {
    432           'action_name': 'dispatch_h',
    433           'inputs': [
    434             '<@(xmlfiles)',
    435             'redirectoutput.py',
    436             'src/src/mapi/glapi/gen/gl_table.py',
    437           ],
    438           'outputs': [
    439             '<(generated_src_dir)/mesa/main/dispatch.h',
    440           ],
    441           'action': [
    442             'python',
    443             'redirectoutput.py',
    444             '<(generated_src_dir)/mesa/main/dispatch.h',
    445             'src/src/mapi/glapi/gen/gl_table.py',
    446             '-f',
    447             'src/src/mapi/glapi/gen/gl_API.xml',
    448             '-m',
    449             'remap_table',
    450           ],
    451           'message': "Generating dispatch.h ...",
    452         },
    453         {
    454           'action_name': 'remap_helper_h',
    455           'inputs': [
    456             '<@(xmlfiles)',
    457             'redirectoutput.py',
    458             'src/src/mapi/glapi/gen/remap_helper.py',
    459           ],
    460           'outputs': [
    461             '<(generated_src_dir)/mesa/main/remap_helper.h',
    462           ],
    463           'action': [
    464             'python',
    465             'redirectoutput.py',
    466             '<(generated_src_dir)/mesa/main/remap_helper.h',
    467             'src/src/mapi/glapi/gen/remap_helper.py',
    468             '-f',
    469             'src/src/mapi/glapi/gen/gl_API.xml',
    470           ],
    471           'message': "Generating remap_helper.h ...",
    472         },
    473         {
    474           'action_name': 'indirect_c',
    475           'inputs': [
    476             '<@(xmlfiles)',
    477             'src/src/mapi/glapi/gen/glX_proto_send.py',
    478             'redirectoutput.py',
    479           ],
    480           'outputs': [
    481             '<(generated_src_dir)/mesa/indirect.c',
    482           ],
    483           'action': [
    484             'python',
    485             'redirectoutput.py',
    486             '<(generated_src_dir)/mesa/indirect.c',
    487             'src/src/mapi/glapi/gen/glX_proto_send.py',
    488             '-f',
    489             'src/src/mapi/glapi/gen/gl_API.xml',
    490             '-m',
    491             'proto',
    492           ],
    493           'message': "Generating indirect.c ...",
    494         },
    495         {
    496           'action_name': 'indirect_h',
    497           'inputs': [
    498             '<@(xmlfiles)',
    499             'redirectoutput.py',
    500             'src/src/mapi/glapi/gen/glX_proto_send.py',
    501           ],
    502           'outputs': [
    503             '<(generated_src_dir)/mesa/indirect.h',
    504           ],
    505           'action': [
    506             'python',
    507             'redirectoutput.py',
    508             '<(generated_src_dir)/mesa/indirect.h',
    509             'src/src/mapi/glapi/gen/glX_proto_send.py',
    510             '-f',
    511             'src/src/mapi/glapi/gen/gl_API.xml',
    512             '-m',
    513             'init_h',
    514           ],
    515           'message': "Generating indirect.h ...",
    516         },
    517         {
    518           'action_name': 'indirect_init_c',
    519           'inputs': [
    520             '<@(xmlfiles)',
    521             'redirectoutput.py',
    522             'src/src/mapi/glapi/gen/glX_proto_send.py',
    523           ],
    524           'outputs': [
    525             '<(generated_src_dir)/mesa/indirect_init.c',
    526           ],
    527           'action': [
    528             'python',
    529             'redirectoutput.py',
    530             '<(generated_src_dir)/mesa/indirect_init.c',
    531             'src/src/mapi/glapi/gen/glX_proto_send.py',
    532             '-f',
    533             'src/src/mapi/glapi/gen/gl_API.xml',
    534             '-m',
    535             'init_c',
    536           ],
    537           'message': "Generating indirect_init.c ...",
    538         },
    539         {
    540           'action_name': 'indirect_size_h',
    541           'inputs': [
    542             '<@(xmlfiles)',
    543             'redirectoutput.py',
    544             'src/src/mapi/glapi/gen/glX_proto_size.py',
    545           ],
    546           'outputs': [
    547             '<(generated_src_dir)/mesa/indirect_size.h',
    548           ],
    549           'action': [
    550             'python',
    551             'redirectoutput.py',
    552             '<(generated_src_dir)/mesa/indirect_size.h',
    553             'src/src/mapi/glapi/gen/glX_proto_size.py',
    554             '-f',
    555             'src/src/mapi/glapi/gen/gl_API.xml',
    556             '-m',
    557             'size_h',
    558             '--only-set',
    559             '-h',
    560             '_INDIRECT_SIZE_H_',
    561           ],
    562           'message': "Generating indirect_size.h ...",
    563         },
    564         {
    565           'action_name': 'indirect_size_c',
    566           'inputs': [
    567             '<@(xmlfiles)',
    568             'redirectoutput.py',
    569             'src/src/mapi/glapi/gen/glX_proto_size.py',
    570           ],
    571           'outputs': [
    572             '<(generated_src_dir)/mesa/indirect_size.c',
    573           ],
    574           'action': [
    575             'python',
    576             'redirectoutput.py',
    577             '<(generated_src_dir)/mesa/indirect_size.c',
    578             'src/src/mapi/glapi/gen/glX_proto_size.py',
    579             '-f',
    580             'src/src/mapi/glapi/gen/gl_API.xml',
    581             '-m',
    582             'size_c',
    583             '--only-set',
    584           ],
    585           'message': "Generating indirect_size.c ...",
    586         },
    587         {
    588           'action_name': 'api_exec_es1_c',
    589           'inputs': [
    590             '<@(xmlfiles)',
    591             'redirectoutput.py',
    592             'src/src/mesa/main/es_generator.py',
    593           ],
    594           'outputs': [
    595             '<(generated_src_dir)/mesa/api_exec_es1.c',
    596           ],
    597           'action': [
    598             'python',
    599             'redirectoutput.py',
    600             '<(generated_src_dir)/mesa/api_exec_es1.c',
    601             'src/src/mesa/main/es_generator.py',
    602             '-S',
    603             'src/src/mesa/main/APIspec.xml',
    604             '-V',
    605             'GLES1.1',
    606           ],
    607           'message': "Generating api_exec_es1.c ...",
    608         },
    609         {
    610           'action_name': 'git_sha1_h',
    611           'inputs': [
    612           ],
    613           'outputs': [
    614             '<(generated_src_dir)/mesa/git_sha1.h',
    615           ],
    616           'action': [
    617             'python',
    618             'generate_git_sha1.py',
    619             '<(generated_src_dir)/mesa/git_sha1.h',
    620           ],
    621           'message': "Generating Mesa sources ...",
    622         },
    623       ],
    624     },
    625   ],
    626 }
    627