Add ICU message format support
[chromium-blink-merge.git] / ui / gl / BUILD.gn
blob8234fc7d16599f7ad85c0666a203e283e1d1f868
1 # Copyright 2014 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.
5 import("//build/config/ui.gni")
6 import("//testing/test.gni")
8 if (is_android) {
9   import("//build/config/android/config.gni")
10   import("//build/config/android/rules.gni")
13 config("gl_config") {
14   if (use_x11) {
15     defines = [ "GL_GLEXT_PROTOTYPES" ]
16   }
19 component("gl") {
20   output_name = "gl_wrapper"  # Avoid colliding with OS X"s libGL.dylib.
22   sources = [
23     "android/gl_jni_registrar.cc",
24     "android/gl_jni_registrar.h",
25     "android/scoped_java_surface.cc",
26     "android/scoped_java_surface.h",
27     "android/surface_texture.cc",
28     "android/surface_texture.h",
29     "android/surface_texture_listener.cc",
30     "android/surface_texture_listener.h",
31     "gl_bindings.cc",
32     "gl_bindings.h",
33     "gl_bindings_autogen_gl.cc",
34     "gl_bindings_autogen_gl.h",
35     "gl_bindings_autogen_osmesa.cc",
36     "gl_bindings_autogen_osmesa.h",
37     "gl_bindings_skia_in_process.cc",
38     "gl_bindings_skia_in_process.h",
39     "gl_context.cc",
40     "gl_context.h",
41     "gl_context_android.cc",
42     "gl_context_mac.mm",
43     "gl_context_osmesa.cc",
44     "gl_context_osmesa.h",
45     "gl_context_stub.cc",
46     "gl_context_stub.h",
47     "gl_context_stub_with_extensions.cc",
48     "gl_context_stub_with_extensions.h",
49     "gl_context_win.cc",
50     "gl_enums.cc",
51     "gl_enums.h",
52     "gl_enums_implementation_autogen.h",
53     "gl_export.h",
54     "gl_fence.cc",
55     "gl_fence.h",
56     "gl_fence_arb.cc",
57     "gl_fence_arb.h",
58     "gl_fence_nv.cc",
59     "gl_fence_nv.h",
60     "gl_gl_api_implementation.cc",
61     "gl_gl_api_implementation.h",
62     "gl_image.h",
63     "gl_image_memory.cc",
64     "gl_image_memory.h",
65     "gl_image_ref_counted_memory.cc",
66     "gl_image_ref_counted_memory.h",
67     "gl_image_shared_memory.cc",
68     "gl_image_shared_memory.h",
69     "gl_image_stub.cc",
70     "gl_image_stub.h",
71     "gl_implementation.cc",
72     "gl_implementation.h",
73     "gl_implementation_android.cc",
74     "gl_implementation_mac.cc",
75     "gl_implementation_win.cc",
76     "gl_osmesa_api_implementation.cc",
77     "gl_osmesa_api_implementation.h",
78     "gl_share_group.cc",
79     "gl_share_group.h",
80     "gl_state_restorer.cc",
81     "gl_state_restorer.h",
82     "gl_surface.cc",
83     "gl_surface.h",
84     "gl_surface_android.cc",
85     "gl_surface_mac.cc",
86     "gl_surface_osmesa.cc",
87     "gl_surface_osmesa.h",
88     "gl_surface_stub.cc",
89     "gl_surface_stub.h",
90     "gl_surface_win.cc",
91     "gl_switches.cc",
92     "gl_switches.h",
93     "gl_version_info.cc",
94     "gl_version_info.h",
95     "gpu_switching_manager.cc",
96     "gpu_switching_manager.h",
97     "gpu_timing.cc",
98     "gpu_timing.h",
99     "scoped_binders.cc",
100     "scoped_binders.h",
101     "scoped_make_current.cc",
102     "scoped_make_current.h",
103     "sync_control_vsync_provider.cc",
104     "sync_control_vsync_provider.h",
105     "trace_util.cc",
106     "trace_util.h",
107   ]
109   configs += [ "//build/config:precompiled_headers" ]
110   defines = [ "GL_IMPLEMENTATION" ]
112   include_dirs = [
113     "//third_party/switfshader/include",
114     "//third_party/mesa/src/include",
115   ]
117   all_dependent_configs = [ ":gl_config" ]
119   public_configs = [ "//third_party/khronos:khronos_headers" ]
121   deps = [
122     "//base/third_party/dynamic_annotations",
123     "//skia",
124   ]
125   public_deps = [
126     "//base",
127     "//third_party/mesa:mesa_headers",
128     "//ui/events/platform",
129     "//ui/gfx",
130     "//ui/gfx/geometry",
131   ]
133   if (is_win || is_android || is_linux) {
134     sources += [
135       "egl_util.cc",
136       "egl_util.h",
137       "gl_bindings_autogen_egl.cc",
138       "gl_bindings_autogen_egl.h",
139       "gl_context_egl.cc",
140       "gl_context_egl.h",
141       "gl_fence_egl.cc",
142       "gl_fence_egl.h",
143       "gl_image_egl.cc",
144       "gl_image_egl.h",
145       "gl_surface_egl.cc",
146       "gl_surface_egl.h",
147     ]
148   }
149   if (is_android || is_linux) {
150     sources += [
151       "gl_implementation_osmesa.cc",
152       "gl_implementation_osmesa.h",
153     ]
154   }
155   if (is_linux) {
156     deps += [ "//third_party/libevent" ]
157   }
158   if (use_x11) {
159     sources += [
160       "gl_bindings_autogen_glx.cc",
161       "gl_bindings_autogen_glx.h",
162       "gl_context_glx.cc",
163       "gl_context_glx.h",
164       "gl_context_x11.cc",
165       "gl_egl_api_implementation.cc",
166       "gl_egl_api_implementation.h",
167       "gl_glx_api_implementation.cc",
168       "gl_glx_api_implementation.h",
169       "gl_image_glx.cc",
170       "gl_image_glx.h",
171       "gl_implementation_x11.cc",
172       "gl_surface_glx.cc",
173       "gl_surface_glx.h",
174       "gl_surface_x11.cc",
175     ]
177     configs += [
178       "//build/config/linux:x11",
179       "//build/config/linux:xcomposite",
180       "//build/config/linux:xext",
181     ]
183     deps += [ "//ui/gfx/x" ]
184   }
185   if (is_win) {
186     sources += [
187       "angle_platform_impl.cc",
188       "angle_platform_impl.h",
189       "gl_bindings_autogen_wgl.cc",
190       "gl_bindings_autogen_wgl.h",
191       "gl_context_wgl.cc",
192       "gl_context_wgl.h",
193       "gl_egl_api_implementation.cc",
194       "gl_egl_api_implementation.h",
195       "gl_surface_wgl.cc",
196       "gl_surface_wgl.h",
197       "gl_wgl_api_implementation.cc",
198       "gl_wgl_api_implementation.h",
199     ]
201     libs = [ "dwmapi.lib" ]
202     ldflags = [ "/DELAYLOAD:dwmapi.dll" ]
204     data_deps = [
205       "//third_party/angle:libEGL",
206       "//third_party/angle:libGLESv2",
207       "//third_party/mesa:osmesa",
208     ]
209   }
210   if (is_mac) {
211     sources += [
212       "gl_context_cgl.cc",
213       "gl_context_cgl.h",
214       "gl_fence_apple.cc",
215       "gl_fence_apple.h",
216       "gl_image_io_surface.h",
217       "gl_image_io_surface.mm",
218       "scoped_cgl.cc",
219       "scoped_cgl.h",
220     ]
222     libs = [
223       "IOSurface.framework",
224       "OpenGL.framework",
225       "Quartz.framework",
226     ]
227   }
228   if (is_android) {
229     sources += [
230       "gl_egl_api_implementation.cc",
231       "gl_egl_api_implementation.h",
232       "gl_image_surface_texture.cc",
233       "gl_image_surface_texture.h",
234     ]
236     defines += [
237       "GL_GLEXT_PROTOTYPES",
238       "EGL_EGLEXT_PROTOTYPES",
239     ]
241     libs = [ "android" ]
243     deps += [
244       ":gl_jni_headers",
245       "//ui/android:ui_java",
246     ]
247   }
248   if (use_ozone) {
249     sources += [
250       "gl_context_ozone.cc",
251       "gl_egl_api_implementation.cc",
252       "gl_egl_api_implementation.h",
253       "gl_image_ozone_native_pixmap.cc",
254       "gl_image_ozone_native_pixmap.h",
255       "gl_implementation_ozone.cc",
256       "gl_surface_ozone.cc",
257     ]
258     deps += [
259       "//ui/ozone",
260       "//ui/ozone:ozone_base",
261     ]
262   }
265 source_set("gl_unittest_utils") {
266   testonly = true
267   sources = [
268     "gl_bindings_autogen_mock.cc",
269     "gl_bindings_autogen_mock.h",
270     "gl_mock.cc",
271     "gl_mock.h",
272     "gl_mock_autogen_gl.h",
273     "gpu_timing_fake.cc",
274     "gpu_timing_fake.h",
275   ]
277   configs += [ "//third_party/khronos:khronos_headers" ]
279   deps = [
280     ":gl",
281     "//testing/gmock",
282   ]
285 source_set("test_support") {
286   sources = [
287     "test/gl_surface_test_support.cc",
288     "test/gl_surface_test_support.h",
289   ]
291   configs += [ "//third_party/khronos:khronos_headers" ]
293   deps = [
294     ":gl",
295   ]
297   if (use_x11) {
298     configs += [ "//build/config/linux:x11" ]
299     deps += [
300       "//ui/gfx/x",
301       "//ui/platform_window/x11",
302     ]
303   }
306 # TODO(GYP): Delete this after we've converted everything to GN.
307 # The _run targets exist only for compatibility w/ GYP.
308 group("gl_unittests_run") {
309   testonly = true
310   deps = [
311     ":gl_unittests",
312   ]
315 test("gl_unittests") {
316   sources = [
317     "gl_api_unittest.cc",
318     "gpu_timing_unittest.cc",
319     "test/run_all_unittests.cc",
320   ]
322   if (is_win || is_android || is_linux) {
323     sources += [
324       "egl_api_unittest.cc",
325       "test/egl_initialization_displays_unittest.cc",
326     ]
327   }
329   include_dirs = [ "//third_party/khronos" ]
331   deps = [
332     ":gl",
333     ":gl_unittest_utils",
334     ":test_support",
335     "//base",
336     "//base/test:test_support",
337     "//testing/gmock",
338     "//testing/gtest",
339   ]
342 if (is_android) {
343   generate_jar_jni("surface_jni_headers") {
344     jni_package = "ui/gl"
345     classes = [ "android/view/Surface.class" ]
346   }
348   generate_jni("gl_jni_headers") {
349     deps = [
350       ":surface_jni_headers",
351     ]
352     sources = [
353       "../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java",
354       "../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java",
355     ]
356     jni_package = "ui/gl"
357   }