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")
7 import("//build/config/android/config.gni")
8 import("//build/config/android/rules.gni")
11 gl_binding_output_dir = target_gen_dir
15 defines = [ "GL_GLEXT_PROTOTYPES" ]
18 # TODO(brettw) this should be removed and the the files using the generated
19 # GL bindings should use the path inside the gen directory.
20 include_dirs = [ gl_binding_output_dir ]
24 output_name = "gl_wrapper" # Avoid colliding with OS X"s libGL.dylib.
27 "android/gl_jni_registrar.cc",
28 "android/gl_jni_registrar.h",
29 "android/scoped_java_surface.cc",
30 "android/scoped_java_surface.h",
31 "android/surface_texture.cc",
32 "android/surface_texture.h",
33 "android/surface_texture_listener.cc",
34 "android/surface_texture_listener.h",
36 "gl_bindings_skia_in_process.cc",
37 "gl_bindings_skia_in_process.h",
40 "gl_context_android.cc",
42 "gl_context_osmesa.cc",
43 "gl_context_osmesa.h",
46 "gl_context_stub_with_extensions.cc",
47 "gl_context_stub_with_extensions.h",
56 "gl_gl_api_implementation.cc",
57 "gl_gl_api_implementation.h",
61 "gl_image_ref_counted_memory.cc",
62 "gl_image_ref_counted_memory.h",
63 "gl_image_shared_memory.cc",
64 "gl_image_shared_memory.h",
67 "gl_implementation.cc",
68 "gl_implementation.h",
69 "gl_implementation_android.cc",
70 "gl_implementation_mac.cc",
71 "gl_implementation_win.cc",
72 "gl_osmesa_api_implementation.cc",
73 "gl_osmesa_api_implementation.h",
76 "gl_state_restorer.cc",
77 "gl_state_restorer.h",
80 "gl_surface_android.cc",
85 "gl_surface_osmesa.cc",
86 "gl_surface_osmesa.h",
91 "gpu_switching_manager.cc",
92 "gpu_switching_manager.h",
95 "scoped_make_current.cc",
96 "scoped_make_current.h",
97 "sync_control_vsync_provider.cc",
98 "sync_control_vsync_provider.h",
99 "$gl_binding_output_dir/gl_bindings_autogen_gl.cc",
100 "$gl_binding_output_dir/gl_bindings_autogen_gl.h",
101 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.cc",
102 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.h",
105 defines = [ "GL_IMPLEMENTATION" ]
108 "//third_party/switfshader/include",
109 "//third_party/khronos",
110 "//third_party/mesa/src/include",
111 gl_binding_output_dir,
114 all_dependent_configs = [ ":gl_config" ]
117 ":generate_gl_bindings",
118 "//base/third_party/dynamic_annotations",
119 "//gpu/command_buffer/common",
124 "//third_party/mesa:mesa_headers",
125 "//ui/events/platform",
130 if (is_win || is_android || is_linux) {
142 "$gl_binding_output_dir/gl_bindings_autogen_egl.cc",
143 "$gl_binding_output_dir/gl_bindings_autogen_egl.h",
146 if (is_android || is_linux) {
148 "gl_implementation_osmesa.cc",
149 "gl_implementation_osmesa.h",
153 deps += [ "//third_party/libevent" ]
155 "gl_image_linux_dma_buffer.cc",
156 "gl_image_linux_dma_buffer.h",
164 "gl_glx_api_implementation.cc",
165 "gl_glx_api_implementation.h",
168 "gl_implementation_x11.cc",
172 "gl_egl_api_implementation.cc",
173 "gl_egl_api_implementation.h",
174 "$gl_binding_output_dir/gl_bindings_autogen_glx.cc",
175 "$gl_binding_output_dir/gl_bindings_autogen_glx.h",
179 "//build/config/linux:x11",
180 "//build/config/linux:xcomposite",
181 "//build/config/linux:xext",
192 "gl_egl_api_implementation.cc",
193 "gl_egl_api_implementation.h",
196 "gl_wgl_api_implementation.cc",
197 "gl_wgl_api_implementation.h",
198 "$gl_binding_output_dir/gl_bindings_autogen_wgl.cc",
199 "$gl_binding_output_dir/gl_bindings_autogen_wgl.h",
202 libs = [ "dwmapi.lib" ]
203 ldflags = [ "/DELAYLOAD:dwmapi.dll" ]
209 "gl_image_io_surface.cc",
210 "gl_image_io_surface.h",
216 "IOSurface.framework",
222 "gl_egl_api_implementation.cc",
223 "gl_egl_api_implementation.h",
224 "gl_image_surface_texture.cc",
225 "gl_image_surface_texture.h",
229 "GL_GLEXT_PROTOTYPES",
230 "EGL_EGLEXT_PROTOTYPES",
241 "gl_context_ozone.cc",
242 "gl_egl_api_implementation.cc",
243 "gl_egl_api_implementation.h",
244 "gl_implementation_ozone.cc",
245 "gl_surface_ozone.cc",
249 "//ui/ozone:ozone_base",
253 if (is_android && !is_android_webview_build) {
254 deps += [ "//ui/android:ui_java" ]
258 action("generate_gl_bindings") {
259 visibility = [ ":*" ] # Only targets in this file can see this.
261 script = "generate_bindings.py"
263 # TODO(brettw) make this dynamic. The GYP version calls "generate_bindings.py
264 # --inputs" to get the list here. What should happen is that the script
265 # should generate a .d file, which we should declare here. That will
266 # eliminate the need bot both hardcoding the list here or calling the script
269 "EGL/eglextchromium.h",
270 "GL/glextchromium.h",
271 "//third_party/mesa/src/include/GL/glext.h",
272 "//third_party/khronos/GLES2/gl2ext.h",
273 "//gpu/GLES2/gl2chromium.h",
274 "//gpu/GLES2/gl2extchromium.h",
275 "//third_party/khronos/EGL/eglext.h",
276 "//third_party/mesa/src/include/GL/wglext.h",
277 "//third_party/mesa/src/include/GL/glx.h",
278 "//third_party/mesa/src/include/GL/glxext.h",
282 "$gl_binding_output_dir/gl_bindings_autogen_egl.cc",
283 "$gl_binding_output_dir/gl_bindings_autogen_egl.h",
284 "$gl_binding_output_dir/gl_bindings_api_autogen_egl.h",
285 "$gl_binding_output_dir/gl_bindings_autogen_gl.cc",
286 "$gl_binding_output_dir/gl_bindings_autogen_gl.h",
287 "$gl_binding_output_dir/gl_bindings_api_autogen_gl.h",
288 "$gl_binding_output_dir/gl_bindings_autogen_glx.cc",
289 "$gl_binding_output_dir/gl_bindings_autogen_glx.h",
290 "$gl_binding_output_dir/gl_bindings_api_autogen_glx.h",
291 "$gl_binding_output_dir/gl_bindings_autogen_mock.cc",
292 "$gl_binding_output_dir/gl_bindings_autogen_mock.h",
293 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.cc",
294 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.h",
295 "$gl_binding_output_dir/gl_bindings_api_autogen_osmesa.h",
296 "$gl_binding_output_dir/gl_bindings_autogen_wgl.cc",
297 "$gl_binding_output_dir/gl_bindings_autogen_wgl.h",
298 "$gl_binding_output_dir/gl_bindings_api_autogen_wgl.h",
299 "$gl_binding_output_dir/gl_mock_autogen_gl.h",
304 rebase_path("//third_party/khronos", root_build_dir) + ":" +
305 rebase_path("//third_party/mesa/src/include", root_build_dir) + ":" +
306 rebase_path("//ui/gl", root_build_dir) + ":" +
307 rebase_path("//gpu", root_build_dir),
308 rebase_path(gl_binding_output_dir, root_build_dir),
312 config("gl_unittest_utils_config") {
313 include_dirs = [ gl_binding_output_dir ]
316 source_set("gl_unittest_utils") {
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",
326 configs += [ "//third_party/khronos:khronos_headers" ]
327 public_configs = [ ":gl_unittest_utils_config" ]
336 generate_jar_jni("surface_jni_headers") {
337 jni_package = "ui/gl"
338 classes = [ "android/view/Surface.class" ]
341 generate_jni("gl_jni_headers") {
342 deps = [ ":surface_jni_headers" ]
344 "../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java",
345 "../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java",
347 jni_package = "ui/gl"