summaryrefslogtreecommitdiff
path: root/chromium/chromecast/chromecast.gni
blob: 5b000aed34fca66ce01676170c4b0739c3090537 (plain)
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# Copyright 2015 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/chromecast_build.gni")
import("//build/config/locales.gni")
import("//components/cast_streaming/features.gni")
import("//media/media_options.gni")

# These args blocks should contain arguments used within the //chromecast
# directory. Arguments which are used in other Chrome components should
# be instead declared in //build/config/chromecast_build.gni.
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 overridden manually for an embedded x86 build.
  is_cast_desktop_build =
      target_os == "linux" && (target_cpu == "x86" || target_cpu == "x64") &&
      enable_cast_receiver

  # chromecast_branding is used to include or exclude Google-branded components.
  # Set it to "public" for a Chromium build.
  chromecast_branding = "public"
}

declare_args() {
  # If true, IS_CAST_DEBUG_BUILD() will evaluate to 1 in version.h. Otherwise,
  # it will evaluate to 0. Overriding this when is_debug=false is useful for
  # doing engineering builds.
  cast_is_debug = is_debug

  # The incremental build number. The Cast automated builders will set this
  # value to indicate the buildset. Note: The default value should be greater
  # than any value the builder may assign to prevent attempted automatic updates
  # when the default value is used.
  cast_build_incremental = "999999"

  if (is_android) {
    # If true, run receiver apps in an Android service instead of an activity.
    display_web_contents_in_service = is_cast_audio_only
  }

  # If true, Chromecast WebUI resources are included in a build.
  # TODO(antz): default to false for audio-only builds, might need further
  # clean up (b/27119303)
  enable_chromecast_webui = !is_cast_audio_only && !is_android

  # Set true to enable assistant features.
  enable_assistant = false

  # Set to true if there is a full mixer implementation; if not, we create a
  # shim mixer service receiver that pushes audio to the CMA backend.
  have_full_mixer = is_cast_audio_only

  # If true, the mixer will be instantiated inside cast_shell. When false, the
  # mixer is expected to be running in another process.
  mixer_in_cast_shell = true

  # Set to true on devices where the VolumeControl implementation is in the
  # libcast_avsettings_1.0.so instead of in libcast_media_1.0.so.
  cast_volume_control_in_avsettings = false

  # Set to true for builds targeting ARC.
  is_android_arc = false

  if (is_android) {
    # Set to true to get logcat from a remote service
    # If false, will only get the logs of the app.
    use_remote_service_logcat = false

    # Set the package name and class path for the component which will provide device logs
    # Values defined in eureka-internal
    # These values are unused if use_remote_service_logcat is false
    # device_logs_provider_package is a CSV, and the first resolved one would be used.
    device_logs_provider_package = ""
    device_logs_provider_class = ""
  }

  # Set to true to enable a CMA media backend that allows mixed audio to be
  # output with sync'd video.
  enable_video_with_mixed_audio = false

  # unified flag to pick monotonic_clock OR monotonic_clock_raw
  media_clock_monotonic_raw = !is_android && !is_cast_desktop_build

  # Include 'Android' in user agent string to avoid being served desktop
  # versions of websites.
  # TODO(halliwell): consider making this default for all Cast hardware.
  use_android_user_agent = false

  # Contain default command line switches we want to set.
  # This will get joined into a comma-separated list that looks like:
  #   "test-flag-one=public,test-flag-two=true,test-flag-three=1,"
  # TODO(ziyangch): make the parsing logic have ability to quote/escape characters.
  default_command_line_flags = []

  # Set to true to disable secure flac/opus support in EME, when using
  # cast CMA media backend and supporting Widevine or Playready.
  disable_secure_flac_and_opus_decoding = false

  # Set to true to enable mixing in CastAudioManager. Only needed on devices
  # that do not have a mixer in the CMA backend.
  enable_cast_audio_manager_mixer =
      chromecast_branding == "google" && !is_cast_audio_only && !is_android

  # Set to true to enable video capture service for video input and output.
  enable_video_capture_service = false

  # Set to true to enable external Mojo services to communicate with services
  # within cast_shell.
  enable_external_mojo_services = is_linux || is_chromeos || is_android

  # Support using system perfetto tracing
  enable_perfetto_tracing = false

  # Support using system perfetto tracing
  enable_perfetto_tracing = false

  # Recording happens at this sample rate. Must be 16000, 48000 or 96000 Hz.
  audio_input_sample_rate = 16000

  # Whether use unix sockets in Cast input/output stream.
  use_unix_sockets = is_linux || is_chromeos || is_android

  # Set to true to enable audio capture service for audio input.
  enable_audio_capture_service = false

  # Extra rpath to use for standalone services.
  iot_service_rpath = ""

  # Set to true to enable media overlay for volume bar, etc.
  enable_media_overlay = false

  # Set to true to forward crashes to the system's crash handler instead of
  # handling them internally.  This disables the built-in crash handler.
  use_system_crash_handler = false

  # True to use the Chromium runtime for cast rendering.
  enable_chromium_runtime_cast_renderer = false

  # True to use the remoting implementation of cast streaming for the cast web
  # runtime (as opposed to the mirroring-only implementation).
  enable_remoting_for_cwr = false

  # device specific string to append to User string.
  device_user_agent_suffix = ""

  # link vendor-supplied functionality as shared libraries. When true,
  # cast_shared_library targets are normal shared libraries. When false,
  # they become source_sets.
  use_vendor_shlibs = !is_android
}

