Upstream version 5.34.104.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/mesa/src/include',
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_gl_api_implementation.cc',
72         'gl_gl_api_implementation.h',
73         'gl_image.cc',
74         'gl_image.h',
75         'gl_image_android.cc',
76         'gl_image_mac.cc',
77         'gl_image_ozone.cc',
78         'gl_image_shm.cc',
79         'gl_image_shm.h',
80         'gl_image_stub.cc',
81         'gl_image_stub.h',
82         'gl_image_win.cc',
83         'gl_image_x11.cc',
84         'gl_implementation.cc',
85         'gl_implementation.h',
86         'gl_implementation_android.cc',
87         'gl_implementation_linux.cc',
88         'gl_implementation_linux.h',
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_mac.cc',
102         'gl_surface_stub.cc',
103         'gl_surface_stub.h',
104         'gl_surface_win.cc',
105         'gl_surface_x11.cc',
106         'gl_surface_osmesa.cc',
107         'gl_surface_osmesa.h',
108         'gl_switches.cc',
109         'gl_switches.h',
110         'gl_version_info.cc',
111         'gl_version_info.h',
112         'gpu_switching_manager.cc',
113         'gpu_switching_manager.h',
114         'io_surface_support_mac.cc',
115         'io_surface_support_mac.h',
116         'scoped_binders.cc',
117         'scoped_binders.h',
118         'scoped_make_current.cc',
119         'scoped_make_current.h',
120         'sync_control_vsync_provider.cc',
121         'sync_control_vsync_provider.h',
122         '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc',
123         '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h',
124         '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc',
125         '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h',
126       ],
127       # hard_dependency is necessary for this target because it has actions
128       # that generate header files included by dependent targets. The header
129       # files must be generated before the dependents are compiled. The usual
130       # semantics are to allow the two targets to build concurrently.
131       'hard_dependency': 1,
132       'actions': [
133         {
134           'action_name': 'generate_gl_bindings',
135           'variables': {
136             'generator_path': 'generate_bindings.py',
137             # Prefer khronos EGL/GLES headers by listing that path first.
138             'header_paths': '../../third_party/khronos:../../third_party/mesa/src/include',
139           },
140           'inputs': [
141             '<(generator_path)',
142             '<!@(python <(generator_path) --header-paths=<(header_paths) --inputs)',
143           ],
144           'outputs': [
145             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc',
146             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h',
147             '<(gl_binding_output_dir)/gl_bindings_api_autogen_egl.h',
148             '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc',
149             '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h',
150             '<(gl_binding_output_dir)/gl_bindings_api_autogen_gl.h',
151             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc',
152             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h',
153             '<(gl_binding_output_dir)/gl_bindings_api_autogen_glx.h',
154             '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc',
155             '<(gl_binding_output_dir)/gl_bindings_autogen_mock.h',
156             '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc',
157             '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h',
158             '<(gl_binding_output_dir)/gl_bindings_api_autogen_osmesa.h',
159             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc',
160             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h',
161             '<(gl_binding_output_dir)/gl_bindings_api_autogen_wgl.h',
162             '<(gl_binding_output_dir)/gl_mock_autogen_gl.h',
163           ],
164           'action': [
165             'python',
166             '<(generator_path)',
167             '--header-paths=<(header_paths)',
168             '<(gl_binding_output_dir)',
169           ],
170         },
171       ],
172       'conditions': [
173         ['OS in ("win", "android", "linux")', {
174           'sources': [
175             'egl_util.cc',
176             'egl_util.h',
177             'gl_context_egl.cc',
178             'gl_context_egl.h',
179             'gl_surface_egl.cc',
180             'gl_surface_egl.h',
181             'gl_egl_api_implementation.cc',
182             'gl_egl_api_implementation.h',
183             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc',
184             '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h',
185           ],
186           'include_dirs': [
187             '<(DEPTH)/third_party/khronos',
188         ],
189         }],
190         ['use_x11 == 1', {
191           'sources': [
192             'gl_context_glx.cc',
193             'gl_context_glx.h',
194             'gl_glx_api_implementation.cc',
195             'gl_glx_api_implementation.h',
196             'gl_image_glx.cc',
197             'gl_image_glx.h',
198             'gl_surface_glx.cc',
199             'gl_surface_glx.h',
200             'gl_egl_api_implementation.cc',
201             'gl_egl_api_implementation.h',
202             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc',
203             '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h',
204           ],
205           'all_dependent_settings': {
206             'defines': [
207               'GL_GLEXT_PROTOTYPES',
208             ],
209           },
210           'dependencies': [
211             '<(DEPTH)/build/linux/system.gyp:x11',
212             '<(DEPTH)/build/linux/system.gyp:xcomposite',
213             '<(DEPTH)/build/linux/system.gyp:xext',
214           ],
215         }],
216         ['OS=="win"', {
217           'sources': [
218             'gl_context_wgl.cc',
219             'gl_context_wgl.h',
220             'gl_egl_api_implementation.cc',
221             'gl_egl_api_implementation.h',
222             'gl_surface_wgl.cc',
223             'gl_surface_wgl.h',
224             'gl_wgl_api_implementation.cc',
225             'gl_wgl_api_implementation.h',
226             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc',
227             '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h',
228           ],
229           'msvs_settings': {
230             'VCLinkerTool': {
231               'DelayLoadDLLs': [
232                 'dwmapi.dll',
233               ],
234               'AdditionalDependencies': [
235                 'dwmapi.lib',
236               ],
237             },
238           },
239           'link_settings': {
240             'libraries': [
241               '-ldwmapi.lib',
242             ],
243           },
244         }],
245         ['OS=="mac"', {
246           'sources': [
247             'gl_context_cgl.cc',
248             'gl_context_cgl.h',
249             'gl_image_io_surface.cc',
250             'gl_image_io_surface.h',
251             'gl_surface_cgl.cc',
252             'gl_surface_cgl.h',
253             'gl_context_nsview.mm',
254             'gl_context_nsview.h',
255             'gl_surface_nsview.mm',
256             'gl_surface_nsview.h',
257             'scoped_cgl.cc',
258             'scoped_cgl.h',
259           ],
260           'link_settings': {
261             'libraries': [
262               '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
263             ],
264           },
265         }],
266         ['OS=="android"', {
267           'dependencies': [
268             'gl_jni_headers',
269           ],
270           'sources': [
271             'gl_image_egl.cc',
272             'gl_image_egl.h',
273           ],
274           'link_settings': {
275             'libraries': [
276               '-landroid',
277             ],
278           },
279           'sources!': [
280             'gl_context_osmesa.cc',
281             'system_monitor_posix.cc',
282           ],
283           'defines': [
284             'GL_GLEXT_PROTOTYPES',
285             'EGL_EGLEXT_PROTOTYPES',
286           ],
287         }],
288         ['OS!="android"', {
289           'sources/': [ ['exclude', '^android/'] ],
290         }],
291         ['use_ozone==1', {
292           'dependencies': [
293             '../ozone/ozone.gyp:ozone',
294           ],
295         }],
296       ],
297     },
298     {
299       'target_name': 'gl_unittest_utils',
300       'type': 'static_library',
301       'variables': {
302         'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gl',
303       },
304       'dependencies': [
305         '../../testing/gmock.gyp:gmock',
306         '../../third_party/khronos/khronos.gyp:khronos_headers',
307         'gl',
308       ],
309       'include_dirs': [
310         '<(gl_binding_output_dir)',
311         '../..',
312       ],
313       'direct_dependent_settings': {
314         'include_dirs': [
315           '<(gl_binding_output_dir)',
316         ],
317       },
318       'sources': [
319         'gl_mock.h',
320         'gl_mock.cc',
321         '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc',
322         '<(gl_binding_output_dir)/gl_bindings_autogen_mock.h',
323         '<(gl_binding_output_dir)/gl_mock_autogen_gl.h',
324       ],
325     },
326   ],
327   'conditions': [
328     ['OS=="android"' , {
329       'targets': [
330         {
331           'target_name': 'surface_jni_headers',
332           'type': 'none',
333           'variables': {
334             'jni_gen_package': 'ui/gl',
335             'input_java_class': 'android/view/Surface.class',
336             'jni_generator_ptr_type': 'long',
337           },
338           'includes': [ '../../build/jar_file_jni_generator.gypi' ],
339         },
340         {
341           'target_name': 'gl_jni_headers',
342           'type': 'none',
343           'dependencies': [
344             'surface_jni_headers',
345           ],
346           'sources': [
347             '../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java',
348             '../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java',
349           ],
350           'variables': {
351             'jni_gen_package': 'ui/gl',
352             'jni_generator_ptr_type': 'long',
353           },
354           'includes': [ '../../build/jni_generator.gypi' ],
355         },
356       ],
357     }],
358   ],
359 }