| OLD | NEW | 
|    1 # Copyright 2014 The Chromium Authors. All rights reserved. |    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 |    2 # Use of this source code is governed by a BSD-style license that can be | 
|    3 # found in the LICENSE file. |    3 # found in the LICENSE file. | 
|    4  |    4  | 
|    5 import("//build/config/ui.gni") |    5 import("//build/config/ui.gni") | 
|    6 if (is_android) { |    6 if (is_android) { | 
|    7   import("//build/config/android/config.gni") |    7   import("//build/config/android/config.gni") | 
|    8   import("//build/config/android/rules.gni") |    8   import("//build/config/android/rules.gni") | 
|    9 } |    9 } | 
|   10  |   10  | 
|   11 gl_binding_output_dir = target_gen_dir |  | 
|   12  |  | 
|   13 config("gl_config") { |   11 config("gl_config") { | 
|   14   if (use_x11) { |   12   if (use_x11) { | 
|   15     defines = [ "GL_GLEXT_PROTOTYPES" ] |   13     defines = [ "GL_GLEXT_PROTOTYPES" ] | 
|   16   } |   14   } | 
|   17  |  | 
|   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 ] |  | 
|   21 } |   15 } | 
|   22  |   16  | 
|   23 component("gl") { |   17 component("gl") { | 
|   24   output_name = "gl_wrapper"  # Avoid colliding with OS X"s libGL.dylib. |   18   output_name = "gl_wrapper"  # Avoid colliding with OS X"s libGL.dylib. | 
|   25  |   19  | 
|   26   sources = [ |   20   sources = [ | 
|   27     "android/gl_jni_registrar.cc", |   21     "android/gl_jni_registrar.cc", | 
|   28     "android/gl_jni_registrar.h", |   22     "android/gl_jni_registrar.h", | 
|   29     "android/scoped_java_surface.cc", |   23     "android/scoped_java_surface.cc", | 
|   30     "android/scoped_java_surface.h", |   24     "android/scoped_java_surface.h", | 
|   31     "android/surface_texture.cc", |   25     "android/surface_texture.cc", | 
|   32     "android/surface_texture.h", |   26     "android/surface_texture.h", | 
|   33     "android/surface_texture_listener.cc", |   27     "android/surface_texture_listener.cc", | 
|   34     "android/surface_texture_listener.h", |   28     "android/surface_texture_listener.h", | 
|   35     "gl_bindings.h", |   29     "gl_bindings.h", | 
 |   30     "gl_bindings_autogen_gl.cc", | 
 |   31     "gl_bindings_autogen_gl.h", | 
 |   32     "gl_bindings_autogen_osmesa.cc", | 
 |   33     "gl_bindings_autogen_osmesa.h", | 
|   36     "gl_bindings_skia_in_process.cc", |   34     "gl_bindings_skia_in_process.cc", | 
|   37     "gl_bindings_skia_in_process.h", |   35     "gl_bindings_skia_in_process.h", | 
|   38     "gl_context.cc", |   36     "gl_context.cc", | 
|   39     "gl_context.h", |   37     "gl_context.h", | 
|   40     "gl_context_android.cc", |   38     "gl_context_android.cc", | 
|   41     "gl_context_mac.mm", |   39     "gl_context_mac.mm", | 
|   42     "gl_context_osmesa.cc", |   40     "gl_context_osmesa.cc", | 
|   43     "gl_context_osmesa.h", |   41     "gl_context_osmesa.h", | 
|   44     "gl_context_stub.cc", |   42     "gl_context_stub.cc", | 
|   45     "gl_context_stub.h", |   43     "gl_context_stub.h", | 
|   46     "gl_context_stub_with_extensions.cc", |   44     "gl_context_stub_with_extensions.cc", | 
|   47     "gl_context_stub_with_extensions.h", |   45     "gl_context_stub_with_extensions.h", | 
|   48     "gl_context_win.cc", |   46     "gl_context_win.cc", | 
 |   47     "gl_enums.cc", | 
 |   48     "gl_enums.h", | 
 |   49     "gl_enums_implementation_autogen.h", | 
|   49     "gl_export.h", |   50     "gl_export.h", | 
|   50     "gl_fence.cc", |   51     "gl_fence.cc", | 
|   51     "gl_fence.h", |   52     "gl_fence.h", | 
|   52     "gl_fence_arb.cc", |   53     "gl_fence_arb.cc", | 
|   53     "gl_fence_arb.h", |   54     "gl_fence_arb.h", | 
|   54     "gl_fence_nv.cc", |   55     "gl_fence_nv.cc", | 
|   55     "gl_fence_nv.h", |   56     "gl_fence_nv.h", | 
|   56     "gl_gl_api_implementation.cc", |   57     "gl_gl_api_implementation.cc", | 
|   57     "gl_gl_api_implementation.h", |   58     "gl_gl_api_implementation.h", | 
|   58     "gl_image.h", |   59     "gl_image.h", | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|   89     "gl_version_info.cc", |   90     "gl_version_info.cc", | 
|   90     "gl_version_info.h", |   91     "gl_version_info.h", | 
|   91     "gpu_switching_manager.cc", |   92     "gpu_switching_manager.cc", | 
|   92     "gpu_switching_manager.h", |   93     "gpu_switching_manager.h", | 
|   93     "scoped_binders.cc", |   94     "scoped_binders.cc", | 
|   94     "scoped_binders.h", |   95     "scoped_binders.h", | 
|   95     "scoped_make_current.cc", |   96     "scoped_make_current.cc", | 
|   96     "scoped_make_current.h", |   97     "scoped_make_current.h", | 
|   97     "sync_control_vsync_provider.cc", |   98     "sync_control_vsync_provider.cc", | 
|   98     "sync_control_vsync_provider.h", |   99     "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", |  | 
|  103   ] |  100   ] | 
|  104  |  101  | 
|  105   defines = [ "GL_IMPLEMENTATION" ] |  102   defines = [ "GL_IMPLEMENTATION" ] | 
|  106  |  103  | 
|  107   include_dirs = [ |  104   include_dirs = [ | 
|  108     "//third_party/switfshader/include", |  105     "//third_party/switfshader/include", | 
|  109     "//third_party/khronos", |  106     "//third_party/khronos", | 
|  110     "//third_party/mesa/src/include", |  107     "//third_party/mesa/src/include", | 
|  111     gl_binding_output_dir, |  | 
|  112   ] |  108   ] | 
|  113  |  109  | 
|  114   all_dependent_configs = [ ":gl_config" ] |  110   all_dependent_configs = [ ":gl_config" ] | 
|  115  |  111  | 
|  116   deps = [ |  112   deps = [ | 
|  117     ":generate_gl_bindings", |  | 
|  118     "//base/third_party/dynamic_annotations", |  113     "//base/third_party/dynamic_annotations", | 
|  119     "//gpu/command_buffer/common", |  114     "//gpu/command_buffer/common", | 
|  120     "//skia", |  115     "//skia", | 
|  121   ] |  116   ] | 
|  122   public_deps = [ |  117   public_deps = [ | 
|  123     "//base", |  118     "//base", | 
|  124     "//third_party/mesa:mesa_headers", |  119     "//third_party/mesa:mesa_headers", | 
|  125     "//ui/events/platform", |  120     "//ui/events/platform", | 
|  126     "//ui/gfx", |  121     "//ui/gfx", | 
|  127     "//ui/gfx/geometry", |  122     "//ui/gfx/geometry", | 
|  128   ] |  123   ] | 
|  129  |  124  | 
|  130   if (is_win || is_android || is_linux) { |  125   if (is_win || is_android || is_linux) { | 
|  131     sources += [ |  126     sources += [ | 
|  132       "egl_util.cc", |  127       "egl_util.cc", | 
|  133       "egl_util.h", |  128       "egl_util.h", | 
 |  129       "gl_bindings_autogen_egl.cc", | 
 |  130       "gl_bindings_autogen_egl.h", | 
|  134       "gl_context_egl.cc", |  131       "gl_context_egl.cc", | 
|  135       "gl_context_egl.h", |  132       "gl_context_egl.h", | 
|  136       "gl_fence_egl.cc", |  133       "gl_fence_egl.cc", | 
|  137       "gl_fence_egl.h", |  134       "gl_fence_egl.h", | 
|  138       "gl_image_egl.cc", |  135       "gl_image_egl.cc", | 
|  139       "gl_image_egl.h", |  136       "gl_image_egl.h", | 
|  140       "gl_surface_egl.cc", |  137       "gl_surface_egl.cc", | 
|  141       "gl_surface_egl.h", |  138       "gl_surface_egl.h", | 
|  142       "$gl_binding_output_dir/gl_bindings_autogen_egl.cc", |  | 
|  143       "$gl_binding_output_dir/gl_bindings_autogen_egl.h", |  | 
|  144     ] |  139     ] | 
|  145   } |  140   } | 
|  146   if (is_android || is_linux) { |  141   if (is_android || is_linux) { | 
|  147     sources += [ |  142     sources += [ | 
|  148       "gl_implementation_osmesa.cc", |  143       "gl_implementation_osmesa.cc", | 
|  149       "gl_implementation_osmesa.h", |  144       "gl_implementation_osmesa.h", | 
|  150     ] |  145     ] | 
|  151   } |  146   } | 
|  152   if (is_linux) { |  147   if (is_linux) { | 
|  153     deps += [ "//third_party/libevent" ] |  148     deps += [ "//third_party/libevent" ] | 
|  154     sources += [ |  149     sources += [ | 
|  155       "gl_image_linux_dma_buffer.cc", |  150       "gl_image_linux_dma_buffer.cc", | 
|  156       "gl_image_linux_dma_buffer.h", |  151       "gl_image_linux_dma_buffer.h", | 
|  157     ] |  152     ] | 
|  158   } |  153   } | 
|  159   if (use_x11) { |  154   if (use_x11) { | 
|  160     sources += [ |  155     sources += [ | 
 |  156       "gl_bindings_autogen_glx.cc", | 
 |  157       "gl_bindings_autogen_glx.h", | 
|  161       "gl_context_glx.cc", |  158       "gl_context_glx.cc", | 
|  162       "gl_context_glx.h", |  159       "gl_context_glx.h", | 
|  163       "gl_context_x11.cc", |  160       "gl_context_x11.cc", | 
|  164       "gl_glx_api_implementation.cc", |  161       "gl_glx_api_implementation.cc", | 
|  165       "gl_glx_api_implementation.h", |  162       "gl_glx_api_implementation.h", | 
|  166       "gl_image_glx.cc", |  163       "gl_image_glx.cc", | 
|  167       "gl_image_glx.h", |  164       "gl_image_glx.h", | 
|  168       "gl_implementation_x11.cc", |  165       "gl_implementation_x11.cc", | 
|  169       "gl_surface_glx.cc", |  166       "gl_surface_glx.cc", | 
|  170       "gl_surface_glx.h", |  167       "gl_surface_glx.h", | 
|  171       "gl_surface_x11.cc", |  168       "gl_surface_x11.cc", | 
|  172       "gl_egl_api_implementation.cc", |  169       "gl_egl_api_implementation.cc", | 
|  173       "gl_egl_api_implementation.h", |  170       "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", |  | 
|  176     ] |  171     ] | 
|  177  |  172  | 
|  178     configs += [ |  173     configs += [ | 
|  179       "//build/config/linux:x11", |  174       "//build/config/linux:x11", | 
|  180       "//build/config/linux:xcomposite", |  175       "//build/config/linux:xcomposite", | 
|  181       "//build/config/linux:xext", |  176       "//build/config/linux:xext", | 
|  182     ] |  177     ] | 
|  183  |  178  | 
|  184     deps += [ "//ui/gfx/x" ] |  179     deps += [ "//ui/gfx/x" ] | 
|  185   } |  180   } | 
|  186   if (is_win) { |  181   if (is_win) { | 
|  187     sources += [ |  182     sources += [ | 
 |  183       "gl_bindings_autogen_wgl.cc", | 
 |  184       "gl_bindings_autogen_wgl.h", | 
|  188       "gl_context_wgl.cc", |  185       "gl_context_wgl.cc", | 
|  189       "gl_context_wgl.h", |  186       "gl_context_wgl.h", | 
|  190       "gl_egl_api_implementation.cc", |  187       "gl_egl_api_implementation.cc", | 
|  191       "gl_egl_api_implementation.h", |  188       "gl_egl_api_implementation.h", | 
|  192       "gl_surface_wgl.cc", |  189       "gl_surface_wgl.cc", | 
|  193       "gl_surface_wgl.h", |  190       "gl_surface_wgl.h", | 
|  194       "gl_wgl_api_implementation.cc", |  191       "gl_wgl_api_implementation.cc", | 
|  195       "gl_wgl_api_implementation.h", |  192       "gl_wgl_api_implementation.h", | 
|  196       "$gl_binding_output_dir/gl_bindings_autogen_wgl.cc", |  | 
|  197       "$gl_binding_output_dir/gl_bindings_autogen_wgl.h", |  | 
|  198     ] |  193     ] | 
|  199  |  194  | 
|  200     libs = [ "dwmapi.lib" ] |  195     libs = [ "dwmapi.lib" ] | 
|  201     ldflags = [ "/DELAYLOAD:dwmapi.dll" ] |  196     ldflags = [ "/DELAYLOAD:dwmapi.dll" ] | 
|  202   } |  197   } | 
|  203   if (is_mac) { |  198   if (is_mac) { | 
|  204     sources += [ |  199     sources += [ | 
|  205       "gl_context_cgl.cc", |  200       "gl_context_cgl.cc", | 
|  206       "gl_context_cgl.h", |  201       "gl_context_cgl.h", | 
|  207       "gl_fence_apple.cc", |  202       "gl_fence_apple.cc", | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  227  |  222  | 
|  228     defines += [ |  223     defines += [ | 
|  229       "GL_GLEXT_PROTOTYPES", |  224       "GL_GLEXT_PROTOTYPES", | 
|  230       "EGL_EGLEXT_PROTOTYPES", |  225       "EGL_EGLEXT_PROTOTYPES", | 
|  231     ] |  226     ] | 
|  232  |  227  | 
|  233     libs = [ "android" ] |  228     libs = [ "android" ] | 
|  234  |  229  | 
|  235     deps += [ ":gl_jni_headers" ] |  230     deps += [ ":gl_jni_headers" ] | 
|  236   } |  231   } | 
 |  232   if (use_ozone) { | 
 |  233     sources += [ | 
 |  234       "gl_context_ozone.cc", | 
 |  235       "gl_egl_api_implementation.cc", | 
 |  236       "gl_egl_api_implementation.h", | 
 |  237       "gl_implementation_ozone.cc", | 
 |  238       "gl_surface_ozone.cc", | 
 |  239     ] | 
 |  240     deps += [ | 
 |  241       "//ui/ozone", | 
 |  242       "//ui/ozone:ozone_base", | 
 |  243     ] | 
 |  244   } | 
|  237  |  245  | 
|  238   if (is_android && !is_android_webview_build) { |  246   if (is_android && !is_android_webview_build) { | 
|  239     deps += [ "//ui/android:ui_java" ] |  247     deps += [ "//ui/android:ui_java" ] | 
|  240   } |  248   } | 
|  241 } |  249 } | 
|  242  |  250  | 
|  243 action("generate_gl_bindings") { |  | 
|  244   visibility = [ ":*" ]  # Only targets in this file can see this. |  | 
|  245  |  | 
|  246   script = "generate_bindings.py" |  | 
|  247  |  | 
|  248   # TODO(brettw) make this dynamic. The GYP version calls "generate_bindings.py |  | 
|  249   # --inputs" to get the list here. What should happen is that the script |  | 
|  250   # should generate a .d file, which we should declare here. That will |  | 
|  251   # eliminate the need bot both hardcoding the list here or calling the script |  | 
|  252   # during GN-time. |  | 
|  253   inputs = [ |  | 
|  254     "EGL/eglextchromium.h", |  | 
|  255     "GL/glextchromium.h", |  | 
|  256     "//third_party/mesa/src/include/GL/glext.h", |  | 
|  257     "//third_party/khronos/GLES2/gl2ext.h", |  | 
|  258     "//gpu/GLES2/gl2chromium.h", |  | 
|  259     "//gpu/GLES2/gl2extchromium.h", |  | 
|  260     "//third_party/khronos/EGL/eglext.h", |  | 
|  261     "//third_party/mesa/src/include/GL/wglext.h", |  | 
|  262     "//third_party/mesa/src/include/GL/glx.h", |  | 
|  263     "//third_party/mesa/src/include/GL/glxext.h", |  | 
|  264   ] |  | 
|  265  |  | 
|  266   outputs = [ |  | 
|  267     "$gl_binding_output_dir/gl_bindings_autogen_egl.cc", |  | 
|  268     "$gl_binding_output_dir/gl_bindings_autogen_egl.h", |  | 
|  269     "$gl_binding_output_dir/gl_bindings_api_autogen_egl.h", |  | 
|  270     "$gl_binding_output_dir/gl_bindings_autogen_gl.cc", |  | 
|  271     "$gl_binding_output_dir/gl_bindings_autogen_gl.h", |  | 
|  272     "$gl_binding_output_dir/gl_bindings_api_autogen_gl.h", |  | 
|  273     "$gl_binding_output_dir/gl_bindings_autogen_glx.cc", |  | 
|  274     "$gl_binding_output_dir/gl_bindings_autogen_glx.h", |  | 
|  275     "$gl_binding_output_dir/gl_bindings_api_autogen_glx.h", |  | 
|  276     "$gl_binding_output_dir/gl_bindings_autogen_mock.cc", |  | 
|  277     "$gl_binding_output_dir/gl_bindings_autogen_mock.h", |  | 
|  278     "$gl_binding_output_dir/gl_bindings_autogen_osmesa.cc", |  | 
|  279     "$gl_binding_output_dir/gl_bindings_autogen_osmesa.h", |  | 
|  280     "$gl_binding_output_dir/gl_bindings_api_autogen_osmesa.h", |  | 
|  281     "$gl_binding_output_dir/gl_bindings_autogen_wgl.cc", |  | 
|  282     "$gl_binding_output_dir/gl_bindings_autogen_wgl.h", |  | 
|  283     "$gl_binding_output_dir/gl_bindings_api_autogen_wgl.h", |  | 
|  284     "$gl_binding_output_dir/gl_mock_autogen_gl.h", |  | 
|  285   ] |  | 
|  286  |  | 
|  287   args = [ |  | 
|  288     "--header-paths=" + rebase_path("//third_party/khronos", root_build_dir) + |  | 
|  289         ":" + rebase_path("//third_party/mesa/src/include", root_build_dir) + |  | 
|  290         ":" + rebase_path("//ui/gl", root_build_dir) + ":" + |  | 
|  291         rebase_path("//gpu", root_build_dir), |  | 
|  292     rebase_path(gl_binding_output_dir, root_build_dir), |  | 
|  293   ] |  | 
|  294 } |  | 
|  295  |  | 
|  296 config("gl_unittest_utils_config") { |  | 
|  297   include_dirs = [ gl_binding_output_dir ] |  | 
|  298 } |  | 
|  299  |  | 
|  300 source_set("gl_unittest_utils") { |  251 source_set("gl_unittest_utils") { | 
|  301   testonly = true |  252   testonly = true | 
|  302   sources = [ |  253   sources = [ | 
 |  254     "gl_bindings_autogen_mock.cc", | 
 |  255     "gl_bindings_autogen_mock.h", | 
 |  256     "gl_mock_autogen_gl.h", | 
|  303     "gl_mock.h", |  257     "gl_mock.h", | 
|  304     "gl_mock.cc", |  258     "gl_mock.cc", | 
|  305     "$gl_binding_output_dir/gl_bindings_autogen_mock.cc", |  | 
|  306     "$gl_binding_output_dir/gl_bindings_autogen_mock.h", |  | 
|  307     "$gl_binding_output_dir/gl_mock_autogen_gl.h", |  | 
|  308   ] |  259   ] | 
|  309  |  260  | 
|  310   configs += [ "//third_party/khronos:khronos_headers" ] |  261   configs += [ "//third_party/khronos:khronos_headers" ] | 
|  311   public_configs = [ ":gl_unittest_utils_config" ] |  | 
|  312  |  262  | 
|  313   deps = [ |  263   deps = [ | 
|  314     ":gl", |  264     ":gl", | 
|  315     "//testing/gmock", |  265     "//testing/gmock", | 
|  316   ] |  266   ] | 
|  317 } |  267 } | 
|  318  |  268  | 
|  319 if (is_android) { |  269 if (is_android) { | 
|  320   generate_jar_jni("surface_jni_headers") { |  270   generate_jar_jni("surface_jni_headers") { | 
|  321     jni_package = "ui/gl" |  271     jni_package = "ui/gl" | 
|  322     classes = [ "android/view/Surface.class" ] |  272     classes = [ "android/view/Surface.class" ] | 
|  323   } |  273   } | 
|  324  |  274  | 
|  325   generate_jni("gl_jni_headers") { |  275   generate_jni("gl_jni_headers") { | 
|  326     deps = [ |  276     deps = [ | 
|  327       ":surface_jni_headers", |  277       ":surface_jni_headers", | 
|  328     ] |  278     ] | 
|  329     sources = [ |  279     sources = [ | 
|  330       "../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java", |  280       "../android/java/src/org/chromium/ui/gl/SurfaceTextureListener.java", | 
|  331       "../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
     ", |  281       "../android/java/src/org/chromium/ui/gl/SurfaceTexturePlatformWrapper.java
     ", | 
|  332     ] |  282     ] | 
|  333     jni_package = "ui/gl" |  283     jni_package = "ui/gl" | 
|  334   } |  284   } | 
|  335 } |  285 } | 
| OLD | NEW |