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/rules.gni")
10 gl_binding_output_dir = target_gen_dir
14 defines = [ "GL_GLEXT_PROTOTYPES" ]
17 # TODO(brettw) this should be removed and the the files using the generated
18 # GL bindings should use the path inside the gen directory.
19 include_dirs = [ gl_binding_output_dir ]
23 output_name = "gl_wrapper" # Avoid colliding with OS X"s libGL.dylib.
26 "android/gl_jni_registrar.cc",
27 "android/gl_jni_registrar.h",
28 "android/scoped_java_surface.cc",
29 "android/scoped_java_surface.h",
30 "android/surface_texture.cc",
31 "android/surface_texture.h",
32 "android/surface_texture_listener.cc",
33 "android/surface_texture_listener.h",
34 "android/surface_texture_tracker.cc",
35 "android/surface_texture_tracker.h",
37 "gl_bindings_skia_in_process.cc",
38 "gl_bindings_skia_in_process.h",
41 "gl_context_android.cc",
43 "gl_context_osmesa.cc",
44 "gl_context_osmesa.h",
47 "gl_context_stub_with_extensions.cc",
48 "gl_context_stub_with_extensions.h",
57 "gl_gl_api_implementation.cc",
58 "gl_gl_api_implementation.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",
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",
78 "gl_state_restorer.cc",
79 "gl_state_restorer.h",
82 "gl_surface_android.cc",
87 "gl_surface_osmesa.cc",
88 "gl_surface_osmesa.h",
93 "gpu_switching_manager.cc",
94 "gpu_switching_manager.h",
97 "scoped_make_current.cc",
98 "scoped_make_current.h",
99 "sync_control_vsync_provider.cc",
100 "sync_control_vsync_provider.h",
101 "$gl_binding_output_dir/gl_bindings_autogen_gl.cc",
102 "$gl_binding_output_dir/gl_bindings_autogen_gl.h",
103 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.cc",
104 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.h",
107 defines = [ "GL_IMPLEMENTATION" ]
110 "//third_party/switfshader/include",
111 "//third_party/khronos",
112 "//third_party/mesa/src/include",
113 gl_binding_output_dir,
116 all_dependent_configs = [ ":gl_config" ]
119 ":generate_gl_bindings",
121 "//base/third_party/dynamic_annotations",
122 "//gpu/command_buffer/common",
123 "//third_party/mesa:mesa_headers",
125 "//ui/events/platform",
130 # TODO(GYP) hook up once this is converted.
131 forward_dependent_configs_from = [ "//third_party/mesa:mesa_headers" ]
133 if (is_win || is_android || is_linux) {
145 "$gl_binding_output_dir/gl_bindings_autogen_egl.cc",
146 "$gl_binding_output_dir/gl_bindings_autogen_egl.h",
149 if (is_android || is_linux) {
151 "gl_implementation_osmesa.cc",
152 "gl_implementation_osmesa.h",
156 deps += [ "//third_party/libevent" ]
163 "gl_glx_api_implementation.cc",
164 "gl_glx_api_implementation.h",
167 "gl_implementation_x11.cc",
171 "gl_egl_api_implementation.cc",
172 "gl_egl_api_implementation.h",
173 "$gl_binding_output_dir/gl_bindings_autogen_glx.cc",
174 "$gl_binding_output_dir/gl_bindings_autogen_glx.h",
178 "//build/config/linux:x11",
179 "//build/config/linux:xcomposite",
180 "//build/config/linux:xext",
191 "gl_egl_api_implementation.cc",
192 "gl_egl_api_implementation.h",
195 "gl_wgl_api_implementation.cc",
196 "gl_wgl_api_implementation.h",
197 "$gl_binding_output_dir/gl_bindings_autogen_wgl.cc",
198 "$gl_binding_output_dir/gl_bindings_autogen_wgl.h",
201 libs = [ "dwmapi.lib" ]
202 ldflags = [ "/DELAYLOAD:dwmapi.dll" ]
208 "gl_image_io_surface.cc",
209 "gl_image_io_surface.h",
215 "IOSurface.framework",
221 "gl_egl_api_implementation.cc",
222 "gl_egl_api_implementation.h",
223 "gl_image_android_native_buffer.cc",
224 "gl_image_android_native_buffer.h",
225 "gl_image_surface_texture.cc",
226 "gl_image_surface_texture.h",
230 "GL_GLEXT_PROTOTYPES",
231 "EGL_EGLEXT_PROTOTYPES",
242 "gl_context_ozone.cc",
243 "gl_egl_api_implementation.cc",
244 "gl_egl_api_implementation.h",
245 "gl_implementation_ozone.cc",
246 "gl_surface_ozone.cc",
254 # TODO(GYP) enable this dependency once its written.
255 #if (is_android && !android_webview_build) {
256 # deps += [ "//ui/android:ui_java" ]
260 action("generate_gl_bindings") {
261 visibility = ":*" # Only targets in this file can see this.
263 script = "generate_bindings.py"
265 # TODO(brettw) make this dynamic. The GYP version calls "generate_bindings.py
266 # --inputs" to get the list here. What should happen is that the script
267 # should generate a .d file, which we should declare here. That will
268 # eliminate the need bot both hardcoding the list here or calling the script
271 "EGL/eglextchromium.h",
272 "GL/glextchromium.h",
273 "//third_party/mesa/src/include/GL/glext.h",
274 "//third_party/khronos/GLES2/gl2ext.h",
275 "//gpu/GLES2/gl2chromium.h",
276 "//gpu/GLES2/gl2extchromium.h",
277 "//third_party/khronos/EGL/eglext.h",
278 "//third_party/mesa/src/include/GL/wglext.h",
279 "//third_party/mesa/src/include/GL/glx.h",
280 "//third_party/mesa/src/include/GL/glxext.h",
284 "$gl_binding_output_dir/gl_bindings_autogen_egl.cc",
285 "$gl_binding_output_dir/gl_bindings_autogen_egl.h",
286 "$gl_binding_output_dir/gl_bindings_api_autogen_egl.h",
287 "$gl_binding_output_dir/gl_bindings_autogen_gl.cc",
288 "$gl_binding_output_dir/gl_bindings_autogen_gl.h",
289 "$gl_binding_output_dir/gl_bindings_api_autogen_gl.h",
290 "$gl_binding_output_dir/gl_bindings_autogen_glx.cc",
291 "$gl_binding_output_dir/gl_bindings_autogen_glx.h",
292 "$gl_binding_output_dir/gl_bindings_api_autogen_glx.h",
293 "$gl_binding_output_dir/gl_bindings_autogen_mock.cc",
294 "$gl_binding_output_dir/gl_bindings_autogen_mock.h",
295 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.cc",
296 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.h",
297 "$gl_binding_output_dir/gl_bindings_api_autogen_osmesa.h",
298 "$gl_binding_output_dir/gl_bindings_autogen_wgl.cc",
299 "$gl_binding_output_dir/gl_bindings_autogen_wgl.h",
300 "$gl_binding_output_dir/gl_bindings_api_autogen_wgl.h",
301 "$gl_binding_output_dir/gl_mock_autogen_gl.h",
306 rebase_path("//third_party/khronos", root_build_dir) + ":" +
307 rebase_path("//third_party/mesa/src/include", root_build_dir) + ":" +
308 rebase_path("//ui/gl", root_build_dir) + ":" +
309 rebase_path("//gpu", root_build_dir),
310 rebase_path(gl_binding_output_dir, root_build_dir),
314 config("gl_unittest_utils_config") {
315 include_dirs = [ gl_binding_output_dir ]
318 source_set("gl_unittest_utils") {
322 "$gl_binding_output_dir/gl_bindings_autogen_mock.cc",
323 "$gl_binding_output_dir/gl_bindings_autogen_mock.h",
324 "$gl_binding_output_dir/gl_mock_autogen_gl.h",
327 configs += [ "//third_party/khronos:khronos_headers" ]
328 direct_dependent_configs = [ ":gl_unittest_utils_config" ]
337 generate_jar_jni("surface_jni_headers") {
338 jni_package = "ui/gl"
339 classes = [ "android/view/Surface.class" ]
342 generate_jni("gl_jni_headers") {
343 deps = [ ":surface_jni_headers" ]
344 forward_dependent_configs_from = [ ":surface_jni_headers" ]
346 "../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java",
347 "../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java",
349 jni_package = "ui/gl"