MacViews: Get c/b/ui/views/tabs to build on Mac
[chromium-blink-merge.git] / ui / gl / gl.gyp
blobc404ee7136ae21026e4884208615414294340a7a
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/gfx/gfx.gyp:gfx',
22         '<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry',
23       ],
24       'variables': {
25         'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gl',
26       },
27       'defines': [
28         'GL_IMPLEMENTATION',
29       ],
30       'include_dirs': [
31         '<(DEPTH)/third_party/swiftshader/include',
32         '<(DEPTH)/third_party/khronos',
33         '<(gl_binding_output_dir)',
34       ],
35       'direct_dependent_settings': {
36         'include_dirs': [
37           '<(gl_binding_output_dir)',
38         ],
39       },
40       'export_dependent_settings': [
41         '<(DEPTH)/third_party/mesa/mesa.gyp:mesa_headers',
42       ],
43       'sources': [
44         'android/gl_jni_registrar.cc',
45         'android/gl_jni_registrar.h',
46         'android/scoped_java_surface.cc',
47         'android/scoped_java_surface.h',
48         'android/surface_texture.cc',
49         'android/surface_texture.h',
50         'android/surface_texture_listener.cc',
51         'android/surface_texture_listener.h',
52         'gl_bindings.h',
53         'gl_bindings_skia_in_process.cc',
54         'gl_bindings_skia_in_process.h',
55         'gl_context.cc',
56         'gl_context.h',
57         'gl_context_android.cc',
58         'gl_context_mac.mm',
59         'gl_context_ozone.cc',
60         'gl_context_osmesa.cc',
61         'gl_context_osmesa.h',
62         'gl_context_stub.cc',
63         'gl_context_stub.h',
64         'gl_context_stub_with_extensions.cc',
65         'gl_context_stub_with_extensions.h',
66         'gl_context_win.cc',
67         'gl_context_x11.cc',
68         'gl_export.h',
69         'gl_fence.cc',
70         'gl_fence.h',
71         'gl_fence_arb.cc',
72         'gl_fence_arb.h',
73         'gl_fence_nv.cc',
74         'gl_fence_nv.h',
75         'gl_gl_api_implementation.cc',
76         'gl_gl_api_implementation.h',
77         'gl_image.h',
78         'gl_image_memory.cc',
79         'gl_image_memory.h',
80         'gl_image_ref_counted_memory.cc',
81         'gl_image_ref_counted_memory.h',
82         'gl_image_shared_memory.cc',
83         'gl_image_shared_memory.h',
84         'gl_image_stub.cc',
85         'gl_image_stub.h',
86         'gl_implementation.cc',
87         'gl_implementation.h',
88         'gl_implementation_android.cc',
89         'gl_implementation_ozone.cc',
90         'gl_implementation_mac.cc',
91         'gl_implementation_win.cc',
92         'gl_implementation_x11.cc',
93         'gl_osmesa_api_implementation.cc',
94         'gl_osmesa_api_implementation.h',
95         'gl_share_group.cc',
96         'gl_share_group.h',
97         'gl_state_restorer.cc',
98         'gl_state_restorer.h',
99         'gl_surface.cc',
100         'gl_surface.h',
101         'gl_surface_android.cc',
102         'gl_surface_mac.cc',
103         'gl_surface_stub.cc',
104         'gl_surface_stub.h',
105         'gl_surface_win.cc',
106         'gl_surface_x11.cc',
107         'gl_surface_osmesa.cc',
108         'gl_surface_osmesa.h',
109         'gl_surface_ozone.cc',
110         'gl_switches.cc',
111         'gl_switches.h',
112         'gl_version_info.cc',
113         'gl_version_info.h',
114         'gpu_switching_manager.cc',
115         'gpu_switching_manager.h',
116         'gpu_switching_observer.h',
117         'scoped_binders.cc',
118         'scoped_binders.h',
119         'scoped_make_current.cc',
120         'scoped_make_current.h',
121         'sync_control_vsync_provider.cc',
122         'sync_control_vsync_provider.h',
123         '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc',
124         '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h',
125         '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc',
126         '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h',
127       ],
128       # hard_dependency is necessary for this target because it has actions
129       # that generate header files included by dependent targets. The header
130       # files must be generated before the dependents are compiled. The usual
131       # semantics are to allow the two targets to build concurrently.
132       'hard_dependency': 1,
133       'actions': [
134         {
135           'action_name': 'generate_gl_bindings',
136           'variables': {
137             'generator_path': 'generate_bindings.py',
138             # Prefer khronos EGL/GLES headers by listing that path first.
139             'header_paths': '../../third_party/khronos:../../third_party/mesa/src/include:.:../../gpu',
140           },
141           'inputs': [
142             '<(generator_path)',
143             '<!@(python <(generator_path) --header-paths=<(header_paths) --inputs)',
144           ],
145           'outputs': [
146             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc',
147             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h',
148             '<(gl_binding_output_dir)/gl_bindings_api_autogen_egl.h',
149             '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc',
150             '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h',
151             '<(gl_binding_output_dir)/gl_bindings_api_autogen_gl.h',
152             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc',
153             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h',
154             '<(gl_binding_output_dir)/gl_bindings_api_autogen_glx.h',
155             '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc',
156             '<(gl_binding_output_dir)/gl_bindings_autogen_mock.h',
157             '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc',
158             '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h',
159             '<(gl_binding_output_dir)/gl_bindings_api_autogen_osmesa.h',
160             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc',
161             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h',
162             '<(gl_binding_output_dir)/gl_bindings_api_autogen_wgl.h',
163             '<(gl_binding_output_dir)/gl_mock_autogen_gl.h',
164           ],
165           'action': [
166             'python',
167             '<(generator_path)',
168             '--header-paths=<(header_paths)',
169             '<(gl_binding_output_dir)',
170           ],
171         },
172       ],
173       'conditions': [
174         ['OS in ("win", "android", "linux")', {
175           'sources': [
176             'egl_util.cc',
177             'egl_util.h',
178             'gl_context_egl.cc',
179             'gl_context_egl.h',
180             'gl_fence_egl.cc',
181             'gl_fence_egl.h',
182             'gl_image_egl.cc',
183             'gl_image_egl.h',
184             'gl_surface_egl.cc',
185             'gl_surface_egl.h',
186             'gl_egl_api_implementation.cc',
187             'gl_egl_api_implementation.h',
188             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc',
189             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h',
190           ],
191           'include_dirs': [
192             '<(DEPTH)/third_party/khronos',
193         ],
194         }],
195         ['OS in ("android", "linux")', {
196           'sources': [
197             'gl_implementation_osmesa.cc',
198             'gl_implementation_osmesa.h',
199           ],
200         }],
201         ['OS=="linux"', {
202           'sources': [
203             'gl_image_linux_dma_buffer.cc',
204             'gl_image_linux_dma_buffer.h',
205           ],
206         }],
207         ['use_x11 == 1', {
208           'sources': [
209             'gl_context_glx.cc',
210             'gl_context_glx.h',
211             'gl_glx_api_implementation.cc',
212             'gl_glx_api_implementation.h',
213             'gl_image_glx.cc',
214             'gl_image_glx.h',
215             'gl_surface_glx.cc',
216             'gl_surface_glx.h',
217             'gl_egl_api_implementation.cc',
218             'gl_egl_api_implementation.h',
219             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc',
220             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h',
221           ],
222           'all_dependent_settings': {
223             'defines': [
224               'GL_GLEXT_PROTOTYPES',
225             ],
226           },
227           'dependencies': [
228             '<(DEPTH)/build/linux/system.gyp:x11',
229             '<(DEPTH)/build/linux/system.gyp:xcomposite',
230             '<(DEPTH)/build/linux/system.gyp:xext',
231             '<(DEPTH)/ui/events/platform/events_platform.gyp:events_platform',
232             '<(DEPTH)/ui/gfx/x/gfx_x11.gyp:gfx_x11',
233           ],
234         }],
235         ['OS=="win"', {
236           'sources': [
237             'gl_context_wgl.cc',
238             'gl_context_wgl.h',
239             'gl_egl_api_implementation.cc',
240             'gl_egl_api_implementation.h',
241             'gl_surface_wgl.cc',
242             'gl_surface_wgl.h',
243             'gl_wgl_api_implementation.cc',
244             'gl_wgl_api_implementation.h',
245             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc',
246             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h',
247           ],
248           'msvs_settings': {
249             'VCLinkerTool': {
250               'DelayLoadDLLs': [
251                 'dwmapi.dll',
252               ],
253               'AdditionalDependencies': [
254                 'dwmapi.lib',
255               ],
256             },
257           },
258           'link_settings': {
259             'libraries': [
260               '-ldwmapi.lib',
261             ],
262           },
263         }],
264         ['OS=="mac"', {
265           'sources': [
266             'gl_context_cgl.cc',
267             'gl_context_cgl.h',
268             'gl_image_io_surface.cc',
269             'gl_image_io_surface.h',
270             'scoped_cgl.cc',
271             'scoped_cgl.h',
272           ],
273           'link_settings': {
274             'libraries': [
275               '$(SDKROOT)/System/Library/Frameworks/IOSurface.framework',
276               '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
277             ],
278           },
279         }],
280         ['OS=="android"', {
281           'dependencies': [
282             'gl_jni_headers',
283           ],
284           'sources': [
285             'gl_image_surface_texture.cc',
286             'gl_image_surface_texture.h',
287           ],
288           'link_settings': {
289             'libraries': [
290               '-landroid',
291             ],
292           },
293           'sources!': [
294             'system_monitor_posix.cc',
295           ],
296           'defines': [
297             'GL_GLEXT_PROTOTYPES',
298             'EGL_EGLEXT_PROTOTYPES',
299           ],
300         }],
301         ['OS!="android"', {
302           'sources/': [ ['exclude', '^android/'] ],
303         }],
304         ['use_ozone==1', {
305           'dependencies': [
306             '../ozone/ozone.gyp:ozone',
307             '../ozone/ozone.gyp:ozone_base',
308           ],
309         }],
310         ['OS=="android" and android_webview_build==0', {
311           'dependencies': [
312             '../android/ui_android.gyp:ui_java',
313           ],
314         }],
315         ['ubsan==1', {
316           # Due to a bug in LLVM (http://llvm.org/bugs/show_bug.cgi?id=21349),
317           # compilation hangs for some GL source files. Disable -O2 temporarily
318           # until http://crbug.com/426271 is fixed.
319           'cflags!': [
320             '-O2',
321           ],
322         }],
323       ],
324     },
325     {
326       'target_name': 'gl_unittest_utils',
327       'type': 'static_library',
328       'variables': {
329         'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gl',
330       },
331       'dependencies': [
332         '../../testing/gmock.gyp:gmock',
333         '../../third_party/khronos/khronos.gyp:khronos_headers',
334         'gl',
335       ],
336       'include_dirs': [
337         '<(gl_binding_output_dir)',
338         '../..',
339       ],
340       'direct_dependent_settings': {
341         'include_dirs': [
342           '<(gl_binding_output_dir)',
343         ],
344       },
345       'sources': [
346         'gl_mock.h',
347         'gl_mock.cc',
348         '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc',
349         '<(gl_binding_output_dir)/gl_bindings_autogen_mock.h',
350         '<(gl_binding_output_dir)/gl_mock_autogen_gl.h',
351       ],
352     },
353   ],
354   'conditions': [
355     ['OS=="android"' , {
356       'targets': [
357         {
358           'target_name': 'surface_jni_headers',
359           'type': 'none',
360           'variables': {
361             'jni_gen_package': 'ui/gl',
362             'input_java_class': 'android/view/Surface.class',
363           },
364           'includes': [ '../../build/jar_file_jni_generator.gypi' ],
365         },
366         {
367           'target_name': 'gl_jni_headers',
368           'type': 'none',
369           'dependencies': [
370             'surface_jni_headers',
371           ],
372           'sources': [
373             '../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java',
374             '../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java',
375           ],
376           'variables': {
377             'jni_gen_package': 'ui/gl',
378           },
379           'includes': [ '../../build/jni_generator.gypi' ],
380         },
381       ],
382     }],
383   ],