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