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/chromecast_build.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 'scenic' platform. 52 ozone_platform_scenic = false 53 54 # Compile the 'flatland' platform. 55 ozone_platform_flatland = false 56 57 # Compile the 'x11' platform. 58 ozone_platform_x11 = false 59 60 # Compile the 'wayland' platform. 61 ozone_platform_wayland = false 62 63 if (ozone_auto_platforms) { 64 # Use headless as the default platform unless modified below. 65 ozone_platform = "headless" 66 ozone_platform_headless = true 67 68 if (is_cast_audio_only) { 69 # Just use headless for audio-only Cast platforms. 70 } else if (is_castos) { 71 # Enable the Cast ozone platform on all video CastOS builds. 72 ozone_platform_cast = true 73 74 # For visual desktop Chromecast builds, override the default "headless" 75 # platform with --ozone-platform=x11. 76 # NOTE: The CQ is one such case. 77 if (target_os == "linux" && 78 (target_cpu == "x86" || target_cpu == "x64")) { 79 ozone_platform_x11 = true 80 } else { 81 ozone_platform = "cast" 82 } 83 } else if (is_chromeos_ash) { 84 ozone_platform = "x11" 85 ozone_platform_drm = true 86 ozone_platform_x11 = true 87 } else if (is_chromeos_lacros) { 88 ozone_platform = "wayland" 89 ozone_platform_wayland = true 90 } else if (is_linux) { 91 ozone_platform = "x11" 92 ozone_platform_wayland = true 93 ozone_platform_x11 = true 94 } else if (is_fuchsia) { 95 ozone_platform = "flatland" 96 ozone_platform_scenic = true 97 ozone_platform_flatland = true 98 } 99 } 100 101 # TODO(petermcneeley): Backwards compatiblity support for VM images. 102 # Remove when deprecated. (https://crbug.com/1122009) 103 if (ozone_platform_gbm != -1) { 104 ozone_platform_drm = ozone_platform_gbm 105 } 106} 107 108import(ozone_extra_path) 109 110_ozone_extra_directory = get_path_info(ozone_extra_path, "dir") 111 112# Extra paths to add to targets visibility list. 113ozone_external_platform_visibility = [ "$_ozone_extra_directory/*" ] 114 115if (is_a_target_toolchain) { 116 assert(use_ozone || !(ozone_platform_cast || ozone_platform_drm || 117 ozone_platform_flatland || 118 ozone_platform_headless || ozone_platform_x11 || 119 ozone_platform_wayland || ozone_platform_scenic), 120 "Must set use_ozone to select ozone platforms") 121} 122 123# TODO(petermcneeley): Backwards compatiblity support for VM images. 124# Remove when deprecated. (https://crbug.com/1122009) 125 126assert(ozone_platform_gbm == -1 || ozone_platform_drm == ozone_platform_gbm) 127 128ozone_platform_gbm = ozone_platform_drm 129 130if (ozone_platform == "gbm") { 131 ozone_platform = "drm" 132} 133