declare_args() {
  # Use Playready CDMs for internal non-desktop builds.
  enable_playready = !is_cast_desktop_build && chromecast_branding != "public"
}

# This is the release version, which takes the form <major>.<minor>. Internal
# builds will read the value from an internal file containing this value as a
# string. Public builds, lacking this file, will set a dummy value.
if (chromecast_branding == "public") {
  cast_build_release = "eng." + getenv("USER")
} else {
  cast_build_release =
      read_file("//chromecast/internal/build/cast_build_release", "trim string")
}

# All locales supported by Cast builds. This provides a single point of
# reference for all GN files referencing a locales list.
# |locales_without_pseudolocales| is declared in //build/config/locales.gni.
# See https://chromium-review.googlesource.com/488166/ for why we can't use
# pseudolocales in chromecast.
cast_locales = locales_without_pseudolocales

# Android currently supports more locales than Desktop and ChromeOS.
# If Cast will also the android files update this and the Cast grd files.
if (is_android) {
  # Subtract out additional Android locales
  cast_locales -= extended_locales
}
if (!(is_ios || is_chromeos)) {
  # Subtract out the additional desktop locales
  cast_locales -= [
    "af",
    "ur",
  ]
}

# Use Chromecast CDMs for protected content. Some Android platforms use
# MediaDrm for CDM support.
declare_args() {
  use_chromecast_cdms = true
}

foreach(target_type,
        [
          "executable",
          "loadable_module",
          "source_set",
        ]) {
  template("cast_${target_type}") {
    target(target_type, target_name) {
      forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
      forward_variables_from(invoker, [ "testonly" ])

      configs += [ "//chromecast:cast_config" ]
    }
  }
}

template("cast_shared_library") {
  if (use_vendor_shlibs) {
    target_type = "shared_library"
  } else {
    target_type = "source_set"
  }
  target(target_type, target_name) {
    forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY)
    forward_variables_from(invoker, [ "testonly" ])

    configs += [ "//chromecast:cast_config" ]
  }
}

# Set the defaults for each target. The defaults for these target wrappers
# should match their unwrapped counterparts in BUILDCONFIG.gn. The variables
# referenced below are declared in BUILDCONFIG.gn.
set_defaults("cast_executable") {
  configs = default_executable_configs
}

set_defaults("cast_shared_library") {
  configs = default_shared_library_configs
  if (is_android) {
    configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
  }
}

set_defaults("cast_loadable_module") {
  configs = default_shared_library_configs
  if (is_android) {
    configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
  }
}

set_defaults("cast_source_set") {
  configs = default_compiler_configs
}