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