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",
53 "gl_gl_api_implementation.cc",
54 "gl_gl_api_implementation.h",
57 "gl_image_android.cc",
64 "gl_implementation.cc",
65 "gl_implementation.h",
66 "gl_implementation_android.cc",
67 "gl_implementation_mac.cc",
68 "gl_implementation_win.cc",
69 "gl_osmesa_api_implementation.cc",
70 "gl_osmesa_api_implementation.h",
73 "gl_state_restorer.cc",
74 "gl_state_restorer.h",
77 "gl_surface_android.cc",
82 "gl_surface_osmesa.cc",
83 "gl_surface_osmesa.h",
88 "gpu_switching_manager.cc",
89 "gpu_switching_manager.h",
92 "scoped_make_current.cc",
93 "scoped_make_current.h",
94 "sync_control_vsync_provider.cc",
95 "sync_control_vsync_provider.h",
96 "$gl_binding_output_dir/gl_bindings_autogen_gl.cc",
97 "$gl_binding_output_dir/gl_bindings_autogen_gl.h",
98 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.cc",
99 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.h",
102 defines = [ "GL_IMPLEMENTATION" ]
105 "//third_party/switfshader/include",
106 "//third_party/khronos",
107 "//third_party/mesa/src/include",
108 gl_binding_output_dir,
111 all_dependent_configs = [ ":gl_config" ]
114 ":generate_gl_bindings",
116 "//base/third_party/dynamic_annotations",
117 "//gpu/command_buffer/common",
118 "//third_party/mesa:mesa_headers",
120 "//ui/events/platform",
125 # TODO(GYP) hook up once this is converted.
126 forward_dependent_configs_from = [ "//third_party/mesa:mesa_headers" ]
128 if (is_win || is_android || is_linux) {
138 "$gl_binding_output_dir/gl_bindings_autogen_egl.cc",
139 "$gl_binding_output_dir/gl_bindings_autogen_egl.h",
142 if (is_android || is_linux) {
144 "gl_implementation_osmesa.cc",
145 "gl_implementation_osmesa.h",
153 "gl_glx_api_implementation.cc",
154 "gl_glx_api_implementation.h",
158 "gl_implementation_x11.cc",
162 "gl_egl_api_implementation.cc",
163 "gl_egl_api_implementation.h",
164 "$gl_binding_output_dir/gl_bindings_autogen_glx.cc",
165 "$gl_binding_output_dir/gl_bindings_autogen_glx.h",
169 "//build/config/linux:x11",
170 "//build/config/linux:xcomposite",
171 "//build/config/linux:xext",
182 "gl_egl_api_implementation.cc",
183 "gl_egl_api_implementation.h",
186 "gl_wgl_api_implementation.cc",
187 "gl_wgl_api_implementation.h",
188 "$gl_binding_output_dir/gl_bindings_autogen_wgl.cc",
189 "$gl_binding_output_dir/gl_bindings_autogen_wgl.h",
192 libs = [ "dwmapi.lib" ]
193 ldflags = [ "/DELAYLOAD:dwmapi.dll" ]
199 "gl_image_io_surface.cc",
200 "gl_image_io_surface.h",
207 libs = [ "OpenGL.framework" ]
211 "gl_egl_api_implementation.cc",
212 "gl_egl_api_implementation.h",
213 "gl_image_android_native_buffer.cc",
214 "gl_image_android_native_buffer.h",
215 "gl_image_surface_texture.cc",
216 "gl_image_surface_texture.h",
220 "GL_GLEXT_PROTOTYPES",
221 "EGL_EGLEXT_PROTOTYPES",
232 "gl_context_ozone.cc",
234 "gl_implementation_ozone.cc",
235 "gl_surface_ozone.cc",
243 # TODO(GYP) enable this dependency once its written.
244 #if (is_android && !android_webview_build) {
245 # deps += [ "//ui/android:ui_java" ]
249 action("generate_gl_bindings") {
250 visibility = ":*" # Only targets in this file can see this.
252 script = "generate_bindings.py"
254 # TODO(brettw) make this dynamic. The GYP version calls "generate_bindings.py
255 # --inputs" to get the list here. What should happen is that the script
256 # should generate a .d file, which we should declare here. That will
257 # eliminate the need bot both hardcoding the list here or calling the script
260 "EGL/eglextchromium.h",
261 "GL/glextchromium.h",
262 "//third_party/mesa/src/include/GL/glext.h",
263 "//third_party/khronos/GLES2/gl2ext.h",
264 "//gpu/GLES2/gl2chromium.h",
265 "//gpu/GLES2/gl2extchromium.h",
266 "//third_party/khronos/EGL/eglext.h",
267 "//third_party/mesa/src/include/GL/wglext.h",
268 "//third_party/mesa/src/include/GL/glx.h",
269 "//third_party/mesa/src/include/GL/glxext.h",
273 "$gl_binding_output_dir/gl_bindings_autogen_egl.cc",
274 "$gl_binding_output_dir/gl_bindings_autogen_egl.h",
275 "$gl_binding_output_dir/gl_bindings_api_autogen_egl.h",
276 "$gl_binding_output_dir/gl_bindings_autogen_gl.cc",
277 "$gl_binding_output_dir/gl_bindings_autogen_gl.h",
278 "$gl_binding_output_dir/gl_bindings_api_autogen_gl.h",
279 "$gl_binding_output_dir/gl_bindings_autogen_glx.cc",
280 "$gl_binding_output_dir/gl_bindings_autogen_glx.h",
281 "$gl_binding_output_dir/gl_bindings_api_autogen_glx.h",
282 "$gl_binding_output_dir/gl_bindings_autogen_mock.cc",
283 "$gl_binding_output_dir/gl_bindings_autogen_mock.h",
284 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.cc",
285 "$gl_binding_output_dir/gl_bindings_autogen_osmesa.h",
286 "$gl_binding_output_dir/gl_bindings_api_autogen_osmesa.h",
287 "$gl_binding_output_dir/gl_bindings_autogen_wgl.cc",
288 "$gl_binding_output_dir/gl_bindings_autogen_wgl.h",
289 "$gl_binding_output_dir/gl_bindings_api_autogen_wgl.h",
290 "$gl_binding_output_dir/gl_mock_autogen_gl.h",
295 rebase_path("//third_party/khronos", root_build_dir) + ":" +
296 rebase_path("//third_party/mesa/src/include", root_build_dir) + ":" +
297 rebase_path("//ui/gl", root_build_dir) + ":" +
298 rebase_path("//gpu", root_build_dir),
299 rebase_path(gl_binding_output_dir, root_build_dir),
303 config("gl_unittest_utils_config") {
304 include_dirs = [ gl_binding_output_dir ]
307 source_set("gl_unittest_utils") {
311 "$gl_binding_output_dir/gl_bindings_autogen_mock.cc",
312 "$gl_binding_output_dir/gl_bindings_autogen_mock.h",
313 "$gl_binding_output_dir/gl_mock_autogen_gl.h",
316 configs += [ "//third_party/khronos:khronos_headers" ]
317 direct_dependent_configs = [ ":gl_unittest_utils_config" ]
326 generate_jar_jni("surface_jni_headers") {
327 jni_package = "ui/gl"
328 classes = [ "android/view/Surface.class" ]
331 generate_jni("gl_jni_headers") {
332 deps = [ ":surface_jni_headers" ]
333 forward_dependent_configs_from = [ ":surface_jni_headers" ]
335 "../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java",
336 "../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java",
338 jni_package = "ui/gl"