# Copyright 2020 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This file houses the build configuration for the ANGLE GL back-ends.

import("../../../../gni/angle.gni")

if (angle_has_build && ozone_platform_gbm) {
  import("//build/config/linux/pkg_config.gni")
}

assert(angle_enable_gl)

declare_args() {
  angle_enable_gl_null = true
}

_gl_backend_sources = [
  "BlitGL.cpp",
  "BlitGL.h",
  "BufferGL.cpp",
  "BufferGL.h",
  "ClearMultiviewGL.cpp",
  "ClearMultiviewGL.h",
  "CompilerGL.cpp",
  "CompilerGL.h",
  "ContextGL.cpp",
  "ContextGL.h",
  "DispatchTableGL_autogen.cpp",
  "DispatchTableGL_autogen.h",
  "DisplayGL.cpp",
  "DisplayGL.h",
  "FenceNVGL.cpp",
  "FenceNVGL.h",
  "FramebufferGL.cpp",
  "FramebufferGL.h",
  "FunctionsGL.cpp",
  "FunctionsGL.h",
  "ImageGL.cpp",
  "ImageGL.h",
  "MemoryObjectGL.cpp",
  "MemoryObjectGL.h",
  "ProgramGL.cpp",
  "ProgramGL.h",
  "ProgramPipelineGL.cpp",
  "ProgramPipelineGL.h",
  "QueryGL.cpp",
  "QueryGL.h",
  "RenderbufferGL.cpp",
  "RenderbufferGL.h",
  "RendererGL.cpp",
  "RendererGL.h",
  "SamplerGL.cpp",
  "SamplerGL.h",
  "SemaphoreGL.cpp",
  "SemaphoreGL.h",
  "ShaderGL.cpp",
  "ShaderGL.h",
  "StateManagerGL.cpp",
  "StateManagerGL.h",
  "SurfaceGL.cpp",
  "SurfaceGL.h",
  "SyncGL.cpp",
  "SyncGL.h",
  "TextureGL.cpp",
  "TextureGL.h",
  "TransformFeedbackGL.cpp",
  "TransformFeedbackGL.h",
  "VertexArrayGL.cpp",
  "VertexArrayGL.h",
  "formatutilsgl.cpp",
  "formatutilsgl.h",
  "functionsgl_enums.h",
  "functionsgl_typedefs.h",
  "renderergl_utils.cpp",
  "renderergl_utils.h",
]

if (is_win) {
  _gl_backend_sources += [
    "../../../third_party/khronos/GL/wglext.h",
    "wgl/ContextWGL.cpp",
    "wgl/ContextWGL.h",
    "wgl/D3DTextureSurfaceWGL.cpp",
    "wgl/D3DTextureSurfaceWGL.h",
    "wgl/DXGISwapChainWindowSurfaceWGL.cpp",
    "wgl/DXGISwapChainWindowSurfaceWGL.h",
    "wgl/DisplayWGL.cpp",
    "wgl/DisplayWGL.h",
    "wgl/FunctionsWGL.cpp",
    "wgl/FunctionsWGL.h",
    "wgl/PbufferSurfaceWGL.cpp",
    "wgl/PbufferSurfaceWGL.h",
    "wgl/RendererWGL.cpp",
    "wgl/RendererWGL.h",
    "wgl/SurfaceWGL.h",
    "wgl/WindowSurfaceWGL.cpp",
    "wgl/WindowSurfaceWGL.h",
    "wgl/functionswgl_typedefs.h",
    "wgl/wgl_utils.cpp",
    "wgl/wgl_utils.h",
  ]
}

if (angle_use_x11) {
  _gl_backend_sources += [
    "glx/DisplayGLX.cpp",
    "glx/DisplayGLX.h",
    "glx/FunctionsGLX.cpp",
    "glx/FunctionsGLX.h",
    "glx/PbufferSurfaceGLX.cpp",
    "glx/PbufferSurfaceGLX.h",
    "glx/PixmapSurfaceGLX.cpp",
    "glx/PixmapSurfaceGLX.h",
    "glx/RendererGLX.cpp",
    "glx/RendererGLX.h",
    "glx/SurfaceGLX.h",
    "glx/WindowSurfaceGLX.cpp",
    "glx/WindowSurfaceGLX.h",
    "glx/functionsglx_typedefs.h",
    "glx/glx_utils.cpp",
    "glx/glx_utils.h",
    "glx/platform_glx.h",
  ]
}

if (is_android || is_linux || is_chromeos) {
  _gl_backend_sources += [
    "egl/ContextEGL.cpp",
    "egl/ContextEGL.h",
    "egl/DisplayEGL.cpp",
    "egl/DisplayEGL.h",
    "egl/DmaBufImageSiblingEGL.cpp",
    "egl/DmaBufImageSiblingEGL.h",
    "egl/ExternalImageSiblingEGL.h",
    "egl/FunctionsEGL.cpp",
    "egl/FunctionsEGL.h",
    "egl/FunctionsEGLDL.cpp",
    "egl/FunctionsEGLDL.h",
    "egl/ImageEGL.cpp",
    "egl/ImageEGL.h",
    "egl/PbufferSurfaceEGL.cpp",
    "egl/PbufferSurfaceEGL.h",
    "egl/RendererEGL.cpp",
    "egl/RendererEGL.h",
    "egl/SurfaceEGL.cpp",
    "egl/SurfaceEGL.h",
    "egl/SyncEGL.cpp",
    "egl/SyncEGL.h",
    "egl/WindowSurfaceEGL.cpp",
    "egl/WindowSurfaceEGL.h",
    "egl/egl_utils.cpp",
    "egl/egl_utils.h",
    "egl/functionsegl_typedefs.h",
  ]
}

if (ozone_platform_gbm) {
  _gl_backend_sources += [
    "egl/gbm/DisplayGbm.cpp",
    "egl/gbm/DisplayGbm.h",
    "egl/gbm/SurfaceGbm.cpp",
    "egl/gbm/SurfaceGbm.h",
  ]

  pkg_config("libdrm") {
    packages = [ "libdrm" ]
  }
}

if (is_android) {
  _gl_backend_sources += [
    "egl/android/DisplayAndroid.cpp",
    "egl/android/DisplayAndroid.h",
    "egl/android/NativeBufferImageSiblingAndroid.cpp",
    "egl/android/NativeBufferImageSiblingAndroid.h",
  ]
}

if (angle_enable_cgl) {
  _gl_backend_sources += [
    "cgl/ContextCGL.cpp",
    "cgl/ContextCGL.h",
    "cgl/DeviceCGL.cpp",
    "cgl/DeviceCGL.h",
    "cgl/DisplayCGL.h",
    "cgl/DisplayCGL.mm",
    "cgl/IOSurfaceSurfaceCGL.cpp",
    "cgl/IOSurfaceSurfaceCGL.h",
    "cgl/PbufferSurfaceCGL.cpp",
    "cgl/PbufferSurfaceCGL.h",
    "cgl/RendererCGL.cpp",
    "cgl/RendererCGL.h",
    "cgl/WindowSurfaceCGL.h",
    "cgl/WindowSurfaceCGL.mm",
  ]
}

if (angle_enable_eagl) {
  _gl_backend_sources += [
    "eagl/ContextEAGL.cpp",
    "eagl/ContextEAGL.h",
    "eagl/DeviceEAGL.cpp",
    "eagl/DeviceEAGL.h",
    "eagl/DisplayEAGL.h",
    "eagl/DisplayEAGL.mm",
    "eagl/FunctionsEAGL.h",
    "eagl/FunctionsEAGL.mm",
    "eagl/IOSurfaceSurfaceEAGL.h",
    "eagl/IOSurfaceSurfaceEAGL.mm",
    "eagl/PbufferSurfaceEAGL.cpp",
    "eagl/PbufferSurfaceEAGL.h",
    "eagl/RendererEAGL.cpp",
    "eagl/RendererEAGL.h",
    "eagl/WindowSurfaceEAGL.h",
    "eagl/WindowSurfaceEAGL.mm",
  ]
}

if (angle_enable_gl_null) {
  _gl_backend_sources += [
    "null_functions.cpp",
    "null_functions.h",
  ]
}

config("angle_gl_backend_config") {
  defines = [ "ANGLE_ENABLE_OPENGL" ]
  if (angle_enable_gl_desktop) {
    defines += [ "ANGLE_ENABLE_OPENGL_DESKTOP" ]
  }
  if (angle_enable_gl_null) {
    defines += [ "ANGLE_ENABLE_OPENGL_NULL" ]
  }
  if (ozone_platform_gbm) {
    defines += [ "ANGLE_USE_GBM" ]
  }
  if (is_apple) {
    defines += [ "GL_SILENCE_DEPRECATION" ]
  }
  include_dirs = [ "../../../third_party/khronos" ]
}

angle_source_set("angle_gl_backend") {
  sources = _gl_backend_sources

  public_configs = [ ":angle_gl_backend_config" ]
  public_deps = [ "$angle_root:libANGLE_headers" ]

  deps = [
    "$angle_root:angle_gpu_info_util",
    "$angle_root:angle_image_util",
  ]

  if (is_win) {
    deps += [ "$angle_root:angle_d3d_format_tables" ]
  }

  if (angle_use_x11) {
    libs = [
      "X11",
      "Xi",
      "Xext",
    ]
  }
  if (is_android || is_linux || is_chromeos) {
    deps += [ "$angle_root/src/common/linux:angle_dma_buf" ]
  }
  if (is_apple) {
    frameworks = [
      "IOSurface.framework",
      "QuartzCore.framework",
    ]
    if (angle_enable_eagl) {
      frameworks += [ "OpenGLES.framework" ]
    } else if (angle_enable_cgl) {
      frameworks += [ "OpenGL.framework" ]
    }
    if (is_mac) {
      frameworks += [ "Cocoa.framework" ]
    }
  }
  if (ozone_platform_gbm) {
    public_configs += [ ":libdrm" ]
    deps += [ "//third_party/minigbm" ]
  }
}
