1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128

build / config / ozone.gni [blame]

# Copyright 2020 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/cast.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/toolchain/toolchain.gni")

declare_args() {
  # Indicates if Ozone is enabled. Ozone is a low-level library layer for Linux
  # that does not require X11.
  use_ozone = is_chromeos || is_fuchsia || is_linux
}

declare_args() {
  # Ozone extra platforms file path. Can be overridden to build out of
  # tree ozone platforms.
  ozone_extra_path = "//build/config/ozone_extra.gni"

  # Select platforms automatically. Turn this off for manual control.
  ozone_auto_platforms = use_ozone

  # TODO(petermcneeley): Backwards compatiblity support for VM images.
  # Remove when deprecated. (https://crbug.com/1122009)
  ozone_platform_gbm = -1

  # Enable explicit apitrace (https://apitrace.github.io) loading.
  # This requires apitrace library with additional bindings.
  # See ChromeOS package for details:
  # https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2659419
  # Chrome will not start without an apitrace.so library.
  # Trace will be saved to /tmp/gltrace.dat file by default. You can
  # override it at run time with TRACE_FILE=<path> environment variable.
  enable_opengl_apitrace = false
}

declare_args() {
  # The platform that will used at runtime by default. This can be overridden
  # with the command line flag --ozone-platform=<platform>.
  ozone_platform = ""

  # Compile the 'cast' platform.
  ozone_platform_cast = false

  # Compile the 'drm' platform.
  ozone_platform_drm = false

  # Compile the 'headless' platform.
  ozone_platform_headless = false

  # Compile the 'flatland' platform.
  ozone_platform_flatland = false

  # Compile the 'x11' platform.
  ozone_platform_x11 = false

  # Compile the 'wayland' platform.
  ozone_platform_wayland = false

  if (ozone_auto_platforms) {
    # Use headless as the default platform unless modified below.
    ozone_platform = "headless"
    ozone_platform_headless = true

    if (is_cast_audio_only) {
      # Just use headless for audio-only Cast platforms.
    } else if (is_castos) {
      # Enable the Cast ozone platform on all video CastOS builds.
      ozone_platform_cast = true

      # For visual desktop Chromecast builds, override the default "headless"
      # platform with --ozone-platform=x11.
      # NOTE: The CQ is one such case.
      if (target_os == "linux" &&
          (target_cpu == "x86" || target_cpu == "x64")) {
        ozone_platform_x11 = true
      } else {
        ozone_platform = "cast"
      }
    } else if (is_chromeos_ash) {
      ozone_platform = "x11"
      ozone_platform_drm = true
      ozone_platform_x11 = true
    } else if (is_chromeos_lacros) {
      ozone_platform = "wayland"
      ozone_platform_wayland = true
    } else if (is_linux) {
      ozone_platform = "x11"
      ozone_platform_wayland = true
      ozone_platform_x11 = true
    } else if (is_fuchsia) {
      ozone_platform = "flatland"
      ozone_platform_flatland = true
    }
  }

  # TODO(petermcneeley): Backwards compatiblity support for VM images.
  # Remove when deprecated. (https://crbug.com/1122009)
  if (ozone_platform_gbm != -1) {
    ozone_platform_drm = ozone_platform_gbm
  }
}

import(ozone_extra_path)

_ozone_extra_directory = get_path_info(ozone_extra_path, "dir")

# Extra paths to add to targets visibility list.
ozone_external_platform_visibility = [ "$_ozone_extra_directory/*" ]

if (is_a_target_toolchain) {
  assert(
      use_ozone || !(ozone_platform_cast || ozone_platform_drm ||
                         ozone_platform_flatland || ozone_platform_headless ||
                         ozone_platform_x11 || ozone_platform_wayland),
      "Must set use_ozone to select ozone platforms")
}

# TODO(petermcneeley): Backwards compatiblity support for VM images.
# Remove when deprecated. (https://crbug.com/1122009)

assert(ozone_platform_gbm == -1 || ozone_platform_drm == ozone_platform_gbm)

ozone_platform_gbm = ozone_platform_drm

if (ozone_platform == "gbm") {
  ozone_platform = "drm"
}