Suppress data races in blink::Scheduler
[chromium-blink-merge.git] / ui / gl / BUILD.gn
blobbbd93634f46bc36d69afdf400a35b82399e5c696
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 if (is_android) {
7   import("//build/config/android/config.gni")
8   import("//build/config/android/rules.gni")
11 config("gl_config") {
12   if (use_x11) {
13     defines = [ "GL_GLEXT_PROTOTYPES" ]
14   }
17 component("gl") {
18   output_name = "gl_wrapper"  # Avoid colliding with OS X"s libGL.dylib.
20   sources = [
21     "android/gl_jni_registrar.cc",
22     "android/gl_jni_registrar.h",
23     "android/scoped_java_surface.cc",
24     "android/scoped_java_surface.h",
25     "android/surface_texture.cc",
26     "android/surface_texture.h",
27     "android/surface_texture_listener.cc",
28     "android/surface_texture_listener.h",
29     "gl_bindings.cc",
30     "gl_bindings.h",
31     "gl_bindings_autogen_gl.cc",
32     "gl_bindings_autogen_gl.h",
33     "gl_bindings_autogen_osmesa.cc",
34     "gl_bindings_autogen_osmesa.h",
35     "gl_bindings_skia_in_process.cc",
36     "gl_bindings_skia_in_process.h",
37     "gl_context.cc",
38     "gl_context.h",
39     "gl_context_android.cc",
40     "gl_context_mac.mm",
41     "gl_context_osmesa.cc",
42     "gl_context_osmesa.h",
43     "gl_context_stub.cc",
44     "gl_context_stub.h",
45     "gl_context_stub_with_extensions.cc",
46     "gl_context_stub_with_extensions.h",
47     "gl_context_win.cc",
48     "gl_enums.cc",
49     "gl_enums.h",
50     "gl_enums_implementation_autogen.h",
51     "gl_export.h",
52     "gl_fence.cc",
53     "gl_fence.h",
54     "gl_fence_arb.cc",
55     "gl_fence_arb.h",
56     "gl_fence_nv.cc",
57     "gl_fence_nv.h",
58     "gl_gl_api_implementation.cc",
59     "gl_gl_api_implementation.h",
60     "gl_image.h",
61     "gl_image_memory.cc",
62     "gl_image_memory.h",
63     "gl_image_ref_counted_memory.cc",
64     "gl_image_ref_counted_memory.h",
65     "gl_image_shared_memory.cc",
66     "gl_image_shared_memory.h",
67     "gl_image_stub.cc",
68     "gl_image_stub.h",
69     "gl_implementation.cc",
70     "gl_implementation.h",
71     "gl_implementation_android.cc",
72     "gl_implementation_mac.cc",
73     "gl_implementation_win.cc",
74     "gl_osmesa_api_implementation.cc",
75     "gl_osmesa_api_implementation.h",
76     "gl_share_group.cc",
77     "gl_share_group.h",
78     "gl_state_restorer.cc",
79     "gl_state_restorer.h",
80     "gl_surface.cc",
81     "gl_surface.h",
82     "gl_surface_android.cc",
83     "gl_surface_mac.cc",
84     "gl_surface_stub.cc",
85     "gl_surface_stub.h",
86     "gl_surface_win.cc",
87     "gl_surface_osmesa.cc",
88     "gl_surface_osmesa.h",
89     "gl_switches.cc",
90     "gl_switches.h",
91     "gl_version_info.cc",
92     "gl_version_info.h",
93     "gpu_switching_manager.cc",
94     "gpu_switching_manager.h",
95     "scoped_binders.cc",
96     "scoped_binders.h",
97     "scoped_make_current.cc",
98     "scoped_make_current.h",
99     "sync_control_vsync_provider.cc",
100     "sync_control_vsync_provider.h",
101   ]
103   defines = [ "GL_IMPLEMENTATION" ]
105   include_dirs = [
106     "//third_party/switfshader/include",
107     "//third_party/khronos",
108     "//third_party/mesa/src/include",
109   ]
111   all_dependent_configs = [ ":gl_config" ]
113   deps = [
114     "//base/third_party/dynamic_annotations",
115     "//gpu/command_buffer/common",
116     "//skia",
117   ]
118   public_deps = [
119     "//base",
120     "//third_party/mesa:mesa_headers",
121     "//ui/events/platform",
122     "//ui/gfx",
123     "//ui/gfx/geometry",
124   ]
126   if (is_win || is_android || is_linux) {
127     sources += [
128       "egl_util.cc",
129       "egl_util.h",
130       "gl_bindings_autogen_egl.cc",
131       "gl_bindings_autogen_egl.h",
132       "gl_context_egl.cc",
133       "gl_context_egl.h",
134       "gl_fence_egl.cc",
135       "gl_fence_egl.h",
136       "gl_image_egl.cc",
137       "gl_image_egl.h",
138       "gl_surface_egl.cc",
139       "gl_surface_egl.h",
140     ]
141   }
142   if (is_android || is_linux) {
143     sources += [
144       "gl_implementation_osmesa.cc",
145       "gl_implementation_osmesa.h",
146     ]
147   }
148   if (is_linux) {
149     deps += [ "//third_party/libevent" ]
150     sources += [
151       "gl_image_linux_dma_buffer.cc",
152       "gl_image_linux_dma_buffer.h",
153     ]
154   }
155   if (use_x11) {
156     sources += [
157       "gl_bindings_autogen_glx.cc",
158       "gl_bindings_autogen_glx.h",
159       "gl_context_glx.cc",
160       "gl_context_glx.h",
161       "gl_context_x11.cc",
162       "gl_glx_api_implementation.cc",
163       "gl_glx_api_implementation.h",
164       "gl_image_glx.cc",
165       "gl_image_glx.h",
166       "gl_implementation_x11.cc",
167       "gl_surface_glx.cc",
168       "gl_surface_glx.h",
169       "gl_surface_x11.cc",
170       "gl_egl_api_implementation.cc",
171       "gl_egl_api_implementation.h",
172     ]
174     configs += [
175       "//build/config/linux:x11",
176       "//build/config/linux:xcomposite",
177       "//build/config/linux:xext",
178     ]
180     deps += [ "//ui/gfx/x" ]
181   }
182   if (is_win) {
183     sources += [
184       "gl_bindings_autogen_wgl.cc",
185       "gl_bindings_autogen_wgl.h",
186       "gl_context_wgl.cc",
187       "gl_context_wgl.h",
188       "gl_egl_api_implementation.cc",
189       "gl_egl_api_implementation.h",
190       "gl_surface_wgl.cc",
191       "gl_surface_wgl.h",
192       "gl_wgl_api_implementation.cc",
193       "gl_wgl_api_implementation.h",
194     ]
196     libs = [ "dwmapi.lib" ]
197     ldflags = [ "/DELAYLOAD:dwmapi.dll" ]
198   }
199   if (is_mac) {
200     sources += [
201       "gl_context_cgl.cc",
202       "gl_context_cgl.h",
203       "gl_fence_apple.cc",
204       "gl_fence_apple.h",
205       "gl_image_io_surface.cc",
206       "gl_image_io_surface.h",
207       "scoped_cgl.cc",
208       "scoped_cgl.h",
209     ]
211     libs = [
212       "IOSurface.framework",
213       "OpenGL.framework",
214     ]
215   }
216   if (is_android) {
217     sources += [
218       "gl_egl_api_implementation.cc",
219       "gl_egl_api_implementation.h",
220       "gl_image_surface_texture.cc",
221       "gl_image_surface_texture.h",
222     ]
224     defines += [
225       "GL_GLEXT_PROTOTYPES",
226       "EGL_EGLEXT_PROTOTYPES",
227     ]
229     libs = [ "android" ]
231     deps += [ ":gl_jni_headers" ]
232   }
233   if (use_ozone) {
234     sources += [
235       "gl_context_ozone.cc",
236       "gl_egl_api_implementation.cc",
237       "gl_egl_api_implementation.h",
238       "gl_implementation_ozone.cc",
239       "gl_surface_ozone.cc",
240     ]
241     deps += [
242       "//ui/ozone",
243       "//ui/ozone:ozone_base",
244     ]
245   }
247   if (is_android && !is_android_webview_build) {
248     deps += [ "//ui/android:ui_java" ]
249   }
252 source_set("gl_unittest_utils") {
253   testonly = true
254   sources = [
255     "gl_bindings_autogen_mock.cc",
256     "gl_bindings_autogen_mock.h",
257     "gl_mock_autogen_gl.h",
258     "gl_mock.h",
259     "gl_mock.cc",
260   ]
262   configs += [ "//third_party/khronos:khronos_headers" ]
264   deps = [
265     ":gl",
266     "//testing/gmock",
267   ]
270 if (is_android) {
271   generate_jar_jni("surface_jni_headers") {
272     jni_package = "ui/gl"
273     classes = [ "android/view/Surface.class" ]
274   }
276   generate_jni("gl_jni_headers") {
277     deps = [
278       ":surface_jni_headers",
279     ]
280     sources = [
281       "../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java",
282       "../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java",
283     ]
284     jni_package = "ui/gl"
285   }