1# Copyright (c) 2012 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. 4 5{ 6 'variables': { 7 'chromium_code': 1, 8 }, 9 10 'targets': [ 11 { 12 'target_name': 'gl', 13 'type': '<(component)', 14 'product_name': 'gl_wrapper', # Avoid colliding with OS X's libGL.dylib 15 'dependencies': [ 16 '<(DEPTH)/base/base.gyp:base', 17 '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', 18 '<(DEPTH)/gpu/command_buffer/command_buffer.gyp:gles2_utils', 19 '<(DEPTH)/skia/skia.gyp:skia', 20 '<(DEPTH)/third_party/mesa/mesa.gyp:mesa_headers', 21 '<(DEPTH)/ui/gfx/gfx.gyp:gfx', 22 '<(DEPTH)/ui/gfx/gfx.gyp:gfx_geometry', 23 ], 24 'variables': { 25 'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gl', 26 }, 27 'defines': [ 28 'GL_IMPLEMENTATION', 29 ], 30 'include_dirs': [ 31 '<(DEPTH)/third_party/swiftshader/include', 32 '<(DEPTH)/third_party/khronos', 33 '<(DEPTH)/third_party/mesa/src/include', 34 '<(gl_binding_output_dir)', 35 ], 36 'direct_dependent_settings': { 37 'include_dirs': [ 38 '<(gl_binding_output_dir)', 39 ], 40 }, 41 'export_dependent_settings': [ 42 '<(DEPTH)/third_party/mesa/mesa.gyp:mesa_headers', 43 ], 44 'sources': [ 45 'android/gl_jni_registrar.cc', 46 'android/gl_jni_registrar.h', 47 'android/scoped_java_surface.cc', 48 'android/scoped_java_surface.h', 49 'android/surface_texture.cc', 50 'android/surface_texture.h', 51 'android/surface_texture_listener.cc', 52 'android/surface_texture_listener.h', 53 'android/surface_texture_tracker.cc', 54 'android/surface_texture_tracker.h', 55 'gl_bindings.h', 56 'gl_bindings_skia_in_process.cc', 57 'gl_bindings_skia_in_process.h', 58 'gl_context.cc', 59 'gl_context.h', 60 'gl_context_android.cc', 61 'gl_context_mac.mm', 62 'gl_context_ozone.cc', 63 'gl_context_osmesa.cc', 64 'gl_context_osmesa.h', 65 'gl_context_stub.cc', 66 'gl_context_stub.h', 67 'gl_context_stub_with_extensions.cc', 68 'gl_context_stub_with_extensions.h', 69 'gl_context_win.cc', 70 'gl_context_x11.cc', 71 'gl_export.h', 72 'gl_fence.cc', 73 'gl_fence.h', 74 'gl_fence_arb.cc', 75 'gl_fence_arb.h', 76 'gl_fence_nv.cc', 77 'gl_fence_nv.h', 78 'gl_gl_api_implementation.cc', 79 'gl_gl_api_implementation.h', 80 'gl_image.cc', 81 'gl_image.h', 82 'gl_image_android.cc', 83 'gl_image_mac.cc', 84 'gl_image_ozone.cc', 85 'gl_image_shm.cc', 86 'gl_image_shm.h', 87 'gl_image_stub.cc', 88 'gl_image_stub.h', 89 'gl_image_win.cc', 90 'gl_image_x11.cc', 91 'gl_implementation.cc', 92 'gl_implementation.h', 93 'gl_implementation_android.cc', 94 'gl_implementation_ozone.cc', 95 'gl_implementation_mac.cc', 96 'gl_implementation_win.cc', 97 'gl_implementation_x11.cc', 98 'gl_osmesa_api_implementation.cc', 99 'gl_osmesa_api_implementation.h', 100 'gl_share_group.cc', 101 'gl_share_group.h', 102 'gl_state_restorer.cc', 103 'gl_state_restorer.h', 104 'gl_surface.cc', 105 'gl_surface.h', 106 'gl_surface_android.cc', 107 'gl_surface_mac.cc', 108 'gl_surface_stub.cc', 109 'gl_surface_stub.h', 110 'gl_surface_win.cc', 111 'gl_surface_x11.cc', 112 'gl_surface_osmesa.cc', 113 'gl_surface_osmesa.h', 114 'gl_surface_ozone.cc', 115 'gl_switches.cc', 116 'gl_switches.h', 117 'gl_version_info.cc', 118 'gl_version_info.h', 119 'gpu_switching_manager.cc', 120 'gpu_switching_manager.h', 121 'scoped_binders.cc', 122 'scoped_binders.h', 123 'scoped_make_current.cc', 124 'scoped_make_current.h', 125 'sync_control_vsync_provider.cc', 126 'sync_control_vsync_provider.h', 127 '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc', 128 '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h', 129 '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc', 130 '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h', 131 ], 132 # hard_dependency is necessary for this target because it has actions 133 # that generate header files included by dependent targets. The header 134 # files must be generated before the dependents are compiled. The usual 135 # semantics are to allow the two targets to build concurrently. 136 'hard_dependency': 1, 137 'actions': [ 138 { 139 'action_name': 'generate_gl_bindings', 140 'variables': { 141 'generator_path': 'generate_bindings.py', 142 # Prefer khronos EGL/GLES headers by listing that path first. 143 'header_paths': '../../third_party/khronos:../../third_party/mesa/src/include:.:../../gpu', 144 }, 145 'inputs': [ 146 '<(generator_path)', 147 '<!@(python <(generator_path) --header-paths=<(header_paths) --inputs)', 148 ], 149 'outputs': [ 150 '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc', 151 '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h', 152 '<(gl_binding_output_dir)/gl_bindings_api_autogen_egl.h', 153 '<(gl_binding_output_dir)/gl_bindings_autogen_gl.cc', 154 '<(gl_binding_output_dir)/gl_bindings_autogen_gl.h', 155 '<(gl_binding_output_dir)/gl_bindings_api_autogen_gl.h', 156 '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc', 157 '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h', 158 '<(gl_binding_output_dir)/gl_bindings_api_autogen_glx.h', 159 '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc', 160 '<(gl_binding_output_dir)/gl_bindings_autogen_mock.h', 161 '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.cc', 162 '<(gl_binding_output_dir)/gl_bindings_autogen_osmesa.h', 163 '<(gl_binding_output_dir)/gl_bindings_api_autogen_osmesa.h', 164 '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc', 165 '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h', 166 '<(gl_binding_output_dir)/gl_bindings_api_autogen_wgl.h', 167 '<(gl_binding_output_dir)/gl_mock_autogen_gl.h', 168 ], 169 'action': [ 170 'python', 171 '<(generator_path)', 172 '--header-paths=<(header_paths)', 173 '<(gl_binding_output_dir)', 174 ], 175 }, 176 ], 177 'conditions': [ 178 ['OS in ("win", "android", "linux")', { 179 'sources': [ 180 'egl_util.cc', 181 'egl_util.h', 182 'gl_context_egl.cc', 183 'gl_context_egl.h', 184 'gl_fence_egl.cc', 185 'gl_fence_egl.h', 186 'gl_image_egl.cc', 187 'gl_image_egl.h', 188 'gl_surface_egl.cc', 189 'gl_surface_egl.h', 190 'gl_egl_api_implementation.cc', 191 'gl_egl_api_implementation.h', 192 '<(gl_binding_output_dir)/gl_bindings_autogen_egl.cc', 193 '<(gl_binding_output_dir)/gl_bindings_autogen_egl.h', 194 ], 195 'include_dirs': [ 196 '<(DEPTH)/third_party/khronos', 197 ], 198 }], 199 ['OS in ("android", "linux")', { 200 'sources': [ 201 'gl_implementation_osmesa.cc', 202 'gl_implementation_osmesa.h', 203 ], 204 }], 205 ['use_x11 == 1', { 206 'sources': [ 207 'gl_context_glx.cc', 208 'gl_context_glx.h', 209 'gl_glx_api_implementation.cc', 210 'gl_glx_api_implementation.h', 211 'gl_image_glx.cc', 212 'gl_image_glx.h', 213 'gl_surface_glx.cc', 214 'gl_surface_glx.h', 215 'gl_egl_api_implementation.cc', 216 'gl_egl_api_implementation.h', 217 '<(gl_binding_output_dir)/gl_bindings_autogen_glx.cc', 218 '<(gl_binding_output_dir)/gl_bindings_autogen_glx.h', 219 ], 220 'all_dependent_settings': { 221 'defines': [ 222 'GL_GLEXT_PROTOTYPES', 223 ], 224 }, 225 'dependencies': [ 226 '<(DEPTH)/build/linux/system.gyp:x11', 227 '<(DEPTH)/build/linux/system.gyp:xcomposite', 228 '<(DEPTH)/build/linux/system.gyp:xext', 229 '<(DEPTH)/ui/events/platform/events_platform.gyp:events_platform', 230 '<(DEPTH)/ui/gfx/x/gfx_x11.gyp:gfx_x11', 231 ], 232 }], 233 ['OS=="win"', { 234 'sources': [ 235 'gl_context_wgl.cc', 236 'gl_context_wgl.h', 237 'gl_egl_api_implementation.cc', 238 'gl_egl_api_implementation.h', 239 'gl_surface_wgl.cc', 240 'gl_surface_wgl.h', 241 'gl_wgl_api_implementation.cc', 242 'gl_wgl_api_implementation.h', 243 '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.cc', 244 '<(gl_binding_output_dir)/gl_bindings_autogen_wgl.h', 245 ], 246 'msvs_settings': { 247 'VCLinkerTool': { 248 'DelayLoadDLLs': [ 249 'dwmapi.dll', 250 ], 251 'AdditionalDependencies': [ 252 'dwmapi.lib', 253 ], 254 }, 255 }, 256 'link_settings': { 257 'libraries': [ 258 '-ldwmapi.lib', 259 ], 260 }, 261 }], 262 ['OS=="mac"', { 263 'sources': [ 264 'gl_context_cgl.cc', 265 'gl_context_cgl.h', 266 'gl_image_io_surface.cc', 267 'gl_image_io_surface.h', 268 'scoped_cgl.cc', 269 'scoped_cgl.h', 270 ], 271 'link_settings': { 272 'libraries': [ 273 '$(SDKROOT)/System/Library/Frameworks/IOSurface.framework', 274 '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework', 275 ], 276 }, 277 }], 278 ['OS=="android"', { 279 'dependencies': [ 280 'gl_jni_headers', 281 ], 282 'sources': [ 283 'gl_image_android_native_buffer.cc', 284 'gl_image_android_native_buffer.h', 285 'gl_image_surface_texture.cc', 286 'gl_image_surface_texture.h', 287 ], 288 'link_settings': { 289 'libraries': [ 290 '-landroid', 291 ], 292 }, 293 'sources!': [ 294 'system_monitor_posix.cc', 295 ], 296 'defines': [ 297 'GL_GLEXT_PROTOTYPES', 298 'EGL_EGLEXT_PROTOTYPES', 299 ], 300 }], 301 ['OS!="android"', { 302 'sources/': [ ['exclude', '^android/'] ], 303 }], 304 ['use_ozone==1', { 305 'dependencies': [ 306 '../ozone/ozone.gyp:ozone', 307 ], 308 }], 309 ['OS=="android" and android_webview_build==0', { 310 'dependencies': [ 311 '../android/ui_android.gyp:ui_java', 312 ], 313 }], 314 ], 315 }, 316 { 317 'target_name': 'gl_unittest_utils', 318 'type': 'static_library', 319 'variables': { 320 'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gl', 321 }, 322 'dependencies': [ 323 '../../testing/gmock.gyp:gmock', 324 '../../third_party/khronos/khronos.gyp:khronos_headers', 325 'gl', 326 ], 327 'include_dirs': [ 328 '<(gl_binding_output_dir)', 329 '../..', 330 ], 331 'direct_dependent_settings': { 332 'include_dirs': [ 333 '<(gl_binding_output_dir)', 334 ], 335 }, 336 'sources': [ 337 'gl_mock.h', 338 'gl_mock.cc', 339 '<(gl_binding_output_dir)/gl_bindings_autogen_mock.cc', 340 '<(gl_binding_output_dir)/gl_bindings_autogen_mock.h', 341 '<(gl_binding_output_dir)/gl_mock_autogen_gl.h', 342 ], 343 }, 344 ], 345 'conditions': [ 346 ['OS=="android"' , { 347 'targets': [ 348 { 349 'target_name': 'surface_jni_headers', 350 'type': 'none', 351 'variables': { 352 'jni_gen_package': 'ui/gl', 353 'input_java_class': 'android/view/Surface.class', 354 }, 355 'includes': [ '../../build/jar_file_jni_generator.gypi' ], 356 }, 357 { 358 'target_name': 'gl_jni_headers', 359 'type': 'none', 360 'dependencies': [ 361 'surface_jni_headers', 362 ], 363 'sources': [ 364 '../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java', 365 '../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java', 366 ], 367 'variables': { 368 'jni_gen_package': 'ui/gl', 369 }, 370 'includes': [ '../../build/jni_generator.gypi' ], 371 }, 372 ], 373 }], 374 ], 375} 376