xref: /aosp_15_r20/external/cronet/build/config/ozone.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2020 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/cast.gni")
6import("//build/config/chromeos/ui_mode.gni")
7import("//build/toolchain/toolchain.gni")
8
9declare_args() {
10  # Indicates if Ozone is enabled. Ozone is a low-level library layer for Linux
11  # that does not require X11.
12  use_ozone = is_chromeos || is_fuchsia || is_linux
13}
14
15declare_args() {
16  # Ozone extra platforms file path. Can be overridden to build out of
17  # tree ozone platforms.
18  ozone_extra_path = "//build/config/ozone_extra.gni"
19
20  # Select platforms automatically. Turn this off for manual control.
21  ozone_auto_platforms = use_ozone
22
23  # TODO(petermcneeley): Backwards compatiblity support for VM images.
24  # Remove when deprecated. (https://crbug.com/1122009)
25  ozone_platform_gbm = -1
26
27  # Enable explicit apitrace (https://apitrace.github.io) loading.
28  # This requires apitrace library with additional bindings.
29  # See ChromeOS package for details:
30  # https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2659419
31  # Chrome will not start without an apitrace.so library.
32  # Trace will be saved to /tmp/gltrace.dat file by default. You can
33  # override it at run time with TRACE_FILE=<path> environment variable.
34  enable_opengl_apitrace = false
35}
36
37declare_args() {
38  # The platform that will used at runtime by default. This can be overridden
39  # with the command line flag --ozone-platform=<platform>.
40  ozone_platform = ""
41
42  # Compile the 'cast' platform.
43  ozone_platform_cast = false
44
45  # Compile the 'drm' platform.
46  ozone_platform_drm = false
47
48  # Compile the 'headless' platform.
49  ozone_platform_headless = false
50
51  # Compile the 'flatland' platform.
52  ozone_platform_flatland = false
53
54  # Compile the 'x11' platform.
55  ozone_platform_x11 = false
56
57  # Compile the 'wayland' platform.
58  ozone_platform_wayland = false
59
60  if (ozone_auto_platforms) {
61    # Use headless as the default platform unless modified below.
62    ozone_platform = "headless"
63    ozone_platform_headless = true
64
65    if (is_cast_audio_only) {
66      # Just use headless for audio-only Cast platforms.
67    } else if (is_castos) {
68      # Enable the Cast ozone platform on all video CastOS builds.
69      ozone_platform_cast = true
70
71      # For visual desktop Chromecast builds, override the default "headless"
72      # platform with --ozone-platform=x11.
73      # NOTE: The CQ is one such case.
74      if (target_os == "linux" &&
75          (target_cpu == "x86" || target_cpu == "x64")) {
76        ozone_platform_x11 = true
77      } else {
78        ozone_platform = "cast"
79      }
80    } else if (is_chromeos_ash) {
81      ozone_platform = "x11"
82      ozone_platform_drm = true
83      ozone_platform_x11 = true
84    } else if (is_chromeos_lacros) {
85      ozone_platform = "wayland"
86      ozone_platform_wayland = true
87    } else if (is_linux) {
88      ozone_platform = "x11"
89      ozone_platform_wayland = true
90      ozone_platform_x11 = true
91    } else if (is_fuchsia) {
92      ozone_platform = "flatland"
93      ozone_platform_flatland = true
94    }
95  }
96
97  # TODO(petermcneeley): Backwards compatiblity support for VM images.
98  # Remove when deprecated. (https://crbug.com/1122009)
99  if (ozone_platform_gbm != -1) {
100    ozone_platform_drm = ozone_platform_gbm
101  }
102}
103
104import(ozone_extra_path)
105
106_ozone_extra_directory = get_path_info(ozone_extra_path, "dir")
107
108# Extra paths to add to targets visibility list.
109ozone_external_platform_visibility = [ "$_ozone_extra_directory/*" ]
110
111if (is_a_target_toolchain) {
112  assert(
113      use_ozone || !(ozone_platform_cast || ozone_platform_drm ||
114                         ozone_platform_flatland || ozone_platform_headless ||
115                         ozone_platform_x11 || ozone_platform_wayland),
116      "Must set use_ozone to select ozone platforms")
117}
118
119# TODO(petermcneeley): Backwards compatiblity support for VM images.
120# Remove when deprecated. (https://crbug.com/1122009)
121
122assert(ozone_platform_gbm == -1 || ozone_platform_drm == ozone_platform_gbm)
123
124ozone_platform_gbm = ozone_platform_drm
125
126if (ozone_platform == "gbm") {
127  ozone_platform = "drm"
128}
129