xref: /aosp_15_r20/external/webrtc/webrtc.gni (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2*d9f75844SAndroid Build Coastguard Worker#
3*d9f75844SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license
4*d9f75844SAndroid Build Coastguard Worker# that can be found in the LICENSE file in the root of the source
5*d9f75844SAndroid Build Coastguard Worker# tree. An additional intellectual property rights grant can be found
6*d9f75844SAndroid Build Coastguard Worker# in the file PATENTS.  All contributing project authors may
7*d9f75844SAndroid Build Coastguard Worker# be found in the AUTHORS file in the root of the source tree.
8*d9f75844SAndroid Build Coastguard Workerimport("//build/config/arm.gni")
9*d9f75844SAndroid Build Coastguard Workerimport("//build/config/features.gni")
10*d9f75844SAndroid Build Coastguard Workerimport("//build/config/mips.gni")
11*d9f75844SAndroid Build Coastguard Workerimport("//build/config/ozone.gni")
12*d9f75844SAndroid Build Coastguard Workerimport("//build/config/sanitizers/sanitizers.gni")
13*d9f75844SAndroid Build Coastguard Workerimport("//build/config/sysroot.gni")
14*d9f75844SAndroid Build Coastguard Workerimport("//build_overrides/build.gni")
15*d9f75844SAndroid Build Coastguard Worker
16*d9f75844SAndroid Build Coastguard Workerif (!build_with_chromium && is_component_build) {
17*d9f75844SAndroid Build Coastguard Worker  print("The Gn argument `is_component_build` is currently " +
18*d9f75844SAndroid Build Coastguard Worker        "ignored for WebRTC builds.")
19*d9f75844SAndroid Build Coastguard Worker  print("Component builds are supported by Chromium and the argument " +
20*d9f75844SAndroid Build Coastguard Worker        "`is_component_build` makes it possible to create shared libraries " +
21*d9f75844SAndroid Build Coastguard Worker        "instead of static libraries.")
22*d9f75844SAndroid Build Coastguard Worker  print("If an app depends on WebRTC it makes sense to just depend on the " +
23*d9f75844SAndroid Build Coastguard Worker        "WebRTC static library, so there is no difference between " +
24*d9f75844SAndroid Build Coastguard Worker        "`is_component_build=true` and `is_component_build=false`.")
25*d9f75844SAndroid Build Coastguard Worker  print(
26*d9f75844SAndroid Build Coastguard Worker      "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md")
27*d9f75844SAndroid Build Coastguard Worker  assert(!is_component_build, "Component builds are not supported in WebRTC.")
28*d9f75844SAndroid Build Coastguard Worker}
29*d9f75844SAndroid Build Coastguard Worker
30*d9f75844SAndroid Build Coastguard Workerif (is_ios) {
31*d9f75844SAndroid Build Coastguard Worker  import("//build/config/ios/rules.gni")
32*d9f75844SAndroid Build Coastguard Worker}
33*d9f75844SAndroid Build Coastguard Worker
34*d9f75844SAndroid Build Coastguard Workerif (is_mac) {
35*d9f75844SAndroid Build Coastguard Worker  import("//build/config/mac/rules.gni")
36*d9f75844SAndroid Build Coastguard Worker}
37*d9f75844SAndroid Build Coastguard Worker
38*d9f75844SAndroid Build Coastguard Workerif (is_fuchsia) {
39*d9f75844SAndroid Build Coastguard Worker  import("//build/config/fuchsia/config.gni")
40*d9f75844SAndroid Build Coastguard Worker}
41*d9f75844SAndroid Build Coastguard Worker
42*d9f75844SAndroid Build Coastguard Worker# This declare_args is separated from the next one because args declared
43*d9f75844SAndroid Build Coastguard Worker# in this one, can be read from the next one (args defined in the same
44*d9f75844SAndroid Build Coastguard Worker# declare_args cannot be referenced in that scope).
45*d9f75844SAndroid Build Coastguard Workerdeclare_args() {
46*d9f75844SAndroid Build Coastguard Worker  # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
47*d9f75844SAndroid Build Coastguard Worker  # expand to code that will manage symbols visibility.
48*d9f75844SAndroid Build Coastguard Worker  rtc_enable_symbol_export = false
49*d9f75844SAndroid Build Coastguard Worker}
50*d9f75844SAndroid Build Coastguard Worker
51*d9f75844SAndroid Build Coastguard Workerdeclare_args() {
52*d9f75844SAndroid Build Coastguard Worker  # Setting this to true, will make RTC_DLOG() expand to log statements instead
53*d9f75844SAndroid Build Coastguard Worker  # of being removed by the preprocessor.
54*d9f75844SAndroid Build Coastguard Worker  # This is useful for example to be able to get RTC_DLOGs on a release build.
55*d9f75844SAndroid Build Coastguard Worker  rtc_dlog_always_on = false
56*d9f75844SAndroid Build Coastguard Worker
57*d9f75844SAndroid Build Coastguard Worker  # Setting this to true will make RTC_OBJC_EXPORT expand to code that will
58*d9f75844SAndroid Build Coastguard Worker  # manage symbols visibility. By default, Obj-C/Obj-C++ symbols are exported
59*d9f75844SAndroid Build Coastguard Worker  # if C++ symbols are but setting this arg to true while keeping
60*d9f75844SAndroid Build Coastguard Worker  # rtc_enable_symbol_export=false will only export RTC_OBJC_EXPORT
61*d9f75844SAndroid Build Coastguard Worker  # annotated symbols.
62*d9f75844SAndroid Build Coastguard Worker  rtc_enable_objc_symbol_export = rtc_enable_symbol_export
63*d9f75844SAndroid Build Coastguard Worker
64*d9f75844SAndroid Build Coastguard Worker  # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
65*d9f75844SAndroid Build Coastguard Worker  # will tell the pre-processor to remove the default definition of symbols
66*d9f75844SAndroid Build Coastguard Worker  # needed to use field_trial. In that case a new implementation needs to be
67*d9f75844SAndroid Build Coastguard Worker  # provided.
68*d9f75844SAndroid Build Coastguard Worker  if (build_with_chromium) {
69*d9f75844SAndroid Build Coastguard Worker    # When WebRTC is built as part of Chromium it should exclude the default
70*d9f75844SAndroid Build Coastguard Worker    # implementation of field_trial unless it is building for NACL or
71*d9f75844SAndroid Build Coastguard Worker    # Chromecast.
72*d9f75844SAndroid Build Coastguard Worker    rtc_exclude_field_trial_default = !is_nacl && !is_castos && !is_cast_android
73*d9f75844SAndroid Build Coastguard Worker  } else {
74*d9f75844SAndroid Build Coastguard Worker    rtc_exclude_field_trial_default = false
75*d9f75844SAndroid Build Coastguard Worker  }
76*d9f75844SAndroid Build Coastguard Worker
77*d9f75844SAndroid Build Coastguard Worker  # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which
78*d9f75844SAndroid Build Coastguard Worker  # will tell the pre-processor to remove the default definition of symbols
79*d9f75844SAndroid Build Coastguard Worker  # needed to use metrics. In that case a new implementation needs to be
80*d9f75844SAndroid Build Coastguard Worker  # provided.
81*d9f75844SAndroid Build Coastguard Worker  rtc_exclude_metrics_default = build_with_chromium
82*d9f75844SAndroid Build Coastguard Worker
83*d9f75844SAndroid Build Coastguard Worker  # Setting this to true will define WEBRTC_EXCLUDE_SYSTEM_TIME which
84*d9f75844SAndroid Build Coastguard Worker  # will tell the pre-processor to remove the default definition of the
85*d9f75844SAndroid Build Coastguard Worker  # SystemTimeNanos() which is defined in rtc_base/system_time.cc. In
86*d9f75844SAndroid Build Coastguard Worker  # that case a new implementation needs to be provided.
87*d9f75844SAndroid Build Coastguard Worker  rtc_exclude_system_time = build_with_chromium
88*d9f75844SAndroid Build Coastguard Worker
89*d9f75844SAndroid Build Coastguard Worker  # Setting this to false will require the API user to pass in their own
90*d9f75844SAndroid Build Coastguard Worker  # SSLCertificateVerifier to verify the certificates presented from a
91*d9f75844SAndroid Build Coastguard Worker  # TLS-TURN server. In return disabling this saves around 100kb in the binary.
92*d9f75844SAndroid Build Coastguard Worker  rtc_builtin_ssl_root_certificates = true
93*d9f75844SAndroid Build Coastguard Worker
94*d9f75844SAndroid Build Coastguard Worker  # Include the iLBC audio codec?
95*d9f75844SAndroid Build Coastguard Worker  rtc_include_ilbc = true
96*d9f75844SAndroid Build Coastguard Worker
97*d9f75844SAndroid Build Coastguard Worker  # Disable this to avoid building the Opus audio codec.
98*d9f75844SAndroid Build Coastguard Worker  rtc_include_opus = true
99*d9f75844SAndroid Build Coastguard Worker
100*d9f75844SAndroid Build Coastguard Worker  # Enable this if the Opus version upon which WebRTC is built supports direct
101*d9f75844SAndroid Build Coastguard Worker  # encoding of 120 ms packets.
102*d9f75844SAndroid Build Coastguard Worker  rtc_opus_support_120ms_ptime = true
103*d9f75844SAndroid Build Coastguard Worker
104*d9f75844SAndroid Build Coastguard Worker  # Enable this to let the Opus audio codec change complexity on the fly.
105*d9f75844SAndroid Build Coastguard Worker  rtc_opus_variable_complexity = false
106*d9f75844SAndroid Build Coastguard Worker
107*d9f75844SAndroid Build Coastguard Worker  # Used to specify an external Jsoncpp include path when not compiling the
108*d9f75844SAndroid Build Coastguard Worker  # library that comes with WebRTC (i.e. rtc_build_json == 0).
109*d9f75844SAndroid Build Coastguard Worker  rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
110*d9f75844SAndroid Build Coastguard Worker
111*d9f75844SAndroid Build Coastguard Worker  # Used to specify an external OpenSSL include path when not compiling the
112*d9f75844SAndroid Build Coastguard Worker  # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
113*d9f75844SAndroid Build Coastguard Worker  rtc_ssl_root = ""
114*d9f75844SAndroid Build Coastguard Worker
115*d9f75844SAndroid Build Coastguard Worker  # Enable when an external authentication mechanism is used for performing
116*d9f75844SAndroid Build Coastguard Worker  # packet authentication for RTP packets instead of libsrtp.
117*d9f75844SAndroid Build Coastguard Worker  rtc_enable_external_auth = build_with_chromium
118*d9f75844SAndroid Build Coastguard Worker
119*d9f75844SAndroid Build Coastguard Worker  # Selects whether debug dumps for the audio processing module
120*d9f75844SAndroid Build Coastguard Worker  # should be generated.
121*d9f75844SAndroid Build Coastguard Worker  apm_debug_dump = false
122*d9f75844SAndroid Build Coastguard Worker
123*d9f75844SAndroid Build Coastguard Worker  # Selects whether the audio processing module should be excluded.
124*d9f75844SAndroid Build Coastguard Worker  rtc_exclude_audio_processing_module = false
125*d9f75844SAndroid Build Coastguard Worker
126*d9f75844SAndroid Build Coastguard Worker  # Set this to true to enable BWE test logging.
127*d9f75844SAndroid Build Coastguard Worker  rtc_enable_bwe_test_logging = false
128*d9f75844SAndroid Build Coastguard Worker
129*d9f75844SAndroid Build Coastguard Worker  # Set this to false to skip building examples.
130*d9f75844SAndroid Build Coastguard Worker  rtc_build_examples = true
131*d9f75844SAndroid Build Coastguard Worker
132*d9f75844SAndroid Build Coastguard Worker  # Set this to false to skip building tools.
133*d9f75844SAndroid Build Coastguard Worker  rtc_build_tools = true
134*d9f75844SAndroid Build Coastguard Worker
135*d9f75844SAndroid Build Coastguard Worker  # Set this to false to skip building code that requires X11.
136*d9f75844SAndroid Build Coastguard Worker  rtc_use_x11 = ozone_platform_x11
137*d9f75844SAndroid Build Coastguard Worker
138*d9f75844SAndroid Build Coastguard Worker  # Set this to use PipeWire on the Wayland display server.
139*d9f75844SAndroid Build Coastguard Worker  # By default it's only enabled on desktop Linux (excludes ChromeOS) and
140*d9f75844SAndroid Build Coastguard Worker  # only when using the sysroot as PipeWire is not available in older and
141*d9f75844SAndroid Build Coastguard Worker  # supported Ubuntu and Debian distributions.
142*d9f75844SAndroid Build Coastguard Worker  rtc_use_pipewire = is_linux && use_sysroot
143*d9f75844SAndroid Build Coastguard Worker
144*d9f75844SAndroid Build Coastguard Worker  # Set this to link PipeWire and required libraries directly instead of using the dlopen.
145*d9f75844SAndroid Build Coastguard Worker  rtc_link_pipewire = false
146*d9f75844SAndroid Build Coastguard Worker
147*d9f75844SAndroid Build Coastguard Worker  # Enable to use the Mozilla internal settings.
148*d9f75844SAndroid Build Coastguard Worker  build_with_mozilla = false
149*d9f75844SAndroid Build Coastguard Worker
150*d9f75844SAndroid Build Coastguard Worker  # Experimental: enable use of Android AAudio which requires Android SDK 26 or above
151*d9f75844SAndroid Build Coastguard Worker  # and NDK r16 or above.
152*d9f75844SAndroid Build Coastguard Worker  rtc_enable_android_aaudio = false
153*d9f75844SAndroid Build Coastguard Worker
154*d9f75844SAndroid Build Coastguard Worker  # Set to "func", "block", "edge" for coverage generation.
155*d9f75844SAndroid Build Coastguard Worker  # At unit test runtime set UBSAN_OPTIONS="coverage=1".
156*d9f75844SAndroid Build Coastguard Worker  # It is recommend to set include_examples=0.
157*d9f75844SAndroid Build Coastguard Worker  # Use llvm's sancov -html-report for human readable reports.
158*d9f75844SAndroid Build Coastguard Worker  # See http://clang.llvm.org/docs/SanitizerCoverage.html .
159*d9f75844SAndroid Build Coastguard Worker  rtc_sanitize_coverage = ""
160*d9f75844SAndroid Build Coastguard Worker
161*d9f75844SAndroid Build Coastguard Worker  # Selects fixed-point code where possible.
162*d9f75844SAndroid Build Coastguard Worker  rtc_prefer_fixed_point = false
163*d9f75844SAndroid Build Coastguard Worker  if (current_cpu == "arm" || current_cpu == "arm64") {
164*d9f75844SAndroid Build Coastguard Worker    rtc_prefer_fixed_point = true
165*d9f75844SAndroid Build Coastguard Worker  }
166*d9f75844SAndroid Build Coastguard Worker
167*d9f75844SAndroid Build Coastguard Worker  # Determines whether NEON code will be built.
168*d9f75844SAndroid Build Coastguard Worker  rtc_build_with_neon =
169*d9f75844SAndroid Build Coastguard Worker      (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
170*d9f75844SAndroid Build Coastguard Worker
171*d9f75844SAndroid Build Coastguard Worker  # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
172*d9f75844SAndroid Build Coastguard Worker  # all platforms except Android and iOS. Because FFmpeg can be built
173*d9f75844SAndroid Build Coastguard Worker  # with/without H.264 support, `ffmpeg_branding` has to separately be set to a
174*d9f75844SAndroid Build Coastguard Worker  # value that includes H.264, for example "Chrome". If FFmpeg is built without
175*d9f75844SAndroid Build Coastguard Worker  # H.264, compilation succeeds but `H264DecoderImpl` fails to initialize.
176*d9f75844SAndroid Build Coastguard Worker  # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
177*d9f75844SAndroid Build Coastguard Worker  # http://www.openh264.org, https://www.ffmpeg.org/
178*d9f75844SAndroid Build Coastguard Worker  #
179*d9f75844SAndroid Build Coastguard Worker  # Enabling H264 when building with MSVC is currently not supported, see
180*d9f75844SAndroid Build Coastguard Worker  # bugs.webrtc.org/9213#c13 for more info.
181*d9f75844SAndroid Build Coastguard Worker  rtc_use_h264 =
182*d9f75844SAndroid Build Coastguard Worker      proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
183*d9f75844SAndroid Build Coastguard Worker
184*d9f75844SAndroid Build Coastguard Worker  # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex.
185*d9f75844SAndroid Build Coastguard Worker  rtc_use_absl_mutex = false
186*d9f75844SAndroid Build Coastguard Worker
187*d9f75844SAndroid Build Coastguard Worker  # By default, use normal platform audio support or dummy audio, but don't
188*d9f75844SAndroid Build Coastguard Worker  # use file-based audio playout and record.
189*d9f75844SAndroid Build Coastguard Worker  rtc_use_dummy_audio_file_devices = false
190*d9f75844SAndroid Build Coastguard Worker
191*d9f75844SAndroid Build Coastguard Worker  # When set to true, replace the audio output with a sinus tone at 440Hz.
192*d9f75844SAndroid Build Coastguard Worker  # The ADM will ask for audio data from WebRTC but instead of reading real
193*d9f75844SAndroid Build Coastguard Worker  # audio samples from NetEQ, a sinus tone will be generated and replace the
194*d9f75844SAndroid Build Coastguard Worker  # real audio samples.
195*d9f75844SAndroid Build Coastguard Worker  rtc_audio_device_plays_sinus_tone = false
196*d9f75844SAndroid Build Coastguard Worker
197*d9f75844SAndroid Build Coastguard Worker  if (is_ios) {
198*d9f75844SAndroid Build Coastguard Worker    # Build broadcast extension in AppRTCMobile for iOS. This results in the
199*d9f75844SAndroid Build Coastguard Worker    # binary only running on iOS 11+, which is why it is disabled by default.
200*d9f75844SAndroid Build Coastguard Worker    rtc_apprtcmobile_broadcast_extension = false
201*d9f75844SAndroid Build Coastguard Worker  }
202*d9f75844SAndroid Build Coastguard Worker
203*d9f75844SAndroid Build Coastguard Worker  # Determines whether OpenGL is available on iOS/macOS.
204*d9f75844SAndroid Build Coastguard Worker  rtc_ios_macos_use_opengl_rendering =
205*d9f75844SAndroid Build Coastguard Worker      !(is_ios && target_environment == "catalyst")
206*d9f75844SAndroid Build Coastguard Worker
207*d9f75844SAndroid Build Coastguard Worker  # When set to false, builtin audio encoder/decoder factories and all the
208*d9f75844SAndroid Build Coastguard Worker  # audio codecs they depend on will not be included in libwebrtc.{a|lib}
209*d9f75844SAndroid Build Coastguard Worker  # (they will still be included in libjingle_peerconnection_so.so and
210*d9f75844SAndroid Build Coastguard Worker  # WebRTC.framework)
211*d9f75844SAndroid Build Coastguard Worker  rtc_include_builtin_audio_codecs = true
212*d9f75844SAndroid Build Coastguard Worker
213*d9f75844SAndroid Build Coastguard Worker  # When set to false, builtin video encoder/decoder factories and all the
214*d9f75844SAndroid Build Coastguard Worker  # video codecs they depends on will not be included in libwebrtc.{a|lib}
215*d9f75844SAndroid Build Coastguard Worker  # (they will still be included in libjingle_peerconnection_so.so and
216*d9f75844SAndroid Build Coastguard Worker  # WebRTC.framework)
217*d9f75844SAndroid Build Coastguard Worker  rtc_include_builtin_video_codecs = true
218*d9f75844SAndroid Build Coastguard Worker
219*d9f75844SAndroid Build Coastguard Worker  # When set to true and in a standalone build, it will undefine UNICODE and
220*d9f75844SAndroid Build Coastguard Worker  # _UNICODE (which are always defined globally by the Chromium Windows
221*d9f75844SAndroid Build Coastguard Worker  # toolchain).
222*d9f75844SAndroid Build Coastguard Worker  # This is only needed for testing purposes, WebRTC wants to be sure it
223*d9f75844SAndroid Build Coastguard Worker  # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses
224*d9f75844SAndroid Build Coastguard Worker  # wide character functions.
225*d9f75844SAndroid Build Coastguard Worker  rtc_win_undef_unicode = false
226*d9f75844SAndroid Build Coastguard Worker
227*d9f75844SAndroid Build Coastguard Worker  # When set to true, a capturer implementation that uses the
228*d9f75844SAndroid Build Coastguard Worker  # Windows.Graphics.Capture APIs will be available for use. This introduces a
229*d9f75844SAndroid Build Coastguard Worker  # dependency on the Win 10 SDK v10.0.17763.0.
230*d9f75844SAndroid Build Coastguard Worker  rtc_enable_win_wgc = is_win
231*d9f75844SAndroid Build Coastguard Worker
232*d9f75844SAndroid Build Coastguard Worker  # Includes the dav1d decoder in the internal decoder factory when set to true.
233*d9f75844SAndroid Build Coastguard Worker  rtc_include_dav1d_in_internal_decoder_factory = true
234*d9f75844SAndroid Build Coastguard Worker
235*d9f75844SAndroid Build Coastguard Worker  # When set to true, a run-time check will make sure that all field trial keys
236*d9f75844SAndroid Build Coastguard Worker  # have been registered in accordance with the field trial policy. The check
237*d9f75844SAndroid Build Coastguard Worker  # will only run with builds that have RTC_DCHECKs enabled.
238*d9f75844SAndroid Build Coastguard Worker  rtc_strict_field_trials = false
239*d9f75844SAndroid Build Coastguard Worker}
240*d9f75844SAndroid Build Coastguard Worker
241*d9f75844SAndroid Build Coastguard Workerif (!build_with_mozilla) {
242*d9f75844SAndroid Build Coastguard Worker  import("//testing/test.gni")
243*d9f75844SAndroid Build Coastguard Worker}
244*d9f75844SAndroid Build Coastguard Worker
245*d9f75844SAndroid Build Coastguard Worker# A second declare_args block, so that declarations within it can
246*d9f75844SAndroid Build Coastguard Worker# depend on the possibly overridden variables in the first
247*d9f75844SAndroid Build Coastguard Worker# declare_args block.
248*d9f75844SAndroid Build Coastguard Workerdeclare_args() {
249*d9f75844SAndroid Build Coastguard Worker  # Enables the use of protocol buffers for debug recordings.
250*d9f75844SAndroid Build Coastguard Worker  rtc_enable_protobuf = !build_with_mozilla
251*d9f75844SAndroid Build Coastguard Worker
252*d9f75844SAndroid Build Coastguard Worker  # Set this to disable building with support for SCTP data channels.
253*d9f75844SAndroid Build Coastguard Worker  rtc_enable_sctp = !build_with_mozilla
254*d9f75844SAndroid Build Coastguard Worker
255*d9f75844SAndroid Build Coastguard Worker  # Disable these to not build components which can be externally provided.
256*d9f75844SAndroid Build Coastguard Worker  rtc_build_json = !build_with_mozilla
257*d9f75844SAndroid Build Coastguard Worker  rtc_build_libsrtp = !build_with_mozilla
258*d9f75844SAndroid Build Coastguard Worker  rtc_build_libvpx = !build_with_mozilla
259*d9f75844SAndroid Build Coastguard Worker  rtc_libvpx_build_vp9 = !build_with_mozilla
260*d9f75844SAndroid Build Coastguard Worker  rtc_build_opus = !build_with_mozilla
261*d9f75844SAndroid Build Coastguard Worker  rtc_build_ssl = !build_with_mozilla
262*d9f75844SAndroid Build Coastguard Worker
263*d9f75844SAndroid Build Coastguard Worker  # Enable libevent task queues on platforms that support it.
264*d9f75844SAndroid Build Coastguard Worker  if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
265*d9f75844SAndroid Build Coastguard Worker      target_cpu == "wasm") {
266*d9f75844SAndroid Build Coastguard Worker    rtc_enable_libevent = false
267*d9f75844SAndroid Build Coastguard Worker    rtc_build_libevent = false
268*d9f75844SAndroid Build Coastguard Worker  } else {
269*d9f75844SAndroid Build Coastguard Worker    rtc_enable_libevent = true
270*d9f75844SAndroid Build Coastguard Worker    rtc_build_libevent = !build_with_mozilla
271*d9f75844SAndroid Build Coastguard Worker  }
272*d9f75844SAndroid Build Coastguard Worker
273*d9f75844SAndroid Build Coastguard Worker  # Excluded in Chromium since its prerequisites don't require Pulse Audio.
274*d9f75844SAndroid Build Coastguard Worker  rtc_include_pulse_audio = !build_with_chromium
275*d9f75844SAndroid Build Coastguard Worker
276*d9f75844SAndroid Build Coastguard Worker  # Chromium uses its own IO handling, so the internal ADM is only built for
277*d9f75844SAndroid Build Coastguard Worker  # standalone WebRTC.
278*d9f75844SAndroid Build Coastguard Worker  rtc_include_internal_audio_device = !build_with_chromium
279*d9f75844SAndroid Build Coastguard Worker
280*d9f75844SAndroid Build Coastguard Worker  # Set this to true to enable the avx2 support in webrtc.
281*d9f75844SAndroid Build Coastguard Worker  # TODO: Make sure that AVX2 works also for non-clang compilers.
282*d9f75844SAndroid Build Coastguard Worker  if (is_clang == true) {
283*d9f75844SAndroid Build Coastguard Worker    rtc_enable_avx2 = true
284*d9f75844SAndroid Build Coastguard Worker  } else {
285*d9f75844SAndroid Build Coastguard Worker    rtc_enable_avx2 = false
286*d9f75844SAndroid Build Coastguard Worker  }
287*d9f75844SAndroid Build Coastguard Worker
288*d9f75844SAndroid Build Coastguard Worker  # Set this to true to build the unit tests.
289*d9f75844SAndroid Build Coastguard Worker  # Disabled when building with Chromium or Mozilla.
290*d9f75844SAndroid Build Coastguard Worker  rtc_include_tests = !build_with_chromium && !build_with_mozilla
291*d9f75844SAndroid Build Coastguard Worker
292*d9f75844SAndroid Build Coastguard Worker  # Set this to false to skip building code that also requires X11 extensions
293*d9f75844SAndroid Build Coastguard Worker  # such as Xdamage, Xfixes.
294*d9f75844SAndroid Build Coastguard Worker  rtc_use_x11_extensions = rtc_use_x11
295*d9f75844SAndroid Build Coastguard Worker
296*d9f75844SAndroid Build Coastguard Worker  # Set this to true to fully remove logging from WebRTC.
297*d9f75844SAndroid Build Coastguard Worker  rtc_disable_logging = false
298*d9f75844SAndroid Build Coastguard Worker
299*d9f75844SAndroid Build Coastguard Worker  # Set this to true to disable trace events.
300*d9f75844SAndroid Build Coastguard Worker  rtc_disable_trace_events = false
301*d9f75844SAndroid Build Coastguard Worker
302*d9f75844SAndroid Build Coastguard Worker  # Set this to true to disable detailed error message and logging for
303*d9f75844SAndroid Build Coastguard Worker  # RTC_CHECKs.
304*d9f75844SAndroid Build Coastguard Worker  rtc_disable_check_msg = false
305*d9f75844SAndroid Build Coastguard Worker
306*d9f75844SAndroid Build Coastguard Worker  # Set this to true to disable webrtc metrics.
307*d9f75844SAndroid Build Coastguard Worker  rtc_disable_metrics = false
308*d9f75844SAndroid Build Coastguard Worker
309*d9f75844SAndroid Build Coastguard Worker  # Set this to true to exclude the transient suppressor in the audio processing
310*d9f75844SAndroid Build Coastguard Worker  # module from the build.
311*d9f75844SAndroid Build Coastguard Worker  rtc_exclude_transient_suppressor = false
312*d9f75844SAndroid Build Coastguard Worker}
313*d9f75844SAndroid Build Coastguard Worker
314*d9f75844SAndroid Build Coastguard Workerdeclare_args() {
315*d9f75844SAndroid Build Coastguard Worker  # Enable the dcsctp backend for DataChannels and related unittests
316*d9f75844SAndroid Build Coastguard Worker  rtc_build_dcsctp = !build_with_mozilla && rtc_enable_sctp
317*d9f75844SAndroid Build Coastguard Worker
318*d9f75844SAndroid Build Coastguard Worker  # Enable gRPC used for negotiation in multiprocess tests
319*d9f75844SAndroid Build Coastguard Worker  rtc_enable_grpc = rtc_enable_protobuf && (is_linux || is_mac)
320*d9f75844SAndroid Build Coastguard Worker}
321*d9f75844SAndroid Build Coastguard Worker
322*d9f75844SAndroid Build Coastguard Worker# Make it possible to provide custom locations for some libraries (move these
323*d9f75844SAndroid Build Coastguard Worker# up into declare_args should we need to actually use them for the GN build).
324*d9f75844SAndroid Build Coastguard Workerrtc_libvpx_dir = "//third_party/libvpx"
325*d9f75844SAndroid Build Coastguard Workerrtc_opus_dir = "//third_party/opus"
326*d9f75844SAndroid Build Coastguard Worker
327*d9f75844SAndroid Build Coastguard Worker# Desktop capturer is supported only on Windows, OSX and Linux.
328*d9f75844SAndroid Build Coastguard Workerrtc_desktop_capture_supported =
329*d9f75844SAndroid Build Coastguard Worker    (is_win && current_os != "winuwp") || is_mac ||
330*d9f75844SAndroid Build Coastguard Worker    ((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))
331*d9f75844SAndroid Build Coastguard Worker
332*d9f75844SAndroid Build Coastguard Worker###############################################################################
333*d9f75844SAndroid Build Coastguard Worker# Templates
334*d9f75844SAndroid Build Coastguard Worker#
335*d9f75844SAndroid Build Coastguard Worker
336*d9f75844SAndroid Build Coastguard Worker# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
337*d9f75844SAndroid Build Coastguard Worker# chromium.
338*d9f75844SAndroid Build Coastguard Worker# We need absolute paths for all configs in templates as they are shared in
339*d9f75844SAndroid Build Coastguard Worker# different subdirectories.
340*d9f75844SAndroid Build Coastguard Workerwebrtc_root = get_path_info(".", "abspath")
341*d9f75844SAndroid Build Coastguard Worker
342*d9f75844SAndroid Build Coastguard Worker# Global configuration that should be applied to all WebRTC targets.
343*d9f75844SAndroid Build Coastguard Worker# You normally shouldn't need to include this in your target as it's
344*d9f75844SAndroid Build Coastguard Worker# automatically included when using the rtc_* templates.
345*d9f75844SAndroid Build Coastguard Worker# It sets defines, include paths and compilation warnings accordingly,
346*d9f75844SAndroid Build Coastguard Worker# both for WebRTC stand-alone builds and for the scenario when WebRTC
347*d9f75844SAndroid Build Coastguard Worker# native code is built as part of Chromium.
348*d9f75844SAndroid Build Coastguard Workerrtc_common_configs = [ webrtc_root + ":common_config" ]
349*d9f75844SAndroid Build Coastguard Worker
350*d9f75844SAndroid Build Coastguard Workerif (is_mac || is_ios) {
351*d9f75844SAndroid Build Coastguard Worker  rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
352*d9f75844SAndroid Build Coastguard Worker}
353*d9f75844SAndroid Build Coastguard Worker
354*d9f75844SAndroid Build Coastguard Worker# Global public configuration that should be applied to all WebRTC targets. You
355*d9f75844SAndroid Build Coastguard Worker# normally shouldn't need to include this in your target as it's automatically
356*d9f75844SAndroid Build Coastguard Worker# included when using the rtc_* templates. It set the defines, include paths and
357*d9f75844SAndroid Build Coastguard Worker# compilation warnings that should be propagated to dependents of the targets
358*d9f75844SAndroid Build Coastguard Worker# depending on the target having this config.
359*d9f75844SAndroid Build Coastguard Workerrtc_common_inherited_config = webrtc_root + ":common_inherited_config"
360*d9f75844SAndroid Build Coastguard Worker
361*d9f75844SAndroid Build Coastguard Worker# Common configs to remove or add in all rtc targets.
362*d9f75844SAndroid Build Coastguard Workerrtc_remove_configs = []
363*d9f75844SAndroid Build Coastguard Workerif (!build_with_chromium && is_clang) {
364*d9f75844SAndroid Build Coastguard Worker  rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
365*d9f75844SAndroid Build Coastguard Worker}
366*d9f75844SAndroid Build Coastguard Workerrtc_add_configs = rtc_common_configs
367*d9f75844SAndroid Build Coastguard Workerrtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
368*d9f75844SAndroid Build Coastguard Workerrtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
369*d9f75844SAndroid Build Coastguard Worker
370*d9f75844SAndroid Build Coastguard Workerset_defaults("rtc_test") {
371*d9f75844SAndroid Build Coastguard Worker  configs = rtc_add_configs
372*d9f75844SAndroid Build Coastguard Worker  suppressed_configs = []
373*d9f75844SAndroid Build Coastguard Worker}
374*d9f75844SAndroid Build Coastguard Worker
375*d9f75844SAndroid Build Coastguard Workerset_defaults("rtc_library") {
376*d9f75844SAndroid Build Coastguard Worker  configs = rtc_add_configs
377*d9f75844SAndroid Build Coastguard Worker  suppressed_configs = []
378*d9f75844SAndroid Build Coastguard Worker  absl_deps = []
379*d9f75844SAndroid Build Coastguard Worker}
380*d9f75844SAndroid Build Coastguard Worker
381*d9f75844SAndroid Build Coastguard Workerset_defaults("rtc_source_set") {
382*d9f75844SAndroid Build Coastguard Worker  configs = rtc_add_configs
383*d9f75844SAndroid Build Coastguard Worker  suppressed_configs = []
384*d9f75844SAndroid Build Coastguard Worker  absl_deps = []
385*d9f75844SAndroid Build Coastguard Worker}
386*d9f75844SAndroid Build Coastguard Worker
387*d9f75844SAndroid Build Coastguard Workerset_defaults("rtc_static_library") {
388*d9f75844SAndroid Build Coastguard Worker  configs = rtc_add_configs
389*d9f75844SAndroid Build Coastguard Worker  suppressed_configs = []
390*d9f75844SAndroid Build Coastguard Worker  absl_deps = []
391*d9f75844SAndroid Build Coastguard Worker}
392*d9f75844SAndroid Build Coastguard Worker
393*d9f75844SAndroid Build Coastguard Workerset_defaults("rtc_executable") {
394*d9f75844SAndroid Build Coastguard Worker  configs = rtc_add_configs
395*d9f75844SAndroid Build Coastguard Worker  suppressed_configs = []
396*d9f75844SAndroid Build Coastguard Worker}
397*d9f75844SAndroid Build Coastguard Worker
398*d9f75844SAndroid Build Coastguard Workerset_defaults("rtc_shared_library") {
399*d9f75844SAndroid Build Coastguard Worker  configs = rtc_add_configs
400*d9f75844SAndroid Build Coastguard Worker  suppressed_configs = []
401*d9f75844SAndroid Build Coastguard Worker}
402*d9f75844SAndroid Build Coastguard Worker
403*d9f75844SAndroid Build Coastguard Workerwebrtc_default_visibility = [ webrtc_root + "/*" ]
404*d9f75844SAndroid Build Coastguard Workerif (build_with_chromium) {
405*d9f75844SAndroid Build Coastguard Worker  # Allow Chromium's WebRTC overrides targets to bypass the regular
406*d9f75844SAndroid Build Coastguard Worker  # visibility restrictions.
407*d9f75844SAndroid Build Coastguard Worker  webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
408*d9f75844SAndroid Build Coastguard Worker}
409*d9f75844SAndroid Build Coastguard Worker
410*d9f75844SAndroid Build Coastguard Worker# ---- Poisons ----
411*d9f75844SAndroid Build Coastguard Worker#
412*d9f75844SAndroid Build Coastguard Worker# The general idea is that some targets declare that they contain some
413*d9f75844SAndroid Build Coastguard Worker# kind of poison, which makes it impossible for other targets to
414*d9f75844SAndroid Build Coastguard Worker# depend on them (even transitively) unless they declare themselves
415*d9f75844SAndroid Build Coastguard Worker# immune to that particular type of poison.
416*d9f75844SAndroid Build Coastguard Worker#
417*d9f75844SAndroid Build Coastguard Worker# Targets that *contain* poison of type foo should contain the line
418*d9f75844SAndroid Build Coastguard Worker#
419*d9f75844SAndroid Build Coastguard Worker#   poisonous = [ "foo" ]
420*d9f75844SAndroid Build Coastguard Worker#
421*d9f75844SAndroid Build Coastguard Worker# and targets that *are immune but arent't themselves poisonous*
422*d9f75844SAndroid Build Coastguard Worker# should contain
423*d9f75844SAndroid Build Coastguard Worker#
424*d9f75844SAndroid Build Coastguard Worker#   allow_poison = [ "foo" ]
425*d9f75844SAndroid Build Coastguard Worker#
426*d9f75844SAndroid Build Coastguard Worker# This useful in cases where we have some large target or set of
427*d9f75844SAndroid Build Coastguard Worker# targets and want to ensure that most other targets do not
428*d9f75844SAndroid Build Coastguard Worker# transitively depend on them. For example, almost no high-level
429*d9f75844SAndroid Build Coastguard Worker# target should depend on the audio codecs, since we want WebRTC users
430*d9f75844SAndroid Build Coastguard Worker# to be able to inject any subset of them and actually end up with a
431*d9f75844SAndroid Build Coastguard Worker# binary that doesn't include the codecs they didn't inject.
432*d9f75844SAndroid Build Coastguard Worker#
433*d9f75844SAndroid Build Coastguard Worker# Test-only targets (`testonly` set to true) and non-public targets
434*d9f75844SAndroid Build Coastguard Worker# (`visibility` not containing "*") are automatically immune to all
435*d9f75844SAndroid Build Coastguard Worker# types of poison.
436*d9f75844SAndroid Build Coastguard Worker#
437*d9f75844SAndroid Build Coastguard Worker# Here's the complete list of all types of poison. It must be kept in
438*d9f75844SAndroid Build Coastguard Worker# 1:1 correspondence with the set of //:poison_* targets.
439*d9f75844SAndroid Build Coastguard Worker#
440*d9f75844SAndroid Build Coastguard Workerall_poison_types = [
441*d9f75844SAndroid Build Coastguard Worker  # Encoders and decoders for specific audio codecs such as Opus and iSAC.
442*d9f75844SAndroid Build Coastguard Worker  "audio_codecs",
443*d9f75844SAndroid Build Coastguard Worker
444*d9f75844SAndroid Build Coastguard Worker  # Default task queue implementation.
445*d9f75844SAndroid Build Coastguard Worker  "default_task_queue",
446*d9f75844SAndroid Build Coastguard Worker
447*d9f75844SAndroid Build Coastguard Worker  # Default echo detector implementation.
448*d9f75844SAndroid Build Coastguard Worker  "default_echo_detector",
449*d9f75844SAndroid Build Coastguard Worker
450*d9f75844SAndroid Build Coastguard Worker  # JSON parsing should not be needed in the "slim and modular" WebRTC.
451*d9f75844SAndroid Build Coastguard Worker  "rtc_json",
452*d9f75844SAndroid Build Coastguard Worker
453*d9f75844SAndroid Build Coastguard Worker  # Software video codecs (VP8 and VP9 through libvpx).
454*d9f75844SAndroid Build Coastguard Worker  "software_video_codecs",
455*d9f75844SAndroid Build Coastguard Worker]
456*d9f75844SAndroid Build Coastguard Worker
457*d9f75844SAndroid Build Coastguard Workerabsl_include_config = "//third_party/abseil-cpp:absl_include_config"
458*d9f75844SAndroid Build Coastguard Workerabsl_define_config = "//third_party/abseil-cpp:absl_define_config"
459*d9f75844SAndroid Build Coastguard Worker
460*d9f75844SAndroid Build Coastguard Worker# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
461*d9f75844SAndroid Build Coastguard Worker# that are testonly.
462*d9f75844SAndroid Build Coastguard Workerabsl_flags_config = webrtc_root + ":absl_flags_configs"
463*d9f75844SAndroid Build Coastguard Worker
464*d9f75844SAndroid Build Coastguard Worker# WebRTC wrapper of Chromium's test() template. This template just adds some
465*d9f75844SAndroid Build Coastguard Worker# WebRTC only configuration in order to avoid to duplicate it for every WebRTC
466*d9f75844SAndroid Build Coastguard Worker# target.
467*d9f75844SAndroid Build Coastguard Worker# The parameter `is_xctest` is different from the one in the Chromium's test()
468*d9f75844SAndroid Build Coastguard Worker# template (and it is not forwarded to it). In rtc_test(), the argument
469*d9f75844SAndroid Build Coastguard Worker# `is_xctest` is used to avoid to take dependencies that are not needed
470*d9f75844SAndroid Build Coastguard Worker# in case the test is a real XCTest (using the XCTest framework).
471*d9f75844SAndroid Build Coastguard Workertemplate("rtc_test") {
472*d9f75844SAndroid Build Coastguard Worker  test(target_name) {
473*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker,
474*d9f75844SAndroid Build Coastguard Worker                           "*",
475*d9f75844SAndroid Build Coastguard Worker                           [
476*d9f75844SAndroid Build Coastguard Worker                             "configs",
477*d9f75844SAndroid Build Coastguard Worker                             "is_xctest",
478*d9f75844SAndroid Build Coastguard Worker                             "public_configs",
479*d9f75844SAndroid Build Coastguard Worker                             "suppressed_configs",
480*d9f75844SAndroid Build Coastguard Worker                             "visibility",
481*d9f75844SAndroid Build Coastguard Worker                           ])
482*d9f75844SAndroid Build Coastguard Worker
483*d9f75844SAndroid Build Coastguard Worker    # Always override to public because when target_os is Android the `test`
484*d9f75844SAndroid Build Coastguard Worker    # template can override it to [ "*" ] and we want to avoid conditional
485*d9f75844SAndroid Build Coastguard Worker    # visibility.
486*d9f75844SAndroid Build Coastguard Worker    visibility = [ "*" ]
487*d9f75844SAndroid Build Coastguard Worker    configs += invoker.configs
488*d9f75844SAndroid Build Coastguard Worker    configs -= rtc_remove_configs
489*d9f75844SAndroid Build Coastguard Worker    configs -= invoker.suppressed_configs
490*d9f75844SAndroid Build Coastguard Worker    public_configs = [
491*d9f75844SAndroid Build Coastguard Worker      rtc_common_inherited_config,
492*d9f75844SAndroid Build Coastguard Worker      absl_include_config,
493*d9f75844SAndroid Build Coastguard Worker      absl_define_config,
494*d9f75844SAndroid Build Coastguard Worker      absl_flags_config,
495*d9f75844SAndroid Build Coastguard Worker    ]
496*d9f75844SAndroid Build Coastguard Worker    if (defined(invoker.public_configs)) {
497*d9f75844SAndroid Build Coastguard Worker      public_configs += invoker.public_configs
498*d9f75844SAndroid Build Coastguard Worker    }
499*d9f75844SAndroid Build Coastguard Worker    if (!build_with_chromium && is_android) {
500*d9f75844SAndroid Build Coastguard Worker      android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
501*d9f75844SAndroid Build Coastguard Worker      use_raw_android_executable = false
502*d9f75844SAndroid Build Coastguard Worker      min_sdk_version = 21
503*d9f75844SAndroid Build Coastguard Worker      target_sdk_version = 23
504*d9f75844SAndroid Build Coastguard Worker      deps += [
505*d9f75844SAndroid Build Coastguard Worker        "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
506*d9f75844SAndroid Build Coastguard Worker        webrtc_root + "test:native_test_java",
507*d9f75844SAndroid Build Coastguard Worker      ]
508*d9f75844SAndroid Build Coastguard Worker    }
509*d9f75844SAndroid Build Coastguard Worker
510*d9f75844SAndroid Build Coastguard Worker    # Build //test:google_test_runner_objc when the test is not a real XCTest.
511*d9f75844SAndroid Build Coastguard Worker    if (is_ios && rtc_include_tests) {
512*d9f75844SAndroid Build Coastguard Worker      if (!defined(invoker.is_xctest) || !invoker.is_xctest) {
513*d9f75844SAndroid Build Coastguard Worker        xctest_module_target = "//test:google_test_runner_objc"
514*d9f75844SAndroid Build Coastguard Worker      }
515*d9f75844SAndroid Build Coastguard Worker    }
516*d9f75844SAndroid Build Coastguard Worker
517*d9f75844SAndroid Build Coastguard Worker    # If absl_deps is [], no action is needed. If not [], then it needs to be
518*d9f75844SAndroid Build Coastguard Worker    # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
519*d9f75844SAndroid Build Coastguard Worker    # otherwise it just needs to be added to deps.
520*d9f75844SAndroid Build Coastguard Worker    if (defined(absl_deps) && absl_deps != []) {
521*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
522*d9f75844SAndroid Build Coastguard Worker        deps = []
523*d9f75844SAndroid Build Coastguard Worker      }
524*d9f75844SAndroid Build Coastguard Worker      if (build_with_chromium) {
525*d9f75844SAndroid Build Coastguard Worker        deps += [ "//third_party/abseil-cpp:absl" ]
526*d9f75844SAndroid Build Coastguard Worker      } else {
527*d9f75844SAndroid Build Coastguard Worker        deps += absl_deps
528*d9f75844SAndroid Build Coastguard Worker      }
529*d9f75844SAndroid Build Coastguard Worker    }
530*d9f75844SAndroid Build Coastguard Worker
531*d9f75844SAndroid Build Coastguard Worker    # TODO(crbug.com/webrtc/13556): Adding the .app folder in the runtime_deps
532*d9f75844SAndroid Build Coastguard Worker    # shoulnd't be necessary. this code should be removed and the same solution
533*d9f75844SAndroid Build Coastguard Worker    # as Chromium should be used.
534*d9f75844SAndroid Build Coastguard Worker    if (is_ios) {
535*d9f75844SAndroid Build Coastguard Worker      if (!defined(invoker.data)) {
536*d9f75844SAndroid Build Coastguard Worker        data = []
537*d9f75844SAndroid Build Coastguard Worker      }
538*d9f75844SAndroid Build Coastguard Worker      data += [ "${root_out_dir}/${target_name}.app" ]
539*d9f75844SAndroid Build Coastguard Worker    }
540*d9f75844SAndroid Build Coastguard Worker  }
541*d9f75844SAndroid Build Coastguard Worker}
542*d9f75844SAndroid Build Coastguard Worker
543*d9f75844SAndroid Build Coastguard Workertemplate("rtc_source_set") {
544*d9f75844SAndroid Build Coastguard Worker  source_set(target_name) {
545*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker,
546*d9f75844SAndroid Build Coastguard Worker                           "*",
547*d9f75844SAndroid Build Coastguard Worker                           [
548*d9f75844SAndroid Build Coastguard Worker                             "configs",
549*d9f75844SAndroid Build Coastguard Worker                             "public_configs",
550*d9f75844SAndroid Build Coastguard Worker                             "suppressed_configs",
551*d9f75844SAndroid Build Coastguard Worker                             "visibility",
552*d9f75844SAndroid Build Coastguard Worker                           ])
553*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker, [ "visibility" ])
554*d9f75844SAndroid Build Coastguard Worker    if (!defined(visibility)) {
555*d9f75844SAndroid Build Coastguard Worker      visibility = webrtc_default_visibility
556*d9f75844SAndroid Build Coastguard Worker    }
557*d9f75844SAndroid Build Coastguard Worker
558*d9f75844SAndroid Build Coastguard Worker    # What's your poison?
559*d9f75844SAndroid Build Coastguard Worker    if (defined(testonly) && testonly) {
560*d9f75844SAndroid Build Coastguard Worker      assert(!defined(poisonous))
561*d9f75844SAndroid Build Coastguard Worker      assert(!defined(allow_poison))
562*d9f75844SAndroid Build Coastguard Worker    } else {
563*d9f75844SAndroid Build Coastguard Worker      if (!defined(poisonous)) {
564*d9f75844SAndroid Build Coastguard Worker        poisonous = []
565*d9f75844SAndroid Build Coastguard Worker      }
566*d9f75844SAndroid Build Coastguard Worker      if (!defined(allow_poison)) {
567*d9f75844SAndroid Build Coastguard Worker        allow_poison = []
568*d9f75844SAndroid Build Coastguard Worker      }
569*d9f75844SAndroid Build Coastguard Worker      if (!defined(assert_no_deps)) {
570*d9f75844SAndroid Build Coastguard Worker        assert_no_deps = []
571*d9f75844SAndroid Build Coastguard Worker      }
572*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
573*d9f75844SAndroid Build Coastguard Worker        deps = []
574*d9f75844SAndroid Build Coastguard Worker      }
575*d9f75844SAndroid Build Coastguard Worker      foreach(p, poisonous) {
576*d9f75844SAndroid Build Coastguard Worker        deps += [ webrtc_root + ":poison_" + p ]
577*d9f75844SAndroid Build Coastguard Worker      }
578*d9f75844SAndroid Build Coastguard Worker      foreach(poison_type, all_poison_types) {
579*d9f75844SAndroid Build Coastguard Worker        allow_dep = true
580*d9f75844SAndroid Build Coastguard Worker        foreach(v, visibility) {
581*d9f75844SAndroid Build Coastguard Worker          if (v == "*") {
582*d9f75844SAndroid Build Coastguard Worker            allow_dep = false
583*d9f75844SAndroid Build Coastguard Worker          }
584*d9f75844SAndroid Build Coastguard Worker        }
585*d9f75844SAndroid Build Coastguard Worker        foreach(p, allow_poison + poisonous) {
586*d9f75844SAndroid Build Coastguard Worker          if (p == poison_type) {
587*d9f75844SAndroid Build Coastguard Worker            allow_dep = true
588*d9f75844SAndroid Build Coastguard Worker          }
589*d9f75844SAndroid Build Coastguard Worker        }
590*d9f75844SAndroid Build Coastguard Worker        if (!allow_dep) {
591*d9f75844SAndroid Build Coastguard Worker          assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
592*d9f75844SAndroid Build Coastguard Worker        }
593*d9f75844SAndroid Build Coastguard Worker      }
594*d9f75844SAndroid Build Coastguard Worker    }
595*d9f75844SAndroid Build Coastguard Worker
596*d9f75844SAndroid Build Coastguard Worker    # Chromium should only depend on the WebRTC component in order to
597*d9f75844SAndroid Build Coastguard Worker    # avoid to statically link WebRTC in a component build.
598*d9f75844SAndroid Build Coastguard Worker    if (build_with_chromium) {
599*d9f75844SAndroid Build Coastguard Worker      publicly_visible = false
600*d9f75844SAndroid Build Coastguard Worker      foreach(v, visibility) {
601*d9f75844SAndroid Build Coastguard Worker        if (v == "*") {
602*d9f75844SAndroid Build Coastguard Worker          publicly_visible = true
603*d9f75844SAndroid Build Coastguard Worker        }
604*d9f75844SAndroid Build Coastguard Worker      }
605*d9f75844SAndroid Build Coastguard Worker      if (publicly_visible) {
606*d9f75844SAndroid Build Coastguard Worker        visibility = []
607*d9f75844SAndroid Build Coastguard Worker        visibility = webrtc_default_visibility
608*d9f75844SAndroid Build Coastguard Worker      }
609*d9f75844SAndroid Build Coastguard Worker    }
610*d9f75844SAndroid Build Coastguard Worker
611*d9f75844SAndroid Build Coastguard Worker    if (!defined(testonly) || !testonly) {
612*d9f75844SAndroid Build Coastguard Worker      configs += rtc_prod_configs
613*d9f75844SAndroid Build Coastguard Worker    }
614*d9f75844SAndroid Build Coastguard Worker
615*d9f75844SAndroid Build Coastguard Worker    configs += invoker.configs
616*d9f75844SAndroid Build Coastguard Worker    configs += rtc_library_impl_config
617*d9f75844SAndroid Build Coastguard Worker    configs -= rtc_remove_configs
618*d9f75844SAndroid Build Coastguard Worker    configs -= invoker.suppressed_configs
619*d9f75844SAndroid Build Coastguard Worker    public_configs = [
620*d9f75844SAndroid Build Coastguard Worker      rtc_common_inherited_config,
621*d9f75844SAndroid Build Coastguard Worker      absl_include_config,
622*d9f75844SAndroid Build Coastguard Worker      absl_define_config,
623*d9f75844SAndroid Build Coastguard Worker    ]
624*d9f75844SAndroid Build Coastguard Worker    if (defined(testonly) && testonly) {
625*d9f75844SAndroid Build Coastguard Worker      public_configs += [ absl_flags_config ]
626*d9f75844SAndroid Build Coastguard Worker    }
627*d9f75844SAndroid Build Coastguard Worker    if (defined(invoker.public_configs)) {
628*d9f75844SAndroid Build Coastguard Worker      public_configs += invoker.public_configs
629*d9f75844SAndroid Build Coastguard Worker    }
630*d9f75844SAndroid Build Coastguard Worker
631*d9f75844SAndroid Build Coastguard Worker    # If absl_deps is [], no action is needed. If not [], then it needs to be
632*d9f75844SAndroid Build Coastguard Worker    # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
633*d9f75844SAndroid Build Coastguard Worker    # otherwise it just needs to be added to deps.
634*d9f75844SAndroid Build Coastguard Worker    if (absl_deps != []) {
635*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
636*d9f75844SAndroid Build Coastguard Worker        deps = []
637*d9f75844SAndroid Build Coastguard Worker      }
638*d9f75844SAndroid Build Coastguard Worker      if (build_with_chromium) {
639*d9f75844SAndroid Build Coastguard Worker        deps += [ "//third_party/abseil-cpp:absl" ]
640*d9f75844SAndroid Build Coastguard Worker      } else {
641*d9f75844SAndroid Build Coastguard Worker        deps += absl_deps
642*d9f75844SAndroid Build Coastguard Worker      }
643*d9f75844SAndroid Build Coastguard Worker    }
644*d9f75844SAndroid Build Coastguard Worker  }
645*d9f75844SAndroid Build Coastguard Worker}
646*d9f75844SAndroid Build Coastguard Worker
647*d9f75844SAndroid Build Coastguard Workertemplate("rtc_static_library") {
648*d9f75844SAndroid Build Coastguard Worker  static_library(target_name) {
649*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker,
650*d9f75844SAndroid Build Coastguard Worker                           "*",
651*d9f75844SAndroid Build Coastguard Worker                           [
652*d9f75844SAndroid Build Coastguard Worker                             "configs",
653*d9f75844SAndroid Build Coastguard Worker                             "public_configs",
654*d9f75844SAndroid Build Coastguard Worker                             "suppressed_configs",
655*d9f75844SAndroid Build Coastguard Worker                             "visibility",
656*d9f75844SAndroid Build Coastguard Worker                           ])
657*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker, [ "visibility" ])
658*d9f75844SAndroid Build Coastguard Worker    if (!defined(visibility)) {
659*d9f75844SAndroid Build Coastguard Worker      visibility = webrtc_default_visibility
660*d9f75844SAndroid Build Coastguard Worker    }
661*d9f75844SAndroid Build Coastguard Worker
662*d9f75844SAndroid Build Coastguard Worker    # What's your poison?
663*d9f75844SAndroid Build Coastguard Worker    if (defined(testonly) && testonly) {
664*d9f75844SAndroid Build Coastguard Worker      assert(!defined(poisonous))
665*d9f75844SAndroid Build Coastguard Worker      assert(!defined(allow_poison))
666*d9f75844SAndroid Build Coastguard Worker    } else {
667*d9f75844SAndroid Build Coastguard Worker      if (!defined(poisonous)) {
668*d9f75844SAndroid Build Coastguard Worker        poisonous = []
669*d9f75844SAndroid Build Coastguard Worker      }
670*d9f75844SAndroid Build Coastguard Worker      if (!defined(allow_poison)) {
671*d9f75844SAndroid Build Coastguard Worker        allow_poison = []
672*d9f75844SAndroid Build Coastguard Worker      }
673*d9f75844SAndroid Build Coastguard Worker      if (!defined(assert_no_deps)) {
674*d9f75844SAndroid Build Coastguard Worker        assert_no_deps = []
675*d9f75844SAndroid Build Coastguard Worker      }
676*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
677*d9f75844SAndroid Build Coastguard Worker        deps = []
678*d9f75844SAndroid Build Coastguard Worker      }
679*d9f75844SAndroid Build Coastguard Worker      foreach(p, poisonous) {
680*d9f75844SAndroid Build Coastguard Worker        deps += [ webrtc_root + ":poison_" + p ]
681*d9f75844SAndroid Build Coastguard Worker      }
682*d9f75844SAndroid Build Coastguard Worker      foreach(poison_type, all_poison_types) {
683*d9f75844SAndroid Build Coastguard Worker        allow_dep = true
684*d9f75844SAndroid Build Coastguard Worker        foreach(v, visibility) {
685*d9f75844SAndroid Build Coastguard Worker          if (v == "*") {
686*d9f75844SAndroid Build Coastguard Worker            allow_dep = false
687*d9f75844SAndroid Build Coastguard Worker          }
688*d9f75844SAndroid Build Coastguard Worker        }
689*d9f75844SAndroid Build Coastguard Worker        foreach(p, allow_poison + poisonous) {
690*d9f75844SAndroid Build Coastguard Worker          if (p == poison_type) {
691*d9f75844SAndroid Build Coastguard Worker            allow_dep = true
692*d9f75844SAndroid Build Coastguard Worker          }
693*d9f75844SAndroid Build Coastguard Worker        }
694*d9f75844SAndroid Build Coastguard Worker        if (!allow_dep) {
695*d9f75844SAndroid Build Coastguard Worker          assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
696*d9f75844SAndroid Build Coastguard Worker        }
697*d9f75844SAndroid Build Coastguard Worker      }
698*d9f75844SAndroid Build Coastguard Worker    }
699*d9f75844SAndroid Build Coastguard Worker
700*d9f75844SAndroid Build Coastguard Worker    if (!defined(testonly) || !testonly) {
701*d9f75844SAndroid Build Coastguard Worker      configs += rtc_prod_configs
702*d9f75844SAndroid Build Coastguard Worker    }
703*d9f75844SAndroid Build Coastguard Worker
704*d9f75844SAndroid Build Coastguard Worker    configs += invoker.configs
705*d9f75844SAndroid Build Coastguard Worker    configs += rtc_library_impl_config
706*d9f75844SAndroid Build Coastguard Worker    configs -= rtc_remove_configs
707*d9f75844SAndroid Build Coastguard Worker    configs -= invoker.suppressed_configs
708*d9f75844SAndroid Build Coastguard Worker    public_configs = [
709*d9f75844SAndroid Build Coastguard Worker      rtc_common_inherited_config,
710*d9f75844SAndroid Build Coastguard Worker      absl_include_config,
711*d9f75844SAndroid Build Coastguard Worker      absl_define_config,
712*d9f75844SAndroid Build Coastguard Worker    ]
713*d9f75844SAndroid Build Coastguard Worker    if (defined(testonly) && testonly) {
714*d9f75844SAndroid Build Coastguard Worker      public_configs += [ absl_flags_config ]
715*d9f75844SAndroid Build Coastguard Worker    }
716*d9f75844SAndroid Build Coastguard Worker    if (defined(invoker.public_configs)) {
717*d9f75844SAndroid Build Coastguard Worker      public_configs += invoker.public_configs
718*d9f75844SAndroid Build Coastguard Worker    }
719*d9f75844SAndroid Build Coastguard Worker
720*d9f75844SAndroid Build Coastguard Worker    # If absl_deps is [], no action is needed. If not [], then it needs to be
721*d9f75844SAndroid Build Coastguard Worker    # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
722*d9f75844SAndroid Build Coastguard Worker    # otherwise it just needs to be added to deps.
723*d9f75844SAndroid Build Coastguard Worker    if (absl_deps != []) {
724*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
725*d9f75844SAndroid Build Coastguard Worker        deps = []
726*d9f75844SAndroid Build Coastguard Worker      }
727*d9f75844SAndroid Build Coastguard Worker      if (build_with_chromium) {
728*d9f75844SAndroid Build Coastguard Worker        deps += [ "//third_party/abseil-cpp:absl" ]
729*d9f75844SAndroid Build Coastguard Worker      } else {
730*d9f75844SAndroid Build Coastguard Worker        deps += absl_deps
731*d9f75844SAndroid Build Coastguard Worker      }
732*d9f75844SAndroid Build Coastguard Worker    }
733*d9f75844SAndroid Build Coastguard Worker  }
734*d9f75844SAndroid Build Coastguard Worker}
735*d9f75844SAndroid Build Coastguard Worker
736*d9f75844SAndroid Build Coastguard Worker# This template automatically switches the target type between source_set
737*d9f75844SAndroid Build Coastguard Worker# and static_library.
738*d9f75844SAndroid Build Coastguard Worker#
739*d9f75844SAndroid Build Coastguard Worker# This should be the default target type for all the WebRTC targets.
740*d9f75844SAndroid Build Coastguard Worker#
741*d9f75844SAndroid Build Coastguard Worker# How does it work:
742*d9f75844SAndroid Build Coastguard Worker# Since all files in a source_set are linked into a final binary, while files
743*d9f75844SAndroid Build Coastguard Worker# in a static library are only linked in if at least one symbol in them is
744*d9f75844SAndroid Build Coastguard Worker# referenced, in component builds source_sets are easy to deal with because
745*d9f75844SAndroid Build Coastguard Worker# all their object files are passed to the linker to create a shared library.
746*d9f75844SAndroid Build Coastguard Worker# In release builds instead, static_libraries are preferred since they allow
747*d9f75844SAndroid Build Coastguard Worker# the linker to discard dead code.
748*d9f75844SAndroid Build Coastguard Worker# For the same reason, testonly targets will always be expanded to
749*d9f75844SAndroid Build Coastguard Worker# source_set in order to be sure that tests are present in the test binary.
750*d9f75844SAndroid Build Coastguard Workertemplate("rtc_library") {
751*d9f75844SAndroid Build Coastguard Worker  header_only = true
752*d9f75844SAndroid Build Coastguard Worker  if (defined(invoker.sources)) {
753*d9f75844SAndroid Build Coastguard Worker    non_header_sources = filter_exclude(invoker.sources,
754*d9f75844SAndroid Build Coastguard Worker                                        [
755*d9f75844SAndroid Build Coastguard Worker                                          "*.h",
756*d9f75844SAndroid Build Coastguard Worker                                          "*.hh",
757*d9f75844SAndroid Build Coastguard Worker                                          "*.inc",
758*d9f75844SAndroid Build Coastguard Worker                                        ])
759*d9f75844SAndroid Build Coastguard Worker    if (non_header_sources != []) {
760*d9f75844SAndroid Build Coastguard Worker      header_only = false
761*d9f75844SAndroid Build Coastguard Worker    }
762*d9f75844SAndroid Build Coastguard Worker  }
763*d9f75844SAndroid Build Coastguard Worker
764*d9f75844SAndroid Build Coastguard Worker  # Header only libraries should use source_set as a static_library with no
765*d9f75844SAndroid Build Coastguard Worker  # source files will cause issues with macOS libtool.
766*d9f75844SAndroid Build Coastguard Worker  if (header_only || is_component_build ||
767*d9f75844SAndroid Build Coastguard Worker      (defined(invoker.testonly) && invoker.testonly)) {
768*d9f75844SAndroid Build Coastguard Worker    target_type = "source_set"
769*d9f75844SAndroid Build Coastguard Worker  } else {
770*d9f75844SAndroid Build Coastguard Worker    target_type = "static_library"
771*d9f75844SAndroid Build Coastguard Worker  }
772*d9f75844SAndroid Build Coastguard Worker  target(target_type, target_name) {
773*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker,
774*d9f75844SAndroid Build Coastguard Worker                           "*",
775*d9f75844SAndroid Build Coastguard Worker                           [
776*d9f75844SAndroid Build Coastguard Worker                             "configs",
777*d9f75844SAndroid Build Coastguard Worker                             "public_configs",
778*d9f75844SAndroid Build Coastguard Worker                             "suppressed_configs",
779*d9f75844SAndroid Build Coastguard Worker                             "visibility",
780*d9f75844SAndroid Build Coastguard Worker                           ])
781*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker, [ "visibility" ])
782*d9f75844SAndroid Build Coastguard Worker    if (!defined(visibility)) {
783*d9f75844SAndroid Build Coastguard Worker      visibility = webrtc_default_visibility
784*d9f75844SAndroid Build Coastguard Worker    }
785*d9f75844SAndroid Build Coastguard Worker
786*d9f75844SAndroid Build Coastguard Worker    # What's your poison?
787*d9f75844SAndroid Build Coastguard Worker    if (defined(testonly) && testonly) {
788*d9f75844SAndroid Build Coastguard Worker      assert(!defined(poisonous))
789*d9f75844SAndroid Build Coastguard Worker      assert(!defined(allow_poison))
790*d9f75844SAndroid Build Coastguard Worker    } else {
791*d9f75844SAndroid Build Coastguard Worker      if (!defined(poisonous)) {
792*d9f75844SAndroid Build Coastguard Worker        poisonous = []
793*d9f75844SAndroid Build Coastguard Worker      }
794*d9f75844SAndroid Build Coastguard Worker      if (!defined(allow_poison)) {
795*d9f75844SAndroid Build Coastguard Worker        allow_poison = []
796*d9f75844SAndroid Build Coastguard Worker      }
797*d9f75844SAndroid Build Coastguard Worker      if (!defined(assert_no_deps)) {
798*d9f75844SAndroid Build Coastguard Worker        assert_no_deps = []
799*d9f75844SAndroid Build Coastguard Worker      }
800*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
801*d9f75844SAndroid Build Coastguard Worker        deps = []
802*d9f75844SAndroid Build Coastguard Worker      }
803*d9f75844SAndroid Build Coastguard Worker      foreach(p, poisonous) {
804*d9f75844SAndroid Build Coastguard Worker        deps += [ webrtc_root + ":poison_" + p ]
805*d9f75844SAndroid Build Coastguard Worker      }
806*d9f75844SAndroid Build Coastguard Worker      foreach(poison_type, all_poison_types) {
807*d9f75844SAndroid Build Coastguard Worker        allow_dep = true
808*d9f75844SAndroid Build Coastguard Worker        foreach(v, visibility) {
809*d9f75844SAndroid Build Coastguard Worker          if (v == "*") {
810*d9f75844SAndroid Build Coastguard Worker            allow_dep = false
811*d9f75844SAndroid Build Coastguard Worker          }
812*d9f75844SAndroid Build Coastguard Worker        }
813*d9f75844SAndroid Build Coastguard Worker        foreach(p, allow_poison + poisonous) {
814*d9f75844SAndroid Build Coastguard Worker          if (p == poison_type) {
815*d9f75844SAndroid Build Coastguard Worker            allow_dep = true
816*d9f75844SAndroid Build Coastguard Worker          }
817*d9f75844SAndroid Build Coastguard Worker        }
818*d9f75844SAndroid Build Coastguard Worker        if (!allow_dep) {
819*d9f75844SAndroid Build Coastguard Worker          assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
820*d9f75844SAndroid Build Coastguard Worker        }
821*d9f75844SAndroid Build Coastguard Worker      }
822*d9f75844SAndroid Build Coastguard Worker    }
823*d9f75844SAndroid Build Coastguard Worker
824*d9f75844SAndroid Build Coastguard Worker    # Chromium should only depend on the WebRTC component in order to
825*d9f75844SAndroid Build Coastguard Worker    # avoid to statically link WebRTC in a component build.
826*d9f75844SAndroid Build Coastguard Worker    if (build_with_chromium) {
827*d9f75844SAndroid Build Coastguard Worker      publicly_visible = false
828*d9f75844SAndroid Build Coastguard Worker      foreach(v, visibility) {
829*d9f75844SAndroid Build Coastguard Worker        if (v == "*") {
830*d9f75844SAndroid Build Coastguard Worker          publicly_visible = true
831*d9f75844SAndroid Build Coastguard Worker        }
832*d9f75844SAndroid Build Coastguard Worker      }
833*d9f75844SAndroid Build Coastguard Worker      if (publicly_visible) {
834*d9f75844SAndroid Build Coastguard Worker        visibility = []
835*d9f75844SAndroid Build Coastguard Worker        visibility = webrtc_default_visibility
836*d9f75844SAndroid Build Coastguard Worker      }
837*d9f75844SAndroid Build Coastguard Worker    }
838*d9f75844SAndroid Build Coastguard Worker
839*d9f75844SAndroid Build Coastguard Worker    if (!defined(testonly) || !testonly) {
840*d9f75844SAndroid Build Coastguard Worker      configs += rtc_prod_configs
841*d9f75844SAndroid Build Coastguard Worker    }
842*d9f75844SAndroid Build Coastguard Worker
843*d9f75844SAndroid Build Coastguard Worker    configs += invoker.configs
844*d9f75844SAndroid Build Coastguard Worker    configs += rtc_library_impl_config
845*d9f75844SAndroid Build Coastguard Worker    configs -= rtc_remove_configs
846*d9f75844SAndroid Build Coastguard Worker    configs -= invoker.suppressed_configs
847*d9f75844SAndroid Build Coastguard Worker    public_configs = [
848*d9f75844SAndroid Build Coastguard Worker      rtc_common_inherited_config,
849*d9f75844SAndroid Build Coastguard Worker      absl_include_config,
850*d9f75844SAndroid Build Coastguard Worker      absl_define_config,
851*d9f75844SAndroid Build Coastguard Worker    ]
852*d9f75844SAndroid Build Coastguard Worker    if (defined(testonly) && testonly) {
853*d9f75844SAndroid Build Coastguard Worker      public_configs += [ absl_flags_config ]
854*d9f75844SAndroid Build Coastguard Worker    }
855*d9f75844SAndroid Build Coastguard Worker    if (defined(invoker.public_configs)) {
856*d9f75844SAndroid Build Coastguard Worker      public_configs += invoker.public_configs
857*d9f75844SAndroid Build Coastguard Worker    }
858*d9f75844SAndroid Build Coastguard Worker
859*d9f75844SAndroid Build Coastguard Worker    # If absl_deps is [], no action is needed. If not [], then it needs to be
860*d9f75844SAndroid Build Coastguard Worker    # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
861*d9f75844SAndroid Build Coastguard Worker    # otherwise it just needs to be added to deps.
862*d9f75844SAndroid Build Coastguard Worker    if (absl_deps != []) {
863*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
864*d9f75844SAndroid Build Coastguard Worker        deps = []
865*d9f75844SAndroid Build Coastguard Worker      }
866*d9f75844SAndroid Build Coastguard Worker      if (build_with_chromium) {
867*d9f75844SAndroid Build Coastguard Worker        deps += [ "//third_party/abseil-cpp:absl" ]
868*d9f75844SAndroid Build Coastguard Worker      } else {
869*d9f75844SAndroid Build Coastguard Worker        deps += absl_deps
870*d9f75844SAndroid Build Coastguard Worker      }
871*d9f75844SAndroid Build Coastguard Worker    }
872*d9f75844SAndroid Build Coastguard Worker  }
873*d9f75844SAndroid Build Coastguard Worker}
874*d9f75844SAndroid Build Coastguard Worker
875*d9f75844SAndroid Build Coastguard Workertemplate("rtc_executable") {
876*d9f75844SAndroid Build Coastguard Worker  executable(target_name) {
877*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker,
878*d9f75844SAndroid Build Coastguard Worker                           "*",
879*d9f75844SAndroid Build Coastguard Worker                           [
880*d9f75844SAndroid Build Coastguard Worker                             "deps",
881*d9f75844SAndroid Build Coastguard Worker                             "configs",
882*d9f75844SAndroid Build Coastguard Worker                             "public_configs",
883*d9f75844SAndroid Build Coastguard Worker                             "suppressed_configs",
884*d9f75844SAndroid Build Coastguard Worker                             "visibility",
885*d9f75844SAndroid Build Coastguard Worker                           ])
886*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker, [ "visibility" ])
887*d9f75844SAndroid Build Coastguard Worker    if (!defined(visibility)) {
888*d9f75844SAndroid Build Coastguard Worker      visibility = webrtc_default_visibility
889*d9f75844SAndroid Build Coastguard Worker    }
890*d9f75844SAndroid Build Coastguard Worker    configs += invoker.configs
891*d9f75844SAndroid Build Coastguard Worker    configs -= rtc_remove_configs
892*d9f75844SAndroid Build Coastguard Worker    configs -= invoker.suppressed_configs
893*d9f75844SAndroid Build Coastguard Worker    deps = invoker.deps
894*d9f75844SAndroid Build Coastguard Worker
895*d9f75844SAndroid Build Coastguard Worker    public_configs = [
896*d9f75844SAndroid Build Coastguard Worker      rtc_common_inherited_config,
897*d9f75844SAndroid Build Coastguard Worker      absl_include_config,
898*d9f75844SAndroid Build Coastguard Worker      absl_define_config,
899*d9f75844SAndroid Build Coastguard Worker    ]
900*d9f75844SAndroid Build Coastguard Worker    if (defined(testonly) && testonly) {
901*d9f75844SAndroid Build Coastguard Worker      public_configs += [ absl_flags_config ]
902*d9f75844SAndroid Build Coastguard Worker    }
903*d9f75844SAndroid Build Coastguard Worker    if (defined(invoker.public_configs)) {
904*d9f75844SAndroid Build Coastguard Worker      public_configs += invoker.public_configs
905*d9f75844SAndroid Build Coastguard Worker    }
906*d9f75844SAndroid Build Coastguard Worker    if (is_win) {
907*d9f75844SAndroid Build Coastguard Worker      deps += [
908*d9f75844SAndroid Build Coastguard Worker        # Give executables the default manifest on Windows (a no-op elsewhere).
909*d9f75844SAndroid Build Coastguard Worker        "//build/win:default_exe_manifest",
910*d9f75844SAndroid Build Coastguard Worker      ]
911*d9f75844SAndroid Build Coastguard Worker    }
912*d9f75844SAndroid Build Coastguard Worker  }
913*d9f75844SAndroid Build Coastguard Worker}
914*d9f75844SAndroid Build Coastguard Worker
915*d9f75844SAndroid Build Coastguard Workertemplate("rtc_shared_library") {
916*d9f75844SAndroid Build Coastguard Worker  shared_library(target_name) {
917*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker,
918*d9f75844SAndroid Build Coastguard Worker                           "*",
919*d9f75844SAndroid Build Coastguard Worker                           [
920*d9f75844SAndroid Build Coastguard Worker                             "configs",
921*d9f75844SAndroid Build Coastguard Worker                             "public_configs",
922*d9f75844SAndroid Build Coastguard Worker                             "suppressed_configs",
923*d9f75844SAndroid Build Coastguard Worker                             "visibility",
924*d9f75844SAndroid Build Coastguard Worker                           ])
925*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker, [ "visibility" ])
926*d9f75844SAndroid Build Coastguard Worker    if (!defined(visibility)) {
927*d9f75844SAndroid Build Coastguard Worker      visibility = webrtc_default_visibility
928*d9f75844SAndroid Build Coastguard Worker    }
929*d9f75844SAndroid Build Coastguard Worker
930*d9f75844SAndroid Build Coastguard Worker    # What's your poison?
931*d9f75844SAndroid Build Coastguard Worker    if (defined(testonly) && testonly) {
932*d9f75844SAndroid Build Coastguard Worker      assert(!defined(poisonous))
933*d9f75844SAndroid Build Coastguard Worker      assert(!defined(allow_poison))
934*d9f75844SAndroid Build Coastguard Worker    } else {
935*d9f75844SAndroid Build Coastguard Worker      if (!defined(poisonous)) {
936*d9f75844SAndroid Build Coastguard Worker        poisonous = []
937*d9f75844SAndroid Build Coastguard Worker      }
938*d9f75844SAndroid Build Coastguard Worker      if (!defined(allow_poison)) {
939*d9f75844SAndroid Build Coastguard Worker        allow_poison = []
940*d9f75844SAndroid Build Coastguard Worker      }
941*d9f75844SAndroid Build Coastguard Worker      if (!defined(assert_no_deps)) {
942*d9f75844SAndroid Build Coastguard Worker        assert_no_deps = []
943*d9f75844SAndroid Build Coastguard Worker      }
944*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
945*d9f75844SAndroid Build Coastguard Worker        deps = []
946*d9f75844SAndroid Build Coastguard Worker      }
947*d9f75844SAndroid Build Coastguard Worker      foreach(p, poisonous) {
948*d9f75844SAndroid Build Coastguard Worker        deps += [ webrtc_root + ":poison_" + p ]
949*d9f75844SAndroid Build Coastguard Worker      }
950*d9f75844SAndroid Build Coastguard Worker      foreach(poison_type, all_poison_types) {
951*d9f75844SAndroid Build Coastguard Worker        allow_dep = true
952*d9f75844SAndroid Build Coastguard Worker        foreach(v, visibility) {
953*d9f75844SAndroid Build Coastguard Worker          if (v == "*") {
954*d9f75844SAndroid Build Coastguard Worker            allow_dep = false
955*d9f75844SAndroid Build Coastguard Worker          }
956*d9f75844SAndroid Build Coastguard Worker        }
957*d9f75844SAndroid Build Coastguard Worker        foreach(p, allow_poison + poisonous) {
958*d9f75844SAndroid Build Coastguard Worker          if (p == poison_type) {
959*d9f75844SAndroid Build Coastguard Worker            allow_dep = true
960*d9f75844SAndroid Build Coastguard Worker          }
961*d9f75844SAndroid Build Coastguard Worker        }
962*d9f75844SAndroid Build Coastguard Worker        if (!allow_dep) {
963*d9f75844SAndroid Build Coastguard Worker          assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
964*d9f75844SAndroid Build Coastguard Worker        }
965*d9f75844SAndroid Build Coastguard Worker      }
966*d9f75844SAndroid Build Coastguard Worker    }
967*d9f75844SAndroid Build Coastguard Worker
968*d9f75844SAndroid Build Coastguard Worker    configs += invoker.configs
969*d9f75844SAndroid Build Coastguard Worker    configs -= rtc_remove_configs
970*d9f75844SAndroid Build Coastguard Worker    configs -= invoker.suppressed_configs
971*d9f75844SAndroid Build Coastguard Worker    public_configs = [
972*d9f75844SAndroid Build Coastguard Worker      rtc_common_inherited_config,
973*d9f75844SAndroid Build Coastguard Worker      absl_include_config,
974*d9f75844SAndroid Build Coastguard Worker      absl_define_config,
975*d9f75844SAndroid Build Coastguard Worker    ]
976*d9f75844SAndroid Build Coastguard Worker    if (defined(testonly) && testonly) {
977*d9f75844SAndroid Build Coastguard Worker      public_configs += [ absl_flags_config ]
978*d9f75844SAndroid Build Coastguard Worker    }
979*d9f75844SAndroid Build Coastguard Worker    if (defined(invoker.public_configs)) {
980*d9f75844SAndroid Build Coastguard Worker      public_configs += invoker.public_configs
981*d9f75844SAndroid Build Coastguard Worker    }
982*d9f75844SAndroid Build Coastguard Worker  }
983*d9f75844SAndroid Build Coastguard Worker}
984*d9f75844SAndroid Build Coastguard Worker
985*d9f75844SAndroid Build Coastguard Workerif (is_mac || is_ios) {
986*d9f75844SAndroid Build Coastguard Worker  template("apple_framework_bundle_with_umbrella_header") {
987*d9f75844SAndroid Build Coastguard Worker    forward_variables_from(invoker, [ "output_name" ])
988*d9f75844SAndroid Build Coastguard Worker    this_target_name = target_name
989*d9f75844SAndroid Build Coastguard Worker    umbrella_header_path =
990*d9f75844SAndroid Build Coastguard Worker        "$target_gen_dir/$output_name.framework/WebRTC/$output_name.h"
991*d9f75844SAndroid Build Coastguard Worker    modulemap_path = "$target_gen_dir/Modules/module.modulemap"
992*d9f75844SAndroid Build Coastguard Worker
993*d9f75844SAndroid Build Coastguard Worker    action_foreach("create_bracket_include_headers_$target_name") {
994*d9f75844SAndroid Build Coastguard Worker      script = "//tools_webrtc/apple/copy_framework_header.py"
995*d9f75844SAndroid Build Coastguard Worker      sources = invoker.sources
996*d9f75844SAndroid Build Coastguard Worker      output_name = invoker.output_name
997*d9f75844SAndroid Build Coastguard Worker      outputs = [
998*d9f75844SAndroid Build Coastguard Worker        "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}",
999*d9f75844SAndroid Build Coastguard Worker      ]
1000*d9f75844SAndroid Build Coastguard Worker      args = [
1001*d9f75844SAndroid Build Coastguard Worker        "--input",
1002*d9f75844SAndroid Build Coastguard Worker        "{{source}}",
1003*d9f75844SAndroid Build Coastguard Worker        "--output",
1004*d9f75844SAndroid Build Coastguard Worker        rebase_path(target_gen_dir, root_build_dir) +
1005*d9f75844SAndroid Build Coastguard Worker            "/$output_name.framework/WebRTC/{{source_file_part}}",
1006*d9f75844SAndroid Build Coastguard Worker      ]
1007*d9f75844SAndroid Build Coastguard Worker    }
1008*d9f75844SAndroid Build Coastguard Worker
1009*d9f75844SAndroid Build Coastguard Worker    if (is_mac) {
1010*d9f75844SAndroid Build Coastguard Worker      mac_framework_bundle(target_name) {
1011*d9f75844SAndroid Build Coastguard Worker        forward_variables_from(invoker, "*", [ "configs" ])
1012*d9f75844SAndroid Build Coastguard Worker        if (defined(invoker.configs)) {
1013*d9f75844SAndroid Build Coastguard Worker          configs += invoker.configs
1014*d9f75844SAndroid Build Coastguard Worker        }
1015*d9f75844SAndroid Build Coastguard Worker
1016*d9f75844SAndroid Build Coastguard Worker        framework_version = "A"
1017*d9f75844SAndroid Build Coastguard Worker        framework_contents = [
1018*d9f75844SAndroid Build Coastguard Worker          "Headers",
1019*d9f75844SAndroid Build Coastguard Worker          "Modules",
1020*d9f75844SAndroid Build Coastguard Worker          "Resources",
1021*d9f75844SAndroid Build Coastguard Worker        ]
1022*d9f75844SAndroid Build Coastguard Worker
1023*d9f75844SAndroid Build Coastguard Worker        ldflags = [
1024*d9f75844SAndroid Build Coastguard Worker          "-all_load",
1025*d9f75844SAndroid Build Coastguard Worker          "-install_name",
1026*d9f75844SAndroid Build Coastguard Worker          "@rpath/$output_name.framework/$output_name",
1027*d9f75844SAndroid Build Coastguard Worker        ]
1028*d9f75844SAndroid Build Coastguard Worker
1029*d9f75844SAndroid Build Coastguard Worker        deps += [
1030*d9f75844SAndroid Build Coastguard Worker          ":copy_framework_headers_$this_target_name",
1031*d9f75844SAndroid Build Coastguard Worker          ":copy_modulemap_$this_target_name",
1032*d9f75844SAndroid Build Coastguard Worker          ":copy_umbrella_header_$this_target_name",
1033*d9f75844SAndroid Build Coastguard Worker          ":create_bracket_include_headers_$this_target_name",
1034*d9f75844SAndroid Build Coastguard Worker          ":modulemap_$this_target_name",
1035*d9f75844SAndroid Build Coastguard Worker          ":umbrella_header_$this_target_name",
1036*d9f75844SAndroid Build Coastguard Worker        ]
1037*d9f75844SAndroid Build Coastguard Worker      }
1038*d9f75844SAndroid Build Coastguard Worker    }
1039*d9f75844SAndroid Build Coastguard Worker    if (is_ios) {
1040*d9f75844SAndroid Build Coastguard Worker      ios_framework_bundle(target_name) {
1041*d9f75844SAndroid Build Coastguard Worker        forward_variables_from(invoker,
1042*d9f75844SAndroid Build Coastguard Worker                               "*",
1043*d9f75844SAndroid Build Coastguard Worker                               [
1044*d9f75844SAndroid Build Coastguard Worker                                 "configs",
1045*d9f75844SAndroid Build Coastguard Worker                                 "public_headers",
1046*d9f75844SAndroid Build Coastguard Worker                               ])
1047*d9f75844SAndroid Build Coastguard Worker        if (defined(invoker.configs)) {
1048*d9f75844SAndroid Build Coastguard Worker          configs += invoker.configs
1049*d9f75844SAndroid Build Coastguard Worker        }
1050*d9f75844SAndroid Build Coastguard Worker        public_headers = get_target_outputs(
1051*d9f75844SAndroid Build Coastguard Worker                ":create_bracket_include_headers_$this_target_name")
1052*d9f75844SAndroid Build Coastguard Worker
1053*d9f75844SAndroid Build Coastguard Worker        deps += [
1054*d9f75844SAndroid Build Coastguard Worker          ":copy_umbrella_header_$this_target_name",
1055*d9f75844SAndroid Build Coastguard Worker          ":create_bracket_include_headers_$this_target_name",
1056*d9f75844SAndroid Build Coastguard Worker        ]
1057*d9f75844SAndroid Build Coastguard Worker      }
1058*d9f75844SAndroid Build Coastguard Worker    }
1059*d9f75844SAndroid Build Coastguard Worker
1060*d9f75844SAndroid Build Coastguard Worker    if (is_mac || target_environment == "catalyst") {
1061*d9f75844SAndroid Build Coastguard Worker      # Catalyst frameworks use the same layout as regular Mac frameworks.
1062*d9f75844SAndroid Build Coastguard Worker      headers_dir = "Versions/A/Headers"
1063*d9f75844SAndroid Build Coastguard Worker    } else {
1064*d9f75844SAndroid Build Coastguard Worker      headers_dir = "Headers"
1065*d9f75844SAndroid Build Coastguard Worker    }
1066*d9f75844SAndroid Build Coastguard Worker
1067*d9f75844SAndroid Build Coastguard Worker    bundle_data("copy_framework_headers_$this_target_name") {
1068*d9f75844SAndroid Build Coastguard Worker      sources = get_target_outputs(
1069*d9f75844SAndroid Build Coastguard Worker              ":create_bracket_include_headers_$this_target_name")
1070*d9f75844SAndroid Build Coastguard Worker
1071*d9f75844SAndroid Build Coastguard Worker      outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
1072*d9f75844SAndroid Build Coastguard Worker      deps = [ ":create_bracket_include_headers_$this_target_name" ]
1073*d9f75844SAndroid Build Coastguard Worker    }
1074*d9f75844SAndroid Build Coastguard Worker
1075*d9f75844SAndroid Build Coastguard Worker    action("modulemap_$this_target_name") {
1076*d9f75844SAndroid Build Coastguard Worker      script = "//tools_webrtc/ios/generate_modulemap.py"
1077*d9f75844SAndroid Build Coastguard Worker      args = [
1078*d9f75844SAndroid Build Coastguard Worker        "--out",
1079*d9f75844SAndroid Build Coastguard Worker        rebase_path(modulemap_path, root_build_dir),
1080*d9f75844SAndroid Build Coastguard Worker        "--name",
1081*d9f75844SAndroid Build Coastguard Worker        output_name,
1082*d9f75844SAndroid Build Coastguard Worker      ]
1083*d9f75844SAndroid Build Coastguard Worker      outputs = [ modulemap_path ]
1084*d9f75844SAndroid Build Coastguard Worker    }
1085*d9f75844SAndroid Build Coastguard Worker
1086*d9f75844SAndroid Build Coastguard Worker    bundle_data("copy_modulemap_$this_target_name") {
1087*d9f75844SAndroid Build Coastguard Worker      sources = [ modulemap_path ]
1088*d9f75844SAndroid Build Coastguard Worker      outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ]
1089*d9f75844SAndroid Build Coastguard Worker      deps = [ ":modulemap_$this_target_name" ]
1090*d9f75844SAndroid Build Coastguard Worker    }
1091*d9f75844SAndroid Build Coastguard Worker
1092*d9f75844SAndroid Build Coastguard Worker    action("umbrella_header_$this_target_name") {
1093*d9f75844SAndroid Build Coastguard Worker      sources = get_target_outputs(
1094*d9f75844SAndroid Build Coastguard Worker              ":create_bracket_include_headers_$this_target_name")
1095*d9f75844SAndroid Build Coastguard Worker
1096*d9f75844SAndroid Build Coastguard Worker      script = "//tools_webrtc/ios/generate_umbrella_header.py"
1097*d9f75844SAndroid Build Coastguard Worker
1098*d9f75844SAndroid Build Coastguard Worker      outputs = [ umbrella_header_path ]
1099*d9f75844SAndroid Build Coastguard Worker      args = [
1100*d9f75844SAndroid Build Coastguard Worker               "--out",
1101*d9f75844SAndroid Build Coastguard Worker               rebase_path(umbrella_header_path, root_build_dir),
1102*d9f75844SAndroid Build Coastguard Worker               "--sources",
1103*d9f75844SAndroid Build Coastguard Worker             ] + sources
1104*d9f75844SAndroid Build Coastguard Worker      deps = [ ":create_bracket_include_headers_$this_target_name" ]
1105*d9f75844SAndroid Build Coastguard Worker    }
1106*d9f75844SAndroid Build Coastguard Worker
1107*d9f75844SAndroid Build Coastguard Worker    copy("copy_umbrella_header_$target_name") {
1108*d9f75844SAndroid Build Coastguard Worker      sources = [ umbrella_header_path ]
1109*d9f75844SAndroid Build Coastguard Worker      outputs =
1110*d9f75844SAndroid Build Coastguard Worker          [ "$root_out_dir/$output_name.framework/$headers_dir/$output_name.h" ]
1111*d9f75844SAndroid Build Coastguard Worker
1112*d9f75844SAndroid Build Coastguard Worker      deps = [ ":umbrella_header_$target_name" ]
1113*d9f75844SAndroid Build Coastguard Worker    }
1114*d9f75844SAndroid Build Coastguard Worker  }
1115*d9f75844SAndroid Build Coastguard Worker}
1116*d9f75844SAndroid Build Coastguard Worker
1117*d9f75844SAndroid Build Coastguard Workerif (is_android) {
1118*d9f75844SAndroid Build Coastguard Worker  template("rtc_android_library") {
1119*d9f75844SAndroid Build Coastguard Worker    android_library(target_name) {
1120*d9f75844SAndroid Build Coastguard Worker      forward_variables_from(invoker,
1121*d9f75844SAndroid Build Coastguard Worker                             "*",
1122*d9f75844SAndroid Build Coastguard Worker                             [
1123*d9f75844SAndroid Build Coastguard Worker                               "configs",
1124*d9f75844SAndroid Build Coastguard Worker                               "public_configs",
1125*d9f75844SAndroid Build Coastguard Worker                               "suppressed_configs",
1126*d9f75844SAndroid Build Coastguard Worker                               "visibility",
1127*d9f75844SAndroid Build Coastguard Worker                             ])
1128*d9f75844SAndroid Build Coastguard Worker
1129*d9f75844SAndroid Build Coastguard Worker      errorprone_args = []
1130*d9f75844SAndroid Build Coastguard Worker
1131*d9f75844SAndroid Build Coastguard Worker      # Treat warnings as errors.
1132*d9f75844SAndroid Build Coastguard Worker      errorprone_args += [ "-Werror" ]
1133*d9f75844SAndroid Build Coastguard Worker
1134*d9f75844SAndroid Build Coastguard Worker      # Add any arguments defined by the invoker.
1135*d9f75844SAndroid Build Coastguard Worker      if (defined(invoker.errorprone_args)) {
1136*d9f75844SAndroid Build Coastguard Worker        errorprone_args += invoker.errorprone_args
1137*d9f75844SAndroid Build Coastguard Worker      }
1138*d9f75844SAndroid Build Coastguard Worker
1139*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
1140*d9f75844SAndroid Build Coastguard Worker        deps = []
1141*d9f75844SAndroid Build Coastguard Worker      }
1142*d9f75844SAndroid Build Coastguard Worker
1143*d9f75844SAndroid Build Coastguard Worker      no_build_hooks = true
1144*d9f75844SAndroid Build Coastguard Worker      not_needed([ "android_manifest" ])
1145*d9f75844SAndroid Build Coastguard Worker    }
1146*d9f75844SAndroid Build Coastguard Worker  }
1147*d9f75844SAndroid Build Coastguard Worker
1148*d9f75844SAndroid Build Coastguard Worker  template("rtc_android_apk") {
1149*d9f75844SAndroid Build Coastguard Worker    android_apk(target_name) {
1150*d9f75844SAndroid Build Coastguard Worker      forward_variables_from(invoker,
1151*d9f75844SAndroid Build Coastguard Worker                             "*",
1152*d9f75844SAndroid Build Coastguard Worker                             [
1153*d9f75844SAndroid Build Coastguard Worker                               "configs",
1154*d9f75844SAndroid Build Coastguard Worker                               "public_configs",
1155*d9f75844SAndroid Build Coastguard Worker                               "suppressed_configs",
1156*d9f75844SAndroid Build Coastguard Worker                               "visibility",
1157*d9f75844SAndroid Build Coastguard Worker                             ])
1158*d9f75844SAndroid Build Coastguard Worker
1159*d9f75844SAndroid Build Coastguard Worker      # Treat warnings as errors.
1160*d9f75844SAndroid Build Coastguard Worker      errorprone_args = []
1161*d9f75844SAndroid Build Coastguard Worker      errorprone_args += [ "-Werror" ]
1162*d9f75844SAndroid Build Coastguard Worker
1163*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
1164*d9f75844SAndroid Build Coastguard Worker        deps = []
1165*d9f75844SAndroid Build Coastguard Worker      }
1166*d9f75844SAndroid Build Coastguard Worker
1167*d9f75844SAndroid Build Coastguard Worker      no_build_hooks = true
1168*d9f75844SAndroid Build Coastguard Worker    }
1169*d9f75844SAndroid Build Coastguard Worker  }
1170*d9f75844SAndroid Build Coastguard Worker
1171*d9f75844SAndroid Build Coastguard Worker  template("rtc_instrumentation_test_apk") {
1172*d9f75844SAndroid Build Coastguard Worker    instrumentation_test_apk(target_name) {
1173*d9f75844SAndroid Build Coastguard Worker      forward_variables_from(invoker,
1174*d9f75844SAndroid Build Coastguard Worker                             "*",
1175*d9f75844SAndroid Build Coastguard Worker                             [
1176*d9f75844SAndroid Build Coastguard Worker                               "configs",
1177*d9f75844SAndroid Build Coastguard Worker                               "public_configs",
1178*d9f75844SAndroid Build Coastguard Worker                               "suppressed_configs",
1179*d9f75844SAndroid Build Coastguard Worker                               "visibility",
1180*d9f75844SAndroid Build Coastguard Worker                             ])
1181*d9f75844SAndroid Build Coastguard Worker
1182*d9f75844SAndroid Build Coastguard Worker      # Treat warnings as errors.
1183*d9f75844SAndroid Build Coastguard Worker      errorprone_args = []
1184*d9f75844SAndroid Build Coastguard Worker      errorprone_args += [ "-Werror" ]
1185*d9f75844SAndroid Build Coastguard Worker
1186*d9f75844SAndroid Build Coastguard Worker      if (!defined(deps)) {
1187*d9f75844SAndroid Build Coastguard Worker        deps = []
1188*d9f75844SAndroid Build Coastguard Worker      }
1189*d9f75844SAndroid Build Coastguard Worker
1190*d9f75844SAndroid Build Coastguard Worker      no_build_hooks = true
1191*d9f75844SAndroid Build Coastguard Worker    }
1192*d9f75844SAndroid Build Coastguard Worker  }
1193*d9f75844SAndroid Build Coastguard Worker}
1194