Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / ui / gl / gl.gyp
blobb67a60a1108ed8f13b272214364168b92834ede4
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.
6   'variables': {
7     'chromium_code': 1,
8   },
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/MesaLib/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         'async_pixel_transfer_delegate.h',
44         'async_pixel_transfer_delegate_idle.cc',
45         'async_pixel_transfer_delegate_idle.h',
46         'async_pixel_transfer_delegate_stub.cc',
47         'async_pixel_transfer_delegate_stub.h',
48         'gl_bindings.h',
49         'gl_bindings_skia_in_process.cc',
50         'gl_bindings_skia_in_process.h',
51         'gl_context.cc',
52         'gl_context.h',
53         'gl_context_android.cc',
54         'gl_context_linux.cc',
55         'gl_context_mac.mm',
56         'gl_context_osmesa.cc',
57         'gl_context_osmesa.h',
58         'gl_context_stub.cc',
59         'gl_context_stub.h',
60         'gl_context_win.cc',
61         'gl_export.h',
62         'gl_fence.cc',
63         'gl_fence.h',
64         'gl_gl_api_implementation.cc',
65         'gl_gl_api_implementation.h',
66         'gl_image.cc',
67         'gl_image.h',
68         'gl_image_android.cc',
69         'gl_image_linux.cc',
70         'gl_image_mac.cc',
71         'gl_image_stub.cc',
72         'gl_image_stub.h',
73         'gl_image_win.cc',
74         'gl_implementation.cc',
75         'gl_implementation.h',
76         'gl_implementation_android.cc',
77         'gl_implementation_linux.cc',
78         'gl_implementation_mac.cc',
79         'gl_implementation_win.cc',
80         'gl_interface.cc',
81         'gl_interface.h',
82         'gl_osmesa_api_implementation.cc',
83         'gl_osmesa_api_implementation.h',
84         'gl_share_group.cc',
85         'gl_share_group.h',
86         'gl_state_restorer.cc',
87         'gl_state_restorer.h',
88         'gl_surface.cc',
89         'gl_surface.h',
90         'gl_surface_android.cc',
91         'gl_surface_linux.cc',
92         'gl_surface_mac.cc',
93         'gl_surface_stub.cc',
94         'gl_surface_stub.h',
95         'gl_surface_win.cc',
96         'gl_surface_osmesa.cc',
97         'gl_surface_osmesa.h',
98         'gl_switches.cc',
99         'gl_switches.h',
100         'gpu_memory_buffer.h',
101         'gpu_switching_manager.cc',
102         'gpu_switching_manager.h',
103         'safe_shared_memory_pool.h',
104         'safe_shared_memory_pool.cc',
105         'scoped_make_current.cc',
106         'scoped_make_current.h',
107         'gl_state_restorer.cc',
108         'gl_state_restorer.h',
109         'vsync_provider.cc',
110         'vsync_provider.h',
111         '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc',
112         '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h',
113         '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc',
114         '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc',
115         '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h',
116         '<(gl_binding_output_dir)/gl_interface_autogen_gl.h',
117       ],
118       # hard_dependency is necessary for this target because it has actions
119       # that generate header files included by dependent targets. The header
120       # files must be generated before the dependents are compiled. The usual
121       # semantics are to allow the two targets to build concurrently.
122       'hard_dependency': 1,
123       'actions': [
124         {
125           'action_name': 'generate_gl_bindings',
126           'variables': {
127             'generator_path': 'generate_bindings.py',
128             'conditions': [
129               ['use_system_mesa==0', {
130                 'header_paths': '../../third_party/mesa/MesaLib/include:../../third_party/khronos',
131               }, { # use_system_mesa==1
132                 'header_paths': '/usr/include',
133               }],
134             ],
135           },
136           'inputs': [
137             '<(generator_path)',
138             '<!@(python <(generator_path) --header-paths=<(header_paths) --inputs)',
139           ],
140           'outputs': [
141             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc',
142             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h',
143             '<(gl_binding_output_dir)/gl_bindings_api_autogen_egl.h',
144             '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc',
145             '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h',
146             '<(gl_binding_output_dir)/gl_bindings_api_autogen_gl.h',
147             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc',
148             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h',
149             '<(gl_binding_output_dir)/gl_bindings_api_autogen_glx.h',
150             '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc',
151             '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc',
152             '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h',
153             '<(gl_binding_output_dir)/gl_bindings_api_autogen_osmesa.h',
154             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc',
155             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h',
156             '<(gl_binding_output_dir)/gl_bindings_api_autogen_wgl.h',
157             '<(gl_binding_output_dir)/gl_interface_autogen_egl.h',
158             '<(gl_binding_output_dir)/gl_interface_autogen_gl.h',
159             '<(gl_binding_output_dir)/gl_interface_autogen_glx.h',
160             '<(gl_binding_output_dir)/gl_interface_autogen_osmesa.h',
161             '<(gl_binding_output_dir)/gl_interface_autogen_wgl.h',
162             '<(gl_binding_output_dir)/gl_mock_autogen_egl.h',
163             '<(gl_binding_output_dir)/gl_mock_autogen_gl.h',
164             '<(gl_binding_output_dir)/gl_mock_autogen_glx.h',
165             '<(gl_binding_output_dir)/gl_mock_autogen_osmesa.h',
166             '<(gl_binding_output_dir)/gl_mock_autogen_wgl.h',
167           ],
168           'action': [
169             'python',
170             '<(generator_path)',
171             '--header-paths=<(header_paths)',
172             '<(gl_binding_output_dir)',
173           ],
174         },
175       ],
176       'conditions': [
177         ['OS != "mac"', {
178           'sources': [
179             'egl_util.cc',
180             'egl_util.h',
181             'gl_context_egl.cc',
182             'gl_context_egl.h',
183             'gl_surface_egl.cc',
184             'gl_surface_egl.h',
185             'gl_egl_api_implementation.cc',
186             'gl_egl_api_implementation.h',
187             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc',
188             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h',
189           ],
190           'include_dirs': [
191             '<(DEPTH)/third_party/angle/include',
192           ],
193         }],
194         ['use_x11 == 1', {
195           'sources': [
196             'gl_context_glx.cc',
197             'gl_context_glx.h',
198             'gl_glx_api_implementation.cc',
199             'gl_glx_api_implementation.h',
200             'gl_image_glx.cc',
201             'gl_image_glx.h',
202             'gl_surface_glx.cc',
203             'gl_surface_glx.h',
204             'gl_egl_api_implementation.cc',
205             'gl_egl_api_implementation.h',
206             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc',
207             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h',
208           ],
209           'all_dependent_settings': {
210             'defines': [
211               'GL_GLEXT_PROTOTYPES',
212             ],
213           },
214           'link_settings': {
215             'libraries': [
216               '-lX11',
217               '-lXcomposite',
218             ],
219           },
220         }],
221         ['OS=="win"', {
222           'sources': [
223             'gl_context_wgl.cc',
224             'gl_context_wgl.h',
225             'gl_egl_api_implementation.cc',
226             'gl_egl_api_implementation.h',
227             'gl_surface_wgl.cc',
228             'gl_surface_wgl.h',
229             'gl_wgl_api_implementation.cc',
230             'gl_wgl_api_implementation.h',
231             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc',
232             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h',
233           ],
234         }],
235         ['OS=="mac"', {
236           'sources': [
237             'gl_context_cgl.cc',
238             'gl_context_cgl.h',
239             'gl_surface_cgl.cc',
240             'gl_surface_cgl.h',
241           ],
242           'link_settings': {
243             'libraries': [
244               '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
245             ],
246           },
247         }],
248         ['OS=="mac" and use_aura == 1', {
249           'sources': [
250             'gl_context_nsview.mm',
251             'gl_context_nsview.h',
252             'gl_surface_nsview.mm',
253             'gl_surface_nsview.h',
254           ],
255         }],
256         ['OS=="android"', {
257           'sources': [
258             'async_pixel_transfer_delegate_android.cc',
259             'async_pixel_transfer_delegate_android.h',
260             'android_native_window.cc',
261             'android_native_window.h',
262             'gl_image_egl.cc',
263             'gl_image_egl.h',
264           ],
265           'link_settings': {
266             'libraries': [
267               '-landroid',
268             ],
269           },
270           'sources!': [
271             'gl_context_osmesa.cc',
272             'system_monitor_posix.cc',
273           ],
274           'defines': [
275             'GL_GLEXT_PROTOTYPES',
276             'EGL_EGLEXT_PROTOTYPES',
277           ],
278         }],
279       ],
280     },
281     {
282       'target_name': 'gl_unittest_utils',
283       'type': 'static_library',
284       'variables': {
285         'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gl',
286       },
287       'dependencies': [
288         '../../testing/gmock.gyp:gmock',
289         '../../third_party/khronos/khronos.gyp:khronos_headers',
290         'gl',
291       ],
292       'include_dirs': [
293         '<(gl_binding_output_dir)',
294         '../..',
295       ],
296       'direct_dependent_settings': {
297         'include_dirs': [
298           '<(gl_binding_output_dir)',
299         ],
300       },
301       'sources': [
302         'gl_mock.h',
303         'gl_mock.cc',
304         '<(gl_binding_output_dir)/gl_mock_autogen_gl.h',
305       ],
306     },
307   ],