chromium/ui/gl/init/BUILD.gn

# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/ui.gni")
import("//ui/gl/features.gni")

component("init") {
  output_name = "gl_init"

  public = [
    "create_gr_gl_interface.h",
    "gl_display_initializer.h",
    "gl_factory.h",
  ]

  sources = [
    "create_gr_gl_interface.cc",
    "create_gr_gl_interface.h",
    "gl_display_initializer.cc",
    "gl_factory.cc",
    "gl_factory.h",
    "gl_init_export.h",
    "gl_initializer.h",
  ]
  defines = [ "GL_INIT_IMPLEMENTATION" ]

  deps = [
    "//base",
    "//mojo/public/cpp/bindings",
    "//ui/base:features",
    "//ui/gfx",
    "//ui/gl:buildflags",
  ]

  public_deps = [ "//ui/gl" ]

  if (use_static_angle) {
    sources += [ "gl_initializer_angle.cc" ]
    deps += [ "//third_party/angle:libEGL_static" ]
  }

  if (is_android) {
    sources += [
      "gl_factory_android.cc",
      "gl_initializer_android.cc",
    ]
  } else if (is_win && !use_ozone) {
    sources += [
      "gl_factory_win.cc",
      "gl_initializer_win.cc",
    ]

    libs = [ "dwmapi.lib" ]
    ldflags = [ "/DELAYLOAD:dwmapi.dll" ]
  } else if (is_mac) {
    sources += [
      "gl_factory_mac.cc",
      "gl_initializer_mac.cc",
    ]

    frameworks = [ "OpenGL.framework" ]

    defines += [ "GL_SILENCE_DEPRECATION" ]
  } else if (use_ozone) {
    sources += [
      "gl_display_egl_util_ozone.cc",
      "gl_display_egl_util_ozone.h",
      "gl_factory_ozone.cc",
      "gl_initializer_ozone.cc",
      "ozone_util.h",
    ]

    deps += [ "//ui/ozone" ]
  } else if (is_ios) {
    sources += [
      "gl_factory_ios.mm",
      "gl_initializer_ios.cc",
    ]
  }
}