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