blob: 17a66f974c87a052b6ef58f5b83176c5dbafe906 [file] [log] [blame]
mbonadei9aa3f0a2017-01-24 06:58:22 -08001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
mbonadei9aa3f0a2017-01-24 06:58:22 -08008import("//build/config/arm.gni")
9import("//build/config/features.gni")
10import("//build/config/mips.gni")
11import("//build/config/sanitizers/sanitizers.gni")
Tomas Popela318da512018-11-13 06:32:23 +010012import("//build/config/sysroot.gni")
ehmaldonado0d729b32017-02-10 01:38:23 -080013import("//build/config/ui.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -080014import("//build_overrides/build.gni")
mbonadei96606272017-03-03 19:41:59 -080015
16if (!build_with_chromium && is_component_build) {
17 print("The Gn argument `is_component_build` is currently " +
18 "ignored for WebRTC builds.")
19 print("Component builds are supported by Chromium and the argument " +
20 "`is_component_build` makes it possible to create shared libraries " +
21 "instead of static libraries.")
22 print("If an app depends on WebRTC it makes sense to just depend on the " +
23 "WebRTC static library, so there is no difference between " +
24 "`is_component_build=true` and `is_component_build=false`.")
25 print(
26 "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md")
27 assert(!is_component_build, "Component builds are not supported in WebRTC.")
28}
29
kthelgason4065a572017-02-14 04:58:56 -080030if (is_ios) {
31 import("//build/config/ios/rules.gni")
32}
mbonadei9aa3f0a2017-01-24 06:58:22 -080033
Anders Carlsson37bbf792018-09-05 16:29:27 +020034if (is_mac) {
35 import("//build/config/mac/rules.gni")
36}
37
mbonadei9aa3f0a2017-01-24 06:58:22 -080038declare_args() {
Mirko Bonadei028248c2018-10-10 12:19:02 +020039 # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
40 # expand to code that will manage symbols visibility.
41 rtc_enable_symbol_export = false
42
Mirko Bonadei31b0b452018-08-22 10:37:11 +020043 # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
Mirko Bonadei70400902018-08-21 15:44:28 +020044 # will tell the pre-processor to remove the default definition of symbols
45 # needed to use field_trial. In that case a new implementation needs to be
46 # provided.
Mirko Bonadei31b0b452018-08-22 10:37:11 +020047 if (build_with_chromium) {
48 # When WebRTC is built as part of Chromium it should exclude the default
49 # implementation of field_trial unless it is building for NACL or
50 # Chromecast.
51 rtc_exclude_field_trial_default = !is_nacl && !is_chromecast
52 } else {
53 rtc_exclude_field_trial_default = false
54 }
Mirko Bonadei70400902018-08-21 15:44:28 +020055
Mirko Bonadei906add42018-09-05 16:03:16 +020056 # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which
57 # will tell the pre-processor to remove the default definition of symbols
58 # needed to use metrics. In that case a new implementation needs to be
59 # provided.
60 rtc_exclude_metrics_default = build_with_chromium
61
Benjamin Wrightd6f86e82018-05-08 13:12:25 -070062 # Setting this to false will require the API user to pass in their own
63 # SSLCertificateVerifier to verify the certificates presented from a
64 # TLS-TURN server. In return disabling this saves around 100kb in the binary.
65 rtc_builtin_ssl_root_certificates = true
66
Karl Wibergeb254b42017-11-01 15:08:12 +010067 # Include the iLBC audio codec?
Olga Sharonova5fbd7582020-07-09 09:50:42 +000068 rtc_include_ilbc = true
Karl Wibergeb254b42017-11-01 15:08:12 +010069
mbonadei9aa3f0a2017-01-24 06:58:22 -080070 # Disable this to avoid building the Opus audio codec.
71 rtc_include_opus = true
72
minyue2e03c662017-02-01 17:31:11 -080073 # Enable this if the Opus version upon which WebRTC is built supports direct
74 # encoding of 120 ms packets.
minyue-webrtc516711c2017-07-27 17:45:49 +020075 rtc_opus_support_120ms_ptime = true
minyue2e03c662017-02-01 17:31:11 -080076
mbonadei9aa3f0a2017-01-24 06:58:22 -080077 # Enable this to let the Opus audio codec change complexity on the fly.
78 rtc_opus_variable_complexity = false
79
mbonadei9aa3f0a2017-01-24 06:58:22 -080080 # Used to specify an external Jsoncpp include path when not compiling the
81 # library that comes with WebRTC (i.e. rtc_build_json == 0).
82 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
83
84 # Used to specify an external OpenSSL include path when not compiling the
85 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
86 rtc_ssl_root = ""
87
88 # Selects fixed-point code where possible.
89 rtc_prefer_fixed_point = false
90
mbonadei9aa3f0a2017-01-24 06:58:22 -080091 # Enable when an external authentication mechanism is used for performing
92 # packet authentication for RTP packets instead of libsrtp.
93 rtc_enable_external_auth = build_with_chromium
94
95 # Selects whether debug dumps for the audio processing module
96 # should be generated.
97 apm_debug_dump = false
98
Per Åhgrencc73ed32020-04-26 23:56:17 +020099 # Selects whether the audio processing module should be excluded.
100 rtc_exclude_audio_processing_module = false
101
mbonadei9aa3f0a2017-01-24 06:58:22 -0800102 # Set this to true to enable BWE test logging.
103 rtc_enable_bwe_test_logging = false
104
Joachim Bauch93e91342017-12-07 01:25:53 +0100105 # Set this to false to skip building examples.
106 rtc_build_examples = true
107
108 # Set this to false to skip building tools.
109 rtc_build_tools = true
110
Joachim Bauch75f18fc2017-12-20 21:25:47 +0100111 # Set this to false to skip building code that requires X11.
112 rtc_use_x11 = use_x11
113
Tomas Popela318da512018-11-13 06:32:23 +0100114 # Set this to use PipeWire on the Wayland display server.
Tomas Popela762543f2018-12-12 14:37:51 +0100115 # By default it's only enabled on desktop Linux (excludes ChromeOS) and
116 # only when using the sysroot as PipeWire is not available in older and
117 # supported Ubuntu and Debian distributions.
Mirko Bonadei5c1a5652020-05-12 06:14:31 +0000118 rtc_use_pipewire = is_desktop_linux && use_sysroot
Tomas Popela762543f2018-12-12 14:37:51 +0100119
120 # Set this to link PipeWire directly instead of using the dlopen.
121 rtc_link_pipewire = false
Tomas Popela318da512018-11-13 06:32:23 +0100122
mbonadei9aa3f0a2017-01-24 06:58:22 -0800123 # Enable to use the Mozilla internal settings.
124 build_with_mozilla = false
125
henrika883d00f2018-03-16 10:09:49 +0100126 # Enable use of Android AAudio which requires Android SDK 26 or above and
127 # NDK r16 or above.
128 rtc_enable_android_aaudio = false
129
mbonadei9aa3f0a2017-01-24 06:58:22 -0800130 # Set to "func", "block", "edge" for coverage generation.
131 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
132 # It is recommend to set include_examples=0.
133 # Use llvm's sancov -html-report for human readable reports.
134 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
135 rtc_sanitize_coverage = ""
136
mbonadei9aa3f0a2017-01-24 06:58:22 -0800137 if (current_cpu == "arm" || current_cpu == "arm64") {
138 rtc_prefer_fixed_point = true
139 }
140
mbonadei9aa3f0a2017-01-24 06:58:22 -0800141 # Determines whether NEON code will be built.
142 rtc_build_with_neon =
143 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
144
145 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
146 # all platforms except Android and iOS. Because FFmpeg can be built
147 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
148 # value that includes H.264, for example "Chrome". If FFmpeg is built without
Sergey Silkinfe288eb2018-06-25 16:22:38 +0200149 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize.
mbonadei9aa3f0a2017-01-24 06:58:22 -0800150 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
151 # http://www.openh264.org, https://www.ffmpeg.org/
Mirko Bonadeiee0a85c2019-01-15 10:47:18 +0100152 #
153 # Enabling H264 when building with MSVC is currently not supported, see
154 # bugs.webrtc.org/9213#c13 for more info.
155 rtc_use_h264 =
156 proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
mbonadei9aa3f0a2017-01-24 06:58:22 -0800157
Markus Handell8e75bd42020-06-05 11:47:40 +0200158 # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex.
159 rtc_use_absl_mutex = false
160
mbonadei9aa3f0a2017-01-24 06:58:22 -0800161 # By default, use normal platform audio support or dummy audio, but don't
162 # use file-based audio playout and record.
163 rtc_use_dummy_audio_file_devices = false
164
henrika7be78832017-06-13 17:34:16 +0200165 # When set to true, replace the audio output with a sinus tone at 440Hz.
166 # The ADM will ask for audio data from WebRTC but instead of reading real
167 # audio samples from NetEQ, a sinus tone will be generated and replace the
168 # real audio samples.
169 rtc_audio_device_plays_sinus_tone = false
170
Anders Carlsson358f2e02018-06-04 10:24:37 +0200171 if (is_ios) {
172 # Build broadcast extension in AppRTCMobile for iOS. This results in the
173 # binary only running on iOS 11+, which is why it is disabled by default.
174 rtc_apprtcmobile_broadcast_extension = false
175 }
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200176
177 # Determines whether Metal is available on iOS/macOS.
178 rtc_use_metal_rendering = is_mac || (is_ios && current_cpu == "arm64")
Jiawei Ou08745302019-02-12 11:36:13 -0800179
180 # When set to false, builtin audio encoder/decoder factories and all the
181 # audio codecs they depend on will not be included in libwebrtc.{a|lib}
182 # (they will still be included in libjingle_peerconnection_so.so and
183 # WebRTC.framework)
184 rtc_include_builtin_audio_codecs = true
185
186 # When set to false, builtin video encoder/decoder factories and all the
187 # video codecs they depends on will not be included in libwebrtc.{a|lib}
188 # (they will still be included in libjingle_peerconnection_so.so and
189 # WebRTC.framework)
190 rtc_include_builtin_video_codecs = true
Mirko Bonadei20574f42019-03-28 07:50:07 +0100191
192 # When set to true and in a standalone build, it will undefine UNICODE and
193 # _UNICODE (which are always defined globally by the Chromium Windows
194 # toolchain).
195 # This is only needed for testing purposes, WebRTC wants to be sure it
196 # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses
197 # wide character functions.
198 rtc_win_undef_unicode = false
Dan Minor9c686132018-01-15 10:20:00 -0500199}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800200
Dan Minor9c686132018-01-15 10:20:00 -0500201if (!build_with_mozilla) {
202 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800203}
204
205# A second declare_args block, so that declarations within it can
206# depend on the possibly overridden variables in the first
207# declare_args block.
208declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500209 # Enables the use of protocol buffers for debug recordings.
210 rtc_enable_protobuf = !build_with_mozilla
211
212 # Set this to disable building with support for SCTP data channels.
213 rtc_enable_sctp = !build_with_mozilla
214
215 # Disable these to not build components which can be externally provided.
216 rtc_build_json = !build_with_mozilla
217 rtc_build_libsrtp = !build_with_mozilla
218 rtc_build_libvpx = !build_with_mozilla
219 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 10:20:00 -0500220 rtc_build_opus = !build_with_mozilla
221 rtc_build_ssl = !build_with_mozilla
222 rtc_build_usrsctp = !build_with_mozilla
223
224 # Enable libevent task queues on platforms that support it.
Mirko Bonadei775c02e2019-06-19 19:05:00 +0200225 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
226 target_cpu == "wasm") {
Dan Minor9c686132018-01-15 10:20:00 -0500227 rtc_enable_libevent = false
228 rtc_build_libevent = false
229 } else {
230 rtc_enable_libevent = true
231 rtc_build_libevent = !build_with_mozilla
232 }
233
Dan Minor9c686132018-01-15 10:20:00 -0500234 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
235 # build environments, even if available for Chromium builds.
236 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
237
mbonadei9aa3f0a2017-01-24 06:58:22 -0800238 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
239 rtc_include_pulse_audio = !build_with_chromium
240
241 # Chromium uses its own IO handling, so the internal ADM is only built for
242 # standalone WebRTC.
243 rtc_include_internal_audio_device = !build_with_chromium
244
Zhaoliang Ma72e43212020-08-17 17:13:41 +0800245 # Set this to true to enable the avx2 support in webrtc.
246 # TODO(bugs.webrtc.org/11663): Default this to true and eventually remove.
247 rtc_enable_avx2 = false
248
mbonadei9aa3f0a2017-01-24 06:58:22 -0800249 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500250 rtc_include_tests = !build_with_chromium && !build_with_mozilla
Oleh Prypin240b8932019-06-07 13:27:07 +0200251
252 # Set this to false to skip building code that also requires X11 extensions
253 # such as Xdamage, Xfixes.
254 rtc_use_x11_extensions = rtc_use_x11
Artem Titov6a4a1462019-11-26 16:24:46 +0100255
256 # Set this to true to fully remove logging from WebRTC.
257 rtc_disable_logging = false
Doudou Kisabaka2dec4962019-11-28 14:24:31 +0100258
259 # Set this to true to disable trace events.
260 rtc_disable_trace_events = false
Artem Titov9dc209a2019-11-28 17:09:30 +0100261
262 # Set this to true to disable detailed error message and logging for
263 # RTC_CHECKs.
264 rtc_disable_check_msg = false
Ying Wangef3998f2019-12-09 13:06:53 +0100265
266 # Set this to true to disable webrtc metrics.
Mirko Bonadei3c4fda22019-12-10 15:02:53 +0100267 rtc_disable_metrics = false
sazaaa42ecd2020-04-01 15:24:40 +0200268
269 # Set this to true to exclude the transient suppressor in the audio processing
270 # module from the build.
271 rtc_exclude_transient_suppressor = false
mbonadei9aa3f0a2017-01-24 06:58:22 -0800272}
273
274# Make it possible to provide custom locations for some libraries (move these
275# up into declare_args should we need to actually use them for the GN build).
276rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800277rtc_opus_dir = "//third_party/opus"
278
279# Desktop capturer is supported only on Windows, OSX and Linux.
Oleh Prypin240b8932019-06-07 13:27:07 +0200280rtc_desktop_capture_supported =
281 (is_win && current_os != "winuwp") || is_mac ||
282 (is_linux && (rtc_use_x11_extensions || rtc_use_pipewire))
mbonadei9aa3f0a2017-01-24 06:58:22 -0800283
284###############################################################################
285# Templates
286#
287
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200288# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800289# chromium.
290# We need absolute paths for all configs in templates as they are shared in
291# different subdirectories.
292webrtc_root = get_path_info(".", "abspath")
293
294# Global configuration that should be applied to all WebRTC targets.
295# You normally shouldn't need to include this in your target as it's
296# automatically included when using the rtc_* templates.
297# It sets defines, include paths and compilation warnings accordingly,
298# both for WebRTC stand-alone builds and for the scenario when WebRTC
299# native code is built as part of Chromium.
Will Harrisfc173d02018-08-29 13:56:00 -0700300rtc_common_configs = [
301 webrtc_root + ":common_config",
302 "//build/config/compiler:no_size_t_to_int_warning",
303]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800304
kthelgasonc0977102017-04-24 00:57:16 -0700305if (is_mac || is_ios) {
306 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
307}
308
mbonadei9aa3f0a2017-01-24 06:58:22 -0800309# Global public configuration that should be applied to all WebRTC targets. You
310# normally shouldn't need to include this in your target as it's automatically
311# included when using the rtc_* templates. It set the defines, include paths and
312# compilation warnings that should be propagated to dependents of the targets
313# depending on the target having this config.
314rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
315
316# Common configs to remove or add in all rtc targets.
317rtc_remove_configs = []
Mirko Bonadeifc52b912019-03-01 10:32:56 +0100318if (!build_with_chromium && is_clang) {
319 rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
320}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800321rtc_add_configs = rtc_common_configs
Mirko Bonadei96ede162018-09-06 13:45:44 +0200322rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200323rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800324
325set_defaults("rtc_test") {
326 configs = rtc_add_configs
327 suppressed_configs = []
328}
329
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200330set_defaults("rtc_library") {
331 configs = rtc_add_configs
332 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200333 absl_deps = []
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200334}
335
mbonadei9aa3f0a2017-01-24 06:58:22 -0800336set_defaults("rtc_source_set") {
337 configs = rtc_add_configs
338 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200339 absl_deps = []
mbonadei9aa3f0a2017-01-24 06:58:22 -0800340}
341
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200342set_defaults("rtc_static_library") {
mbonadei9aa3f0a2017-01-24 06:58:22 -0800343 configs = rtc_add_configs
344 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200345 absl_deps = []
mbonadei9aa3f0a2017-01-24 06:58:22 -0800346}
347
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200348set_defaults("rtc_executable") {
mbonadei9aa3f0a2017-01-24 06:58:22 -0800349 configs = rtc_add_configs
350 suppressed_configs = []
351}
352
353set_defaults("rtc_shared_library") {
354 configs = rtc_add_configs
355 suppressed_configs = []
356}
357
Per Kjellandera7f2d842018-01-10 15:54:53 +0000358webrtc_default_visibility = [ webrtc_root + "/*" ]
359if (build_with_chromium) {
360 # Allow Chromium's WebRTC overrides targets to bypass the regular
361 # visibility restrictions.
362 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
363}
364
Karl Wibergbb23c832018-04-22 19:55:00 +0200365# ---- Poisons ----
366#
367# The general idea is that some targets declare that they contain some
368# kind of poison, which makes it impossible for other targets to
369# depend on them (even transitively) unless they declare themselves
370# immune to that particular type of poison.
371#
372# Targets that *contain* poison of type foo should contain the line
373#
374# poisonous = [ "foo" ]
375#
376# and targets that *are immune but arent't themselves poisonous*
377# should contain
378#
379# allow_poison = [ "foo" ]
380#
381# This useful in cases where we have some large target or set of
382# targets and want to ensure that most other targets do not
383# transitively depend on them. For example, almost no high-level
384# target should depend on the audio codecs, since we want WebRTC users
385# to be able to inject any subset of them and actually end up with a
386# binary that doesn't include the codecs they didn't inject.
387#
388# Test-only targets (`testonly` set to true) and non-public targets
389# (`visibility` not containing "*") are automatically immune to all
390# types of poison.
391#
392# Here's the complete list of all types of poison. It must be kept in
393# 1:1 correspondence with the set of //:poison_* targets.
394#
395all_poison_types = [
396 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
397 "audio_codecs",
Anders Carlsson1f433e42018-04-24 16:39:05 +0200398
Danil Chapovalov41300af2019-07-10 12:44:43 +0200399 # Default task queue implementation.
400 "default_task_queue",
Sam Zackrisson492fdf42019-10-25 10:45:58 +0200401
402 # JSON parsing should not be needed in the "slim and modular" WebRTC.
403 "rtc_json",
404
405 # Software video codecs (VP8 and VP9 through libvpx).
406 "software_video_codecs",
Karl Wibergbb23c832018-04-22 19:55:00 +0200407]
408
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000409absl_include_config = "//third_party/abseil-cpp:absl_include_config"
410absl_define_config = "//third_party/abseil-cpp:absl_define_config"
411
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200412# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
413# that are testonly.
414absl_flags_config = webrtc_root + ":absl_flags_configs"
415
mbonadei9aa3f0a2017-01-24 06:58:22 -0800416template("rtc_test") {
417 test(target_name) {
418 forward_variables_from(invoker,
419 "*",
420 [
421 "configs",
422 "public_configs",
423 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200424 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800425 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100426
427 # Always override to public because when target_os is Android the `test`
428 # template can override it to [ "*" ] and we want to avoid conditional
429 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100430 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800431 configs += invoker.configs
432 configs -= rtc_remove_configs
433 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000434 public_configs = [
435 rtc_common_inherited_config,
436 absl_include_config,
437 absl_define_config,
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200438 absl_flags_config,
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000439 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800440 if (defined(invoker.public_configs)) {
441 public_configs += invoker.public_configs
442 }
sakald7fdb802017-05-26 01:51:53 -0700443 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800444 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
Jeremy Leconteb19cfee2020-06-25 22:57:49 +0200445 min_sdk_version = 21
Mirko Bonadeibd393b22020-07-10 23:00:41 +0200446 target_sdk_version = 23
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800447 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700448 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800449 }
450}
451
452template("rtc_source_set") {
453 source_set(target_name) {
454 forward_variables_from(invoker,
455 "*",
456 [
457 "configs",
458 "public_configs",
459 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200460 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800461 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200462 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000463 if (!defined(visibility)) {
464 visibility = webrtc_default_visibility
465 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200466
467 # What's your poison?
468 if (defined(testonly) && testonly) {
469 assert(!defined(poisonous))
470 assert(!defined(allow_poison))
471 } else {
472 if (!defined(poisonous)) {
473 poisonous = []
474 }
475 if (!defined(allow_poison)) {
476 allow_poison = []
477 }
478 if (!defined(assert_no_deps)) {
479 assert_no_deps = []
480 }
481 if (!defined(deps)) {
482 deps = []
483 }
484 foreach(p, poisonous) {
485 deps += [ webrtc_root + ":poison_" + p ]
486 }
487 foreach(poison_type, all_poison_types) {
488 allow_dep = true
489 foreach(v, visibility) {
490 if (v == "*") {
491 allow_dep = false
492 }
493 }
494 foreach(p, allow_poison + poisonous) {
495 if (p == poison_type) {
496 allow_dep = true
497 }
498 }
499 if (!allow_dep) {
500 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
501 }
502 }
503 }
504
Mirko Bonadei92dd35d2019-11-15 16:08:41 +0100505 # Chromium should only depend on the WebRTC component in order to
506 # avoid to statically link WebRTC in a component build.
507 if (build_with_chromium) {
508 publicly_visible = false
509 foreach(v, visibility) {
510 if (v == "*") {
511 publicly_visible = true
512 }
513 }
514 if (publicly_visible) {
515 visibility = []
516 visibility = webrtc_default_visibility
517 }
518 }
519
Mirko Bonadei96ede162018-09-06 13:45:44 +0200520 if (!defined(testonly) || !testonly) {
521 configs += rtc_prod_configs
522 }
523
mbonadei9aa3f0a2017-01-24 06:58:22 -0800524 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200525 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 06:58:22 -0800526 configs -= rtc_remove_configs
527 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000528 public_configs = [
529 rtc_common_inherited_config,
530 absl_include_config,
531 absl_define_config,
532 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200533 if (defined(testonly) && testonly) {
534 public_configs += [ absl_flags_config ]
535 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800536 if (defined(invoker.public_configs)) {
537 public_configs += invoker.public_configs
538 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200539
Mirko Bonadei96115cf2020-06-23 23:39:56 +0200540 # If absl_deps is [], no action is needed. If not [], then it needs to be
541 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200542 # otherwise it just needs to be added to deps.
543 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200544 if (!defined(deps)) {
545 deps = []
546 }
Mirko Bonadei08ce9862020-06-11 11:25:32 +0200547 if (build_with_chromium) {
548 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200549 } else {
550 deps += absl_deps
551 }
552 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800553 }
554}
555
mbonadei9aa3f0a2017-01-24 06:58:22 -0800556template("rtc_static_library") {
557 static_library(target_name) {
558 forward_variables_from(invoker,
559 "*",
560 [
561 "configs",
562 "public_configs",
563 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200564 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800565 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200566 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000567 if (!defined(visibility)) {
568 visibility = webrtc_default_visibility
569 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200570
571 # What's your poison?
572 if (defined(testonly) && testonly) {
573 assert(!defined(poisonous))
574 assert(!defined(allow_poison))
575 } else {
576 if (!defined(poisonous)) {
577 poisonous = []
578 }
579 if (!defined(allow_poison)) {
580 allow_poison = []
581 }
582 if (!defined(assert_no_deps)) {
583 assert_no_deps = []
584 }
585 if (!defined(deps)) {
586 deps = []
587 }
588 foreach(p, poisonous) {
589 deps += [ webrtc_root + ":poison_" + p ]
590 }
591 foreach(poison_type, all_poison_types) {
592 allow_dep = true
593 foreach(v, visibility) {
594 if (v == "*") {
595 allow_dep = false
596 }
597 }
598 foreach(p, allow_poison + poisonous) {
599 if (p == poison_type) {
600 allow_dep = true
601 }
602 }
603 if (!allow_dep) {
604 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
605 }
606 }
607 }
608
Mirko Bonadei96ede162018-09-06 13:45:44 +0200609 if (!defined(testonly) || !testonly) {
610 configs += rtc_prod_configs
611 }
612
mbonadei9aa3f0a2017-01-24 06:58:22 -0800613 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 13:15:54 +0200614 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 06:58:22 -0800615 configs -= rtc_remove_configs
616 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000617 public_configs = [
618 rtc_common_inherited_config,
619 absl_include_config,
620 absl_define_config,
621 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200622 if (defined(testonly) && testonly) {
623 public_configs += [ absl_flags_config ]
624 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800625 if (defined(invoker.public_configs)) {
626 public_configs += invoker.public_configs
627 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200628
Mirko Bonadei96115cf2020-06-23 23:39:56 +0200629 # If absl_deps is [], no action is needed. If not [], then it needs to be
630 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200631 # otherwise it just needs to be added to deps.
632 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200633 if (!defined(deps)) {
634 deps = []
635 }
Mirko Bonadei08ce9862020-06-11 11:25:32 +0200636 if (build_with_chromium) {
637 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200638 } else {
639 deps += absl_deps
640 }
641 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800642 }
643}
644
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200645# This template automatically switches the target type between source_set
646# and static_library.
647#
648# This should be the default target type for all the WebRTC targets with
649# one exception. Do not use this template for header only targets, in that case
650# rtc_source_set must be used in order to avoid build errors (e.g. libtool
651# complains if the output .a file is empty).
652#
653# How does it work:
654# Since all files in a source_set are linked into a final binary, while files
655# in a static library are only linked in if at least one symbol in them is
656# referenced, in component builds source_sets are easy to deal with because
657# all their object files are passed to the linker to create a shared library.
658# In release builds instead, static_libraries are preferred since they allow
659# the linker to discard dead code.
660# For the same reason, testonly targets will always be expanded to
661# source_set in order to be sure that tests are present in the test binary.
662template("rtc_library") {
663 if (is_component_build || (defined(invoker.testonly) && invoker.testonly)) {
664 target_type = "source_set"
665 } else {
666 target_type = "static_library"
667 }
668 target(target_type, target_name) {
669 forward_variables_from(invoker,
670 "*",
671 [
672 "configs",
673 "public_configs",
674 "suppressed_configs",
675 "visibility",
676 ])
677 forward_variables_from(invoker, [ "visibility" ])
678 if (!defined(visibility)) {
679 visibility = webrtc_default_visibility
680 }
681
682 # What's your poison?
683 if (defined(testonly) && testonly) {
684 assert(!defined(poisonous))
685 assert(!defined(allow_poison))
686 } else {
687 if (!defined(poisonous)) {
688 poisonous = []
689 }
690 if (!defined(allow_poison)) {
691 allow_poison = []
692 }
693 if (!defined(assert_no_deps)) {
694 assert_no_deps = []
695 }
696 if (!defined(deps)) {
697 deps = []
698 }
699 foreach(p, poisonous) {
700 deps += [ webrtc_root + ":poison_" + p ]
701 }
702 foreach(poison_type, all_poison_types) {
703 allow_dep = true
704 foreach(v, visibility) {
705 if (v == "*") {
706 allow_dep = false
707 }
708 }
709 foreach(p, allow_poison + poisonous) {
710 if (p == poison_type) {
711 allow_dep = true
712 }
713 }
714 if (!allow_dep) {
715 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
716 }
717 }
718 }
719
Mirko Bonadei92dd35d2019-11-15 16:08:41 +0100720 # Chromium should only depend on the WebRTC component in order to
721 # avoid to statically link WebRTC in a component build.
722 if (build_with_chromium) {
723 publicly_visible = false
724 foreach(v, visibility) {
725 if (v == "*") {
726 publicly_visible = true
727 }
728 }
729 if (publicly_visible) {
730 visibility = []
731 visibility = webrtc_default_visibility
732 }
733 }
734
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200735 if (!defined(testonly) || !testonly) {
736 configs += rtc_prod_configs
737 }
738
739 configs += invoker.configs
740 configs += rtc_library_impl_config
741 configs -= rtc_remove_configs
742 configs -= invoker.suppressed_configs
743 public_configs = [
744 rtc_common_inherited_config,
745 absl_include_config,
746 absl_define_config,
747 ]
748 if (defined(testonly) && testonly) {
749 public_configs += [ absl_flags_config ]
750 }
751 if (defined(invoker.public_configs)) {
752 public_configs += invoker.public_configs
753 }
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200754
Mirko Bonadei96115cf2020-06-23 23:39:56 +0200755 # If absl_deps is [], no action is needed. If not [], then it needs to be
756 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200757 # otherwise it just needs to be added to deps.
758 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 14:30:41 +0200759 if (!defined(deps)) {
760 deps = []
761 }
Mirko Bonadei08ce9862020-06-11 11:25:32 +0200762 if (build_with_chromium) {
763 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +0200764 } else {
765 deps += absl_deps
766 }
767 }
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200768 }
769}
770
771template("rtc_executable") {
772 executable(target_name) {
773 forward_variables_from(invoker,
774 "*",
775 [
776 "deps",
777 "configs",
778 "public_configs",
779 "suppressed_configs",
780 "visibility",
781 ])
782 forward_variables_from(invoker, [ "visibility" ])
783 if (!defined(visibility)) {
784 visibility = webrtc_default_visibility
785 }
786 configs += invoker.configs
787 configs -= rtc_remove_configs
788 configs -= invoker.suppressed_configs
789 deps = invoker.deps
790
791 public_configs = [
792 rtc_common_inherited_config,
793 absl_include_config,
794 absl_define_config,
795 ]
796 if (defined(testonly) && testonly) {
797 public_configs += [ absl_flags_config ]
798 }
799 if (defined(invoker.public_configs)) {
800 public_configs += invoker.public_configs
801 }
802 if (is_win) {
803 deps += [
804 # Give executables the default manifest on Windows (a no-op elsewhere).
805 "//build/win:default_exe_manifest",
806 ]
807 }
808 }
809}
810
mbonadei9aa3f0a2017-01-24 06:58:22 -0800811template("rtc_shared_library") {
812 shared_library(target_name) {
813 forward_variables_from(invoker,
814 "*",
815 [
816 "configs",
817 "public_configs",
818 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200819 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800820 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200821 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000822 if (!defined(visibility)) {
823 visibility = webrtc_default_visibility
824 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200825
826 # What's your poison?
827 if (defined(testonly) && testonly) {
828 assert(!defined(poisonous))
829 assert(!defined(allow_poison))
830 } else {
831 if (!defined(poisonous)) {
832 poisonous = []
833 }
834 if (!defined(allow_poison)) {
835 allow_poison = []
836 }
837 if (!defined(assert_no_deps)) {
838 assert_no_deps = []
839 }
840 if (!defined(deps)) {
841 deps = []
842 }
843 foreach(p, poisonous) {
844 deps += [ webrtc_root + ":poison_" + p ]
845 }
846 foreach(poison_type, all_poison_types) {
847 allow_dep = true
848 foreach(v, visibility) {
849 if (v == "*") {
850 allow_dep = false
851 }
852 }
853 foreach(p, allow_poison + poisonous) {
854 if (p == poison_type) {
855 allow_dep = true
856 }
857 }
858 if (!allow_dep) {
859 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
860 }
861 }
862 }
863
mbonadei9aa3f0a2017-01-24 06:58:22 -0800864 configs += invoker.configs
865 configs -= rtc_remove_configs
866 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000867 public_configs = [
868 rtc_common_inherited_config,
869 absl_include_config,
870 absl_define_config,
871 ]
Mirko Bonadei2ab97f62019-07-18 13:44:12 +0200872 if (defined(testonly) && testonly) {
873 public_configs += [ absl_flags_config ]
874 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800875 if (defined(invoker.public_configs)) {
876 public_configs += invoker.public_configs
877 }
878 }
879}
kthelgason4065a572017-02-14 04:58:56 -0800880
881if (is_ios) {
882 set_defaults("rtc_ios_xctest_test") {
883 configs = rtc_add_configs
884 suppressed_configs = []
885 }
886
887 template("rtc_ios_xctest_test") {
888 ios_xctest_test(target_name) {
889 forward_variables_from(invoker,
890 "*",
891 [
892 "configs",
893 "public_configs",
894 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200895 "visibility",
kthelgason4065a572017-02-14 04:58:56 -0800896 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200897 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000898 if (!defined(visibility)) {
899 visibility = webrtc_default_visibility
900 }
kthelgason4065a572017-02-14 04:58:56 -0800901 configs += invoker.configs
902 configs -= rtc_remove_configs
903 configs -= invoker.suppressed_configs
904 public_configs = [ rtc_common_inherited_config ]
905 if (defined(invoker.public_configs)) {
906 public_configs += invoker.public_configs
907 }
908 }
909 }
Anders Carlssondc6b4772018-01-15 13:31:03 +0100910
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400911 # TODO: Generate module.modulemap file to enable use in Swift
912 # projects. See "mac_framework_bundle_with_umbrella_header".
Anders Carlssondc6b4772018-01-15 13:31:03 +0100913 template("ios_framework_bundle_with_umbrella_header") {
914 forward_variables_from(invoker, [ "output_name" ])
915 umbrella_header_path =
916 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
917
918 ios_framework_bundle(target_name) {
919 forward_variables_from(invoker, "*", [])
920
921 deps += [ ":copy_umbrella_header_$target_name" ]
922 }
923
924 action("umbrella_header_$target_name") {
925 forward_variables_from(invoker, [ "public_headers" ])
926
927 script = "//tools_webrtc/ios/generate_umbrella_header.py"
928
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100929 outputs = [ umbrella_header_path ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100930 args = [
931 "--out",
932 rebase_path(umbrella_header_path, root_build_dir),
933 "--sources",
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200934 ] + public_headers
Anders Carlssondc6b4772018-01-15 13:31:03 +0100935 }
936
937 copy("copy_umbrella_header_$target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100938 sources = [ umbrella_header_path ]
939 outputs =
940 [ "$root_out_dir/$output_name.framework/Headers/$output_name.h" ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100941
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100942 deps = [ ":umbrella_header_$target_name" ]
Anders Carlssondc6b4772018-01-15 13:31:03 +0100943 }
944 }
945
946 set_defaults("ios_framework_bundle_with_umbrella_header") {
947 configs = default_shared_library_configs
948 }
kthelgason4065a572017-02-14 04:58:56 -0800949}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000950
Anders Carlsson37bbf792018-09-05 16:29:27 +0200951if (is_mac) {
952 template("mac_framework_bundle_with_umbrella_header") {
953 forward_variables_from(invoker, [ "output_name" ])
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200954 this_target_name = target_name
955 umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h"
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400956 modulemap_path = "$target_gen_dir/Modules/module.modulemap"
Anders Carlsson37bbf792018-09-05 16:29:27 +0200957
958 mac_framework_bundle(target_name) {
Thomas Anderson6fde78c2019-01-23 10:40:29 -0800959 forward_variables_from(invoker, "*", [ "configs" ])
960 if (defined(invoker.configs)) {
961 configs += invoker.configs
962 }
Anders Carlsson37bbf792018-09-05 16:29:27 +0200963
964 framework_version = "A"
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400965 framework_contents = [
966 "Headers",
967 "Modules",
968 "Resources",
969 ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200970
971 ldflags = [
972 "-all_load",
973 "-install_name",
974 "@rpath/$output_name.framework/$output_name",
975 ]
976
977 deps += [
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200978 ":copy_framework_headers_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400979 ":copy_modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200980 ":copy_umbrella_header_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400981 ":modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200982 ":umbrella_header_$this_target_name",
Anders Carlsson37bbf792018-09-05 16:29:27 +0200983 ]
984 }
985
Anders Carlsson95c56ee2018-09-06 15:48:17 +0200986 bundle_data("copy_framework_headers_$this_target_name") {
Anders Carlsson37bbf792018-09-05 16:29:27 +0200987 forward_variables_from(invoker, [ "sources" ])
988
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100989 outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +0200990 }
991
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -0400992 action("modulemap_$this_target_name") {
993 script = "//tools_webrtc/ios/generate_modulemap.py"
994 args = [
995 "--out",
996 rebase_path(modulemap_path, root_build_dir),
997 "--name",
998 output_name,
999 ]
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001000 outputs = [ modulemap_path ]
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -04001001 }
1002
1003 bundle_data("copy_modulemap_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001004 sources = [ modulemap_path ]
1005 outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ]
1006 deps = [ ":modulemap_$this_target_name" ]
Joel Sutherlandd2fb1bf2018-10-02 16:08:25 -04001007 }
1008
Anders Carlsson95c56ee2018-09-06 15:48:17 +02001009 action("umbrella_header_$this_target_name") {
Anders Carlsson37bbf792018-09-05 16:29:27 +02001010 forward_variables_from(invoker, [ "sources" ])
1011
1012 script = "//tools_webrtc/ios/generate_umbrella_header.py"
1013
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001014 outputs = [ umbrella_header_path ]
Anders Carlsson37bbf792018-09-05 16:29:27 +02001015 args = [
1016 "--out",
1017 rebase_path(umbrella_header_path, root_build_dir),
1018 "--sources",
1019 ] + sources
1020 }
1021
Anders Carlsson95c56ee2018-09-06 15:48:17 +02001022 bundle_data("copy_umbrella_header_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001023 sources = [ umbrella_header_path ]
1024 outputs = [ "{{bundle_contents_dir}}/Headers/$output_name.h" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +02001025
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +01001026 deps = [ ":umbrella_header_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 16:29:27 +02001027 }
1028 }
1029}
1030
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001031if (is_android) {
1032 template("rtc_android_library") {
1033 android_library(target_name) {
1034 forward_variables_from(invoker,
1035 "*",
1036 [
1037 "configs",
1038 "public_configs",
1039 "suppressed_configs",
1040 "visibility",
1041 ])
1042
Oleh Prypin05aee742018-11-23 17:29:44 +01001043 errorprone_args = []
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001044
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001045 # Treat warnings as errors.
Oleh Prypin05aee742018-11-23 17:29:44 +01001046 errorprone_args += [ "-Werror" ]
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001047
1048 # Add any arguments defined by the invoker.
Oleh Prypin05aee742018-11-23 17:29:44 +01001049 if (defined(invoker.errorprone_args)) {
1050 errorprone_args += invoker.errorprone_args
Sami Kalliomäkie7fac682018-03-20 16:32:49 +01001051 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001052
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001053 if (!defined(deps)) {
1054 deps = []
1055 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001056
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001057 no_build_hooks = true
Mirko Bonadei8b7cfa12020-06-03 21:23:41 +02001058 not_needed([ "android_manifest" ])
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001059 }
1060 }
1061
1062 template("rtc_android_apk") {
1063 android_apk(target_name) {
1064 forward_variables_from(invoker,
1065 "*",
1066 [
1067 "configs",
1068 "public_configs",
1069 "suppressed_configs",
1070 "visibility",
1071 ])
1072
1073 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 12:10:08 +01001074 errorprone_args = []
1075 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001076
1077 if (!defined(deps)) {
1078 deps = []
1079 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001080
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001081 no_build_hooks = true
1082 }
1083 }
1084
1085 template("rtc_instrumentation_test_apk") {
1086 instrumentation_test_apk(target_name) {
1087 forward_variables_from(invoker,
1088 "*",
1089 [
1090 "configs",
1091 "public_configs",
1092 "suppressed_configs",
1093 "visibility",
1094 ])
1095
1096 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 12:10:08 +01001097 errorprone_args = []
1098 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001099
1100 if (!defined(deps)) {
1101 deps = []
1102 }
Sami Kalliomäkidc526512018-03-27 17:07:27 +02001103
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +00001104 no_build_hooks = true
1105 }
1106 }
1107}