Skip to content

Commit

Permalink
[Cast Convergence] Replace is_cast_desktop_build with is_castos.
Browse files Browse the repository at this point in the history
This patch moves is_cast_desktop_build to //chromecast and replaces
usages with a new flag, is_castos, which guards code intended for
Nest Linux devices.

The flag defaults to is_chromecast for now; in the future it will be
default to false, and individual builds will need to opt into building
Nest Linux specific code.

Bug: 1293569
Change-Id: Ib4075f415a59048c787b02c8532e2e0a20abfaff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3606171
Reviewed-by: Will Cassella <cassew@chromium.org>
Reviewed-by: Mark Foltz <mfoltz@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Reviewed-by: Peter Wen <wnwen@chromium.org>
Commit-Queue: Ryan Keane <rwkeane@google.com>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Cr-Commit-Position: refs/heads/main@{#998482}
NOKEYCHECK=True
GitOrigin-RevId: af3ac0f74f1fb633db1b4b4239ad9756237459d6
  • Loading branch information
Ryan Keane authored and copybara-github committed May 2, 2022
1 parent 36773c2 commit 56e01bf
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
5 changes: 4 additions & 1 deletion BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ buildflag_header("branding_buildflags") {
buildflag_header("chromecast_buildflags") {
header = "chromecast_buildflags.h"

flags = [ "IS_CHROMECAST=$is_chromecast" ]
flags = [
"IS_CHROMECAST=$is_chromecast",
"IS_CASTOS=$is_castos",
]
}

buildflag_header("chromeos_buildflags") {
Expand Down
35 changes: 15 additions & 20 deletions config/chromecast_build.gni
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,28 @@ declare_args() {

# True to enable the cast audio renderer.
#
# TODO(crbug.com/1293520): Remove this buildflag.
# TODO(crbug.com/1293520): Remove this buildflag.
enable_cast_audio_renderer = false
}

declare_args() {
# Set this true for a Chromecast build. Chromecast builds are supported on
# Linux and Android.
# Linux, Android, ChromeOS, and Fuchsia.
#
# During the migration from is_chromecast, this must be set to the same value
# as is_chromecast.
enable_cast_receiver = is_chromecast
}

declare_args() {
# True if Chromecast build is targeted for linux desktop. This type of build
# is useful for testing and development, but currently supports only a subset
# of Cast functionality. Though this defaults to true for x86 Linux devices,
# this should be overriden manually for an embedded x86 build.
# TODO(slan): Remove instances of this when x86 is a fully supported platform.
# Set this to true to build for Nest hardware running Linux (aka "CastOS").
# Set this to false to use the defaults for the target OS/platform.
#
# TODO(crbug.com/1293569): Move is_cast_desktop_build to //chromecast.
is_cast_desktop_build = enable_cast_receiver && target_os == "linux" &&
(target_cpu == "x86" || target_cpu == "x64")
# TODO(crbug.com/1314528): Change default to false and require is_linux.
is_castos = is_chromecast
}

# True to enable the cast renderer. It is enabled by default for linux and
# android audio only builds.
declare_args() {
# True to enable the cast renderer. It is enabled by default for Linux and
# Android audio only builds.
#
# TODO(crbug.com/1293520): Remove this buildflag.
enable_cast_renderer =
Expand Down Expand Up @@ -124,12 +120,11 @@ assert(is_linux || is_chromeos || is_android || is_fuchsia ||
!enable_cast_receiver,
"Cast receiver builds are not supported on $target_os")

# Assert that is_cast_audio_only and is_cast_desktop_build are both false on a
# non-Chromecast build.
#
# NOTE: This restriction should be removed in the future as it should be
# possible to build an audio-only Cast-enabled browser on any platform.
assert(enable_cast_receiver || (!is_cast_audio_only && !is_cast_desktop_build))
assert(enable_cast_receiver || !is_cast_audio_only,
"is_cast_audio_only = true requires enable_cast_receiver = true.")

assert(enable_cast_receiver == is_chromecast,
"enable_cast_receiver and is_chromecast must be set to the same value.")

assert(enable_cast_receiver || !is_castos,
"is_castos = true requires enable_cast_receiver = true.")
12 changes: 6 additions & 6 deletions config/ozone.gni
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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_chromecast && !is_android) || is_fuchsia || is_linux
is_chromeos || (is_castos && !is_android) || is_fuchsia || is_linux
}

declare_args() {
Expand Down Expand Up @@ -71,15 +71,15 @@ declare_args() {

if (is_cast_audio_only) {
# Just use headless for audio-only Cast platforms.
} else if (is_chromecast && !is_fuchsia) {
# Enable the Cast ozone platform on all A/V Cast builds except Fuchsia.
} else if (is_castos && !is_fuchsia) {
# 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.
# TODO(halliwell): Create a libcast_graphics implementation for desktop
# using X11, and disable this platform.
if (is_cast_desktop_build && !is_cast_audio_only) {
# 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"
Expand Down

0 comments on commit 56e01bf

Please sign in to comment.