Home | History | Annotate | Download | only in gl
      1 # Copyright (c) 2012 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     'chromium_code': 1,
      8   },
      9 
     10   'targets': [
     11     {
     12       'target_name': 'gl',
     13       'type': '<(component)',
     14       'product_name': 'gl_wrapper',  # Avoid colliding with OS X's libGL.dylib
     15       'dependencies': [
     16         '<(DEPTH)/base/base.gyp:base',
     17         '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
     18         '<(DEPTH)/gpu/command_buffer/command_buffer.gyp:gles2_utils',
     19         '<(DEPTH)/skia/skia.gyp:skia',
     20         '<(DEPTH)/third_party/mesa/mesa.gyp:mesa_headers',
     21         '<(DEPTH)/ui/ui.gyp:ui',
     22       ],
     23       'variables': {
     24         'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gl',
     25       },
     26       'defines': [
     27         'GL_IMPLEMENTATION',
     28       ],
     29       'include_dirs': [
     30         '<(DEPTH)/third_party/swiftshader/include',
     31         '<(DEPTH)/third_party/mesa/src/include',
     32         '<(gl_binding_output_dir)',
     33       ],
     34       'direct_dependent_settings': {
     35         'include_dirs': [
     36           '<(gl_binding_output_dir)',
     37         ],
     38       },
     39       'export_dependent_settings': [
     40         '<(DEPTH)/third_party/mesa/mesa.gyp:mesa_headers',
     41       ],
     42      'sources': [
     43         'android/gl_jni_registrar.cc',
     44         'android/gl_jni_registrar.h',
     45         'android/scoped_java_surface.cc',
     46         'android/scoped_java_surface.h',
     47         'android/surface_texture_bridge.cc',
     48         'android/surface_texture_bridge.h',
     49         'android/surface_texture_listener.cc',
     50         'android/surface_texture_listener.h',
     51         'gl_bindings.h',
     52         'gl_bindings_skia_in_process.cc',
     53         'gl_bindings_skia_in_process.h',
     54         'gl_context.cc',
     55         'gl_context.h',
     56         'gl_context_android.cc',
     57         'gl_context_mac.mm',
     58         'gl_context_ozone.cc',
     59         'gl_context_osmesa.cc',
     60         'gl_context_osmesa.h',
     61         'gl_context_stub.cc',
     62         'gl_context_stub.h',
     63         'gl_context_win.cc',
     64         'gl_context_x11.cc',
     65         'gl_export.h',
     66         'gl_fence.cc',
     67         'gl_fence.h',
     68         'gl_gl_api_implementation.cc',
     69         'gl_gl_api_implementation.h',
     70         'gl_image.cc',
     71         'gl_image.h',
     72         'gl_image_android.cc',
     73         'gl_image_mac.cc',
     74         'gl_image_ozone.cc',
     75         'gl_image_shm.cc',
     76         'gl_image_shm.h',
     77         'gl_image_stub.cc',
     78         'gl_image_stub.h',
     79         'gl_image_win.cc',
     80         'gl_image_x11.cc',
     81         'gl_implementation.cc',
     82         'gl_implementation.h',
     83         'gl_implementation_android.cc',
     84         'gl_implementation_linux.cc',
     85         'gl_implementation_linux.h',
     86         'gl_implementation_ozone.cc',
     87         'gl_implementation_mac.cc',
     88         'gl_implementation_win.cc',
     89         'gl_implementation_x11.cc',
     90         'gl_interface.cc',
     91         'gl_interface.h',
     92         'gl_osmesa_api_implementation.cc',
     93         'gl_osmesa_api_implementation.h',
     94         'gl_share_group.cc',
     95         'gl_share_group.h',
     96         'gl_state_restorer.cc',
     97         'gl_state_restorer.h',
     98         'gl_surface.cc',
     99         'gl_surface.h',
    100         'gl_surface_mac.cc',
    101         'gl_surface_stub.cc',
    102         'gl_surface_stub.h',
    103         'gl_surface_win.cc',
    104         'gl_surface_x11.cc',
    105         'gl_surface_osmesa.cc',
    106         'gl_surface_osmesa.h',
    107         'gl_switches.cc',
    108         'gl_switches.h',
    109         'gpu_switching_manager.cc',
    110         'gpu_switching_manager.h',
    111         'io_surface_support_mac.cc',
    112         'io_surface_support_mac.h',
    113         'scoped_binders.cc',
    114         'scoped_binders.h',
    115         'scoped_make_current.cc',
    116         'scoped_make_current.h',
    117         'vsync_provider.cc',
    118         'vsync_provider.h',
    119         '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc',
    120         '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h',
    121         '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc',
    122         '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc',
    123         '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h',
    124         '<(gl_binding_output_dir)/gl_interface_autogen_gl.h',
    125       ],
    126       # hard_dependency is necessary for this target because it has actions
    127       # that generate header files included by dependent targets. The header
    128       # files must be generated before the dependents are compiled. The usual
    129       # semantics are to allow the two targets to build concurrently.
    130       'hard_dependency': 1,
    131       'actions': [
    132         {
    133           'action_name': 'generate_gl_bindings',
    134           'variables': {
    135             'generator_path': 'generate_bindings.py',
    136             'header_paths': '../../third_party/mesa/src/include:../../third_party/khronos',
    137           },
    138           'inputs': [
    139             '<(generator_path)',
    140             '<!@(python <(generator_path) --header-paths=<(header_paths) --inputs)',
    141           ],
    142           'outputs': [
    143             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc',
    144             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h',
    145             '<(gl_binding_output_dir)/gl_bindings_api_autogen_egl.h',
    146             '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc',
    147             '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h',
    148             '<(gl_binding_output_dir)/gl_bindings_api_autogen_gl.h',
    149             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc',
    150             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h',
    151             '<(gl_binding_output_dir)/gl_bindings_api_autogen_glx.h',
    152             '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc',
    153             '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc',
    154             '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h',
    155             '<(gl_binding_output_dir)/gl_bindings_api_autogen_osmesa.h',
    156             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc',
    157             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h',
    158             '<(gl_binding_output_dir)/gl_bindings_api_autogen_wgl.h',
    159             '<(gl_binding_output_dir)/gl_interface_autogen_egl.h',
    160             '<(gl_binding_output_dir)/gl_interface_autogen_gl.h',
    161             '<(gl_binding_output_dir)/gl_interface_autogen_glx.h',
    162             '<(gl_binding_output_dir)/gl_interface_autogen_osmesa.h',
    163             '<(gl_binding_output_dir)/gl_interface_autogen_wgl.h',
    164             '<(gl_binding_output_dir)/gl_mock_autogen_egl.h',
    165             '<(gl_binding_output_dir)/gl_mock_autogen_gl.h',
    166             '<(gl_binding_output_dir)/gl_mock_autogen_glx.h',
    167             '<(gl_binding_output_dir)/gl_mock_autogen_osmesa.h',
    168             '<(gl_binding_output_dir)/gl_mock_autogen_wgl.h',
    169           ],
    170           'action': [
    171             'python',
    172             '<(generator_path)',
    173             '--header-paths=<(header_paths)',
    174             '<(gl_binding_output_dir)',
    175           ],
    176         },
    177       ],
    178       'conditions': [
    179         ['OS in ("win", "android", "linux")', {
    180           'sources': [
    181             'egl_util.cc',
    182             'egl_util.h',
    183             'gl_context_egl.cc',
    184             'gl_context_egl.h',
    185             'gl_surface_egl.cc',
    186             'gl_surface_egl.h',
    187             'gl_egl_api_implementation.cc',
    188             'gl_egl_api_implementation.h',
    189             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc',
    190             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h',
    191           ],
    192           'include_dirs': [
    193             '<(DEPTH)/third_party/khronos',
    194         ],
    195         }],
    196         ['use_x11 == 1', {
    197           'sources': [
    198             'gl_context_glx.cc',
    199             'gl_context_glx.h',
    200             'gl_glx_api_implementation.cc',
    201             'gl_glx_api_implementation.h',
    202             'gl_image_glx.cc',
    203             'gl_image_glx.h',
    204             'gl_surface_glx.cc',
    205             'gl_surface_glx.h',
    206             'gl_egl_api_implementation.cc',
    207             'gl_egl_api_implementation.h',
    208             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc',
    209             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h',
    210           ],
    211           'all_dependent_settings': {
    212             'defines': [
    213               'GL_GLEXT_PROTOTYPES',
    214             ],
    215           },
    216           'link_settings': {
    217             'libraries': [
    218               '-lX11',
    219               '-lXcomposite',
    220             ],
    221           },
    222         }],
    223         ['OS=="win"', {
    224           'sources': [
    225             'gl_context_wgl.cc',
    226             'gl_context_wgl.h',
    227             'gl_egl_api_implementation.cc',
    228             'gl_egl_api_implementation.h',
    229             'gl_surface_wgl.cc',
    230             'gl_surface_wgl.h',
    231             'gl_wgl_api_implementation.cc',
    232             'gl_wgl_api_implementation.h',
    233             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc',
    234             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h',
    235           ],
    236         }],
    237         ['OS=="mac"', {
    238           'sources': [
    239             'gl_context_cgl.cc',
    240             'gl_context_cgl.h',
    241             'gl_surface_cgl.cc',
    242             'gl_surface_cgl.h',
    243           ],
    244           'link_settings': {
    245             'libraries': [
    246               '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
    247             ],
    248           },
    249         }],
    250         ['OS=="mac" and use_aura == 1', {
    251           'sources': [
    252             'gl_context_nsview.mm',
    253             'gl_context_nsview.h',
    254             'gl_surface_nsview.mm',
    255             'gl_surface_nsview.h',
    256           ],
    257         }],
    258         ['OS=="android"', {
    259           'dependencies': [
    260             'gl_jni_headers',
    261           ],
    262           'sources': [
    263             'gl_image_egl.cc',
    264             'gl_image_egl.h',
    265           ],
    266           'link_settings': {
    267             'libraries': [
    268               '-landroid',
    269             ],
    270           },
    271           'sources!': [
    272             'gl_context_osmesa.cc',
    273             'system_monitor_posix.cc',
    274           ],
    275           'defines': [
    276             'GL_GLEXT_PROTOTYPES',
    277             'EGL_EGLEXT_PROTOTYPES',
    278           ],
    279         }],
    280         ['OS!="android"', {
    281           'sources/': [ ['exclude', '^android/'] ],
    282         }],
    283       ],
    284     },
    285     {
    286       'target_name': 'gl_unittest_utils',
    287       'type': 'static_library',
    288       'variables': {
    289         'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gl',
    290       },
    291       'dependencies': [
    292         '../../testing/gmock.gyp:gmock',
    293         '../../third_party/khronos/khronos.gyp:khronos_headers',
    294         'gl',
    295       ],
    296       'include_dirs': [
    297         '<(gl_binding_output_dir)',
    298         '../..',
    299       ],
    300       'direct_dependent_settings': {
    301         'include_dirs': [
    302           '<(gl_binding_output_dir)',
    303         ],
    304       },
    305       'sources': [
    306         'gl_mock.h',
    307         'gl_mock.cc',
    308         '<(gl_binding_output_dir)/gl_mock_autogen_gl.h',
    309       ],
    310     },
    311   ],
    312   'conditions': [
    313     ['OS=="android"' , {
    314       'targets': [
    315         {
    316           'target_name': 'surface_jni_headers',
    317           'type': 'none',
    318           'variables': {
    319             'jni_gen_package': 'ui/gl',
    320             'input_java_class': 'android/view/Surface.class',
    321           },
    322           'includes': [ '../../build/jar_file_jni_generator.gypi' ],
    323         },
    324         {
    325           'target_name': 'gl_jni_headers',
    326           'type': 'none',
    327           'dependencies': [
    328             'surface_jni_headers',
    329           ],
    330           'sources': [
    331             '../android/java/src/org/chromium/ui/gfx/SurfaceTextureBridge.java',
    332             '../android/java/src/org/chromium/ui/gfx/SurfaceTextureListener.java',
    333           ],
    334           'variables': {
    335             'jni_gen_package': 'ui/gl',
    336           },
    337           'includes': [ '../../build/jni_generator.gypi' ],
    338         },
    339       ],
    340     }],
    341   ],
    342 }
    343