blob: 4b1f028e6f76f756de7b67b969fd9b9fb431afa9 [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")
ehmaldonado0d729b32017-02-10 01:38:23 -080012import("//build/config/ui.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -080013import("//build_overrides/build.gni")
mbonadei96606272017-03-03 19:41:59 -080014
15if (!build_with_chromium && is_component_build) {
16 print("The Gn argument `is_component_build` is currently " +
17 "ignored for WebRTC builds.")
18 print("Component builds are supported by Chromium and the argument " +
19 "`is_component_build` makes it possible to create shared libraries " +
20 "instead of static libraries.")
21 print("If an app depends on WebRTC it makes sense to just depend on the " +
22 "WebRTC static library, so there is no difference between " +
23 "`is_component_build=true` and `is_component_build=false`.")
24 print(
25 "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md")
26 assert(!is_component_build, "Component builds are not supported in WebRTC.")
27}
28
kthelgason4065a572017-02-14 04:58:56 -080029if (is_ios) {
30 import("//build/config/ios/rules.gni")
31}
mbonadei9aa3f0a2017-01-24 06:58:22 -080032
33declare_args() {
Mirko Bonadei70400902018-08-21 15:44:28 +020034 # WARNING: This argument doesn't have any effect on the WebRTC build until
35 # https://webrtc-review.googlesource.com/c/src/+/94766 will land.
36 # Setting this to false will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
37 # will tell the pre-processor to remove the default definition of symbols
38 # needed to use field_trial. In that case a new implementation needs to be
39 # provided.
40 rtc_exclude_field_trial_default = true
41
Benjamin Wrightd6f86e82018-05-08 13:12:25 -070042 # Setting this to false will require the API user to pass in their own
43 # SSLCertificateVerifier to verify the certificates presented from a
44 # TLS-TURN server. In return disabling this saves around 100kb in the binary.
45 rtc_builtin_ssl_root_certificates = true
46
Karl Wibergeb254b42017-11-01 15:08:12 +010047 # Include the iLBC audio codec?
48 rtc_include_ilbc = true
49
mbonadei9aa3f0a2017-01-24 06:58:22 -080050 # Disable this to avoid building the Opus audio codec.
51 rtc_include_opus = true
52
minyue2e03c662017-02-01 17:31:11 -080053 # Enable this if the Opus version upon which WebRTC is built supports direct
54 # encoding of 120 ms packets.
minyue-webrtc516711c2017-07-27 17:45:49 +020055 rtc_opus_support_120ms_ptime = true
minyue2e03c662017-02-01 17:31:11 -080056
mbonadei9aa3f0a2017-01-24 06:58:22 -080057 # Enable this to let the Opus audio codec change complexity on the fly.
58 rtc_opus_variable_complexity = false
59
mbonadei9aa3f0a2017-01-24 06:58:22 -080060 # Used to specify an external Jsoncpp include path when not compiling the
61 # library that comes with WebRTC (i.e. rtc_build_json == 0).
62 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
63
64 # Used to specify an external OpenSSL include path when not compiling the
65 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
66 rtc_ssl_root = ""
67
68 # Selects fixed-point code where possible.
69 rtc_prefer_fixed_point = false
70
mbonadei9aa3f0a2017-01-24 06:58:22 -080071 # Disable the code for the intelligibility enhancer by default.
72 rtc_enable_intelligibility_enhancer = false
73
74 # Enable when an external authentication mechanism is used for performing
75 # packet authentication for RTP packets instead of libsrtp.
76 rtc_enable_external_auth = build_with_chromium
77
78 # Selects whether debug dumps for the audio processing module
79 # should be generated.
80 apm_debug_dump = false
81
82 # Set this to true to enable BWE test logging.
83 rtc_enable_bwe_test_logging = false
84
Joachim Bauch93e91342017-12-07 01:25:53 +010085 # Set this to false to skip building examples.
86 rtc_build_examples = true
87
88 # Set this to false to skip building tools.
89 rtc_build_tools = true
90
Joachim Bauch75f18fc2017-12-20 21:25:47 +010091 # Set this to false to skip building code that requires X11.
92 rtc_use_x11 = use_x11
93
mbonadei9aa3f0a2017-01-24 06:58:22 -080094 # Enable to use the Mozilla internal settings.
95 build_with_mozilla = false
96
henrika883d00f2018-03-16 10:09:49 +010097 # Enable use of Android AAudio which requires Android SDK 26 or above and
98 # NDK r16 or above.
99 rtc_enable_android_aaudio = false
100
101 # TODO(henrika): can this flag be removed?
mbonadei9aa3f0a2017-01-24 06:58:22 -0800102 rtc_enable_android_opensl = false
103
104 # Link-Time Optimizations.
105 # Executes code generation at link-time instead of compile-time.
106 # https://gcc.gnu.org/wiki/LinkTimeOptimization
107 rtc_use_lto = false
108
109 # Set to "func", "block", "edge" for coverage generation.
110 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
111 # It is recommend to set include_examples=0.
112 # Use llvm's sancov -html-report for human readable reports.
113 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
114 rtc_sanitize_coverage = ""
115
perkj650fdae2017-08-25 05:00:11 -0700116 # Links a default implementation of task queues to targets
117 # that depend on the target rtc_task_queue. Set to false to
118 # use an external implementation.
119 rtc_link_task_queue_impl = true
120
mbonadei9aa3f0a2017-01-24 06:58:22 -0800121 if (current_cpu == "arm" || current_cpu == "arm64") {
122 rtc_prefer_fixed_point = true
123 }
124
mbonadei9aa3f0a2017-01-24 06:58:22 -0800125 # Determines whether NEON code will be built.
126 rtc_build_with_neon =
127 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
128
129 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
130 # all platforms except Android and iOS. Because FFmpeg can be built
131 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
132 # value that includes H.264, for example "Chrome". If FFmpeg is built without
Sergey Silkinfe288eb2018-06-25 16:22:38 +0200133 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize.
mbonadei9aa3f0a2017-01-24 06:58:22 -0800134 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
135 # http://www.openh264.org, https://www.ffmpeg.org/
Patrik Höglund3bb11942018-03-16 12:36:26 +0000136 rtc_use_h264 = proprietary_codecs && !is_android && !is_ios
mbonadei9aa3f0a2017-01-24 06:58:22 -0800137
mbonadei9aa3f0a2017-01-24 06:58:22 -0800138 # By default, use normal platform audio support or dummy audio, but don't
139 # use file-based audio playout and record.
140 rtc_use_dummy_audio_file_devices = false
141
henrika7be78832017-06-13 17:34:16 +0200142 # When set to true, replace the audio output with a sinus tone at 440Hz.
143 # The ADM will ask for audio data from WebRTC but instead of reading real
144 # audio samples from NetEQ, a sinus tone will be generated and replace the
145 # real audio samples.
146 rtc_audio_device_plays_sinus_tone = false
147
Anders Carlssondd8c1652018-01-30 10:32:13 +0100148 # Disable this to build without support for built-in software codecs.
149 rtc_use_builtin_sw_codecs = true
Anders Carlsson358f2e02018-06-04 10:24:37 +0200150
151 if (is_ios) {
152 # Build broadcast extension in AppRTCMobile for iOS. This results in the
153 # binary only running on iOS 11+, which is why it is disabled by default.
154 rtc_apprtcmobile_broadcast_extension = false
155 }
Dan Minor9c686132018-01-15 10:20:00 -0500156}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800157
Dan Minor9c686132018-01-15 10:20:00 -0500158if (!build_with_mozilla) {
159 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800160}
161
162# A second declare_args block, so that declarations within it can
163# depend on the possibly overridden variables in the first
164# declare_args block.
165declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500166 # Enables the use of protocol buffers for debug recordings.
167 rtc_enable_protobuf = !build_with_mozilla
168
169 # Set this to disable building with support for SCTP data channels.
170 rtc_enable_sctp = !build_with_mozilla
171
172 # Disable these to not build components which can be externally provided.
173 rtc_build_json = !build_with_mozilla
174 rtc_build_libsrtp = !build_with_mozilla
175 rtc_build_libvpx = !build_with_mozilla
176 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 10:20:00 -0500177 rtc_build_opus = !build_with_mozilla
178 rtc_build_ssl = !build_with_mozilla
179 rtc_build_usrsctp = !build_with_mozilla
180
181 # Enable libevent task queues on platforms that support it.
182 # rtc_link_task_queue_impl must be set to true for this to
183 # have an effect.
Wez00cecb92018-02-09 10:41:00 -0800184 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia) {
Dan Minor9c686132018-01-15 10:20:00 -0500185 rtc_enable_libevent = false
186 rtc_build_libevent = false
187 } else {
188 rtc_enable_libevent = true
189 rtc_build_libevent = !build_with_mozilla
190 }
191
Dan Minor9c686132018-01-15 10:20:00 -0500192 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
193 # build environments, even if available for Chromium builds.
194 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
195
mbonadei9aa3f0a2017-01-24 06:58:22 -0800196 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
197 rtc_include_pulse_audio = !build_with_chromium
198
199 # Chromium uses its own IO handling, so the internal ADM is only built for
200 # standalone WebRTC.
201 rtc_include_internal_audio_device = !build_with_chromium
202
203 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500204 rtc_include_tests = !build_with_chromium && !build_with_mozilla
mbonadei9aa3f0a2017-01-24 06:58:22 -0800205}
206
207# Make it possible to provide custom locations for some libraries (move these
208# up into declare_args should we need to actually use them for the GN build).
209rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800210rtc_opus_dir = "//third_party/opus"
211
212# Desktop capturer is supported only on Windows, OSX and Linux.
Joachim Bauch75f18fc2017-12-20 21:25:47 +0100213rtc_desktop_capture_supported = is_win || is_mac || (is_linux && rtc_use_x11)
mbonadei9aa3f0a2017-01-24 06:58:22 -0800214
215###############################################################################
216# Templates
217#
218
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200219# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800220# chromium.
221# We need absolute paths for all configs in templates as they are shared in
222# different subdirectories.
223webrtc_root = get_path_info(".", "abspath")
224
225# Global configuration that should be applied to all WebRTC targets.
226# You normally shouldn't need to include this in your target as it's
227# automatically included when using the rtc_* templates.
228# It sets defines, include paths and compilation warnings accordingly,
229# both for WebRTC stand-alone builds and for the scenario when WebRTC
230# native code is built as part of Chromium.
231rtc_common_configs = [ webrtc_root + ":common_config" ]
232
kthelgasonc0977102017-04-24 00:57:16 -0700233if (is_mac || is_ios) {
234 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
235}
236
mbonadei9aa3f0a2017-01-24 06:58:22 -0800237# Global public configuration that should be applied to all WebRTC targets. You
238# normally shouldn't need to include this in your target as it's automatically
239# included when using the rtc_* templates. It set the defines, include paths and
240# compilation warnings that should be propagated to dependents of the targets
241# depending on the target having this config.
242rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
243
244# Common configs to remove or add in all rtc targets.
245rtc_remove_configs = []
246rtc_add_configs = rtc_common_configs
247
248set_defaults("rtc_test") {
249 configs = rtc_add_configs
250 suppressed_configs = []
251}
252
253set_defaults("rtc_source_set") {
254 configs = rtc_add_configs
255 suppressed_configs = []
256}
257
258set_defaults("rtc_executable") {
259 configs = rtc_add_configs
260 suppressed_configs = []
261}
262
263set_defaults("rtc_static_library") {
264 configs = rtc_add_configs
265 suppressed_configs = []
266}
267
268set_defaults("rtc_shared_library") {
269 configs = rtc_add_configs
270 suppressed_configs = []
271}
272
Per Kjellandera7f2d842018-01-10 15:54:53 +0000273webrtc_default_visibility = [ webrtc_root + "/*" ]
274if (build_with_chromium) {
275 # Allow Chromium's WebRTC overrides targets to bypass the regular
276 # visibility restrictions.
277 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
278}
279
Karl Wibergbb23c832018-04-22 19:55:00 +0200280# ---- Poisons ----
281#
282# The general idea is that some targets declare that they contain some
283# kind of poison, which makes it impossible for other targets to
284# depend on them (even transitively) unless they declare themselves
285# immune to that particular type of poison.
286#
287# Targets that *contain* poison of type foo should contain the line
288#
289# poisonous = [ "foo" ]
290#
291# and targets that *are immune but arent't themselves poisonous*
292# should contain
293#
294# allow_poison = [ "foo" ]
295#
296# This useful in cases where we have some large target or set of
297# targets and want to ensure that most other targets do not
298# transitively depend on them. For example, almost no high-level
299# target should depend on the audio codecs, since we want WebRTC users
300# to be able to inject any subset of them and actually end up with a
301# binary that doesn't include the codecs they didn't inject.
302#
303# Test-only targets (`testonly` set to true) and non-public targets
304# (`visibility` not containing "*") are automatically immune to all
305# types of poison.
306#
307# Here's the complete list of all types of poison. It must be kept in
308# 1:1 correspondence with the set of //:poison_* targets.
309#
310all_poison_types = [
311 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
312 "audio_codecs",
Anders Carlsson1f433e42018-04-24 16:39:05 +0200313
314 # Software video codecs (VP8 and VP9 through libvpx).
315 "software_video_codecs",
Karl Wibergbb23c832018-04-22 19:55:00 +0200316]
317
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000318absl_include_config = "//third_party/abseil-cpp:absl_include_config"
319absl_define_config = "//third_party/abseil-cpp:absl_define_config"
320
mbonadei9aa3f0a2017-01-24 06:58:22 -0800321template("rtc_test") {
322 test(target_name) {
323 forward_variables_from(invoker,
324 "*",
325 [
326 "configs",
327 "public_configs",
328 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200329 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800330 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100331
332 # Always override to public because when target_os is Android the `test`
333 # template can override it to [ "*" ] and we want to avoid conditional
334 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100335 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800336 configs += invoker.configs
337 configs -= rtc_remove_configs
338 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000339 public_configs = [
340 rtc_common_inherited_config,
341 absl_include_config,
342 absl_define_config,
343 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800344 if (defined(invoker.public_configs)) {
345 public_configs += invoker.public_configs
346 }
sakald7fdb802017-05-26 01:51:53 -0700347 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800348 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
349 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700350 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800351 }
352}
353
354template("rtc_source_set") {
355 source_set(target_name) {
356 forward_variables_from(invoker,
357 "*",
358 [
359 "configs",
360 "public_configs",
361 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200362 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800363 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200364 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000365 if (!defined(visibility)) {
366 visibility = webrtc_default_visibility
367 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200368
369 # What's your poison?
370 if (defined(testonly) && testonly) {
371 assert(!defined(poisonous))
372 assert(!defined(allow_poison))
373 } else {
374 if (!defined(poisonous)) {
375 poisonous = []
376 }
377 if (!defined(allow_poison)) {
378 allow_poison = []
379 }
380 if (!defined(assert_no_deps)) {
381 assert_no_deps = []
382 }
383 if (!defined(deps)) {
384 deps = []
385 }
386 foreach(p, poisonous) {
387 deps += [ webrtc_root + ":poison_" + p ]
388 }
389 foreach(poison_type, all_poison_types) {
390 allow_dep = true
391 foreach(v, visibility) {
392 if (v == "*") {
393 allow_dep = false
394 }
395 }
396 foreach(p, allow_poison + poisonous) {
397 if (p == poison_type) {
398 allow_dep = true
399 }
400 }
401 if (!allow_dep) {
402 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
403 }
404 }
405 }
406
mbonadei9aa3f0a2017-01-24 06:58:22 -0800407 configs += invoker.configs
408 configs -= rtc_remove_configs
409 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000410 public_configs = [
411 rtc_common_inherited_config,
412 absl_include_config,
413 absl_define_config,
414 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800415 if (defined(invoker.public_configs)) {
416 public_configs += invoker.public_configs
417 }
418 }
419}
420
421template("rtc_executable") {
422 executable(target_name) {
423 forward_variables_from(invoker,
424 "*",
425 [
426 "deps",
427 "configs",
428 "public_configs",
429 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200430 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800431 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200432 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000433 if (!defined(visibility)) {
434 visibility = webrtc_default_visibility
435 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800436 configs += invoker.configs
437 configs -= rtc_remove_configs
438 configs -= invoker.suppressed_configs
Tom Anderson9614a312018-06-11 15:10:34 -0700439 deps = invoker.deps
perkj650fdae2017-08-25 05:00:11 -0700440
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000441 public_configs = [
442 rtc_common_inherited_config,
443 absl_include_config,
444 absl_define_config,
445 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800446 if (defined(invoker.public_configs)) {
447 public_configs += invoker.public_configs
448 }
449 }
450}
451
452template("rtc_static_library") {
453 static_library(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
mbonadei9aa3f0a2017-01-24 06:58:22 -0800505 configs += invoker.configs
506 configs -= rtc_remove_configs
507 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000508 public_configs = [
509 rtc_common_inherited_config,
510 absl_include_config,
511 absl_define_config,
512 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800513 if (defined(invoker.public_configs)) {
514 public_configs += invoker.public_configs
515 }
516 }
517}
518
519template("rtc_shared_library") {
520 shared_library(target_name) {
521 forward_variables_from(invoker,
522 "*",
523 [
524 "configs",
525 "public_configs",
526 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200527 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800528 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200529 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000530 if (!defined(visibility)) {
531 visibility = webrtc_default_visibility
532 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200533
534 # What's your poison?
535 if (defined(testonly) && testonly) {
536 assert(!defined(poisonous))
537 assert(!defined(allow_poison))
538 } else {
539 if (!defined(poisonous)) {
540 poisonous = []
541 }
542 if (!defined(allow_poison)) {
543 allow_poison = []
544 }
545 if (!defined(assert_no_deps)) {
546 assert_no_deps = []
547 }
548 if (!defined(deps)) {
549 deps = []
550 }
551 foreach(p, poisonous) {
552 deps += [ webrtc_root + ":poison_" + p ]
553 }
554 foreach(poison_type, all_poison_types) {
555 allow_dep = true
556 foreach(v, visibility) {
557 if (v == "*") {
558 allow_dep = false
559 }
560 }
561 foreach(p, allow_poison + poisonous) {
562 if (p == poison_type) {
563 allow_dep = true
564 }
565 }
566 if (!allow_dep) {
567 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
568 }
569 }
570 }
571
mbonadei9aa3f0a2017-01-24 06:58:22 -0800572 configs += invoker.configs
573 configs -= rtc_remove_configs
574 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000575 public_configs = [
576 rtc_common_inherited_config,
577 absl_include_config,
578 absl_define_config,
579 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800580 if (defined(invoker.public_configs)) {
581 public_configs += invoker.public_configs
582 }
583 }
584}
kthelgason4065a572017-02-14 04:58:56 -0800585
586if (is_ios) {
587 set_defaults("rtc_ios_xctest_test") {
588 configs = rtc_add_configs
589 suppressed_configs = []
590 }
591
592 template("rtc_ios_xctest_test") {
593 ios_xctest_test(target_name) {
594 forward_variables_from(invoker,
595 "*",
596 [
597 "configs",
598 "public_configs",
599 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200600 "visibility",
kthelgason4065a572017-02-14 04:58:56 -0800601 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200602 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000603 if (!defined(visibility)) {
604 visibility = webrtc_default_visibility
605 }
kthelgason4065a572017-02-14 04:58:56 -0800606 configs += invoker.configs
607 configs -= rtc_remove_configs
608 configs -= invoker.suppressed_configs
609 public_configs = [ rtc_common_inherited_config ]
610 if (defined(invoker.public_configs)) {
611 public_configs += invoker.public_configs
612 }
613 }
614 }
Anders Carlssondc6b4772018-01-15 13:31:03 +0100615
616 template("ios_framework_bundle_with_umbrella_header") {
617 forward_variables_from(invoker, [ "output_name" ])
618 umbrella_header_path =
619 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
620
621 ios_framework_bundle(target_name) {
622 forward_variables_from(invoker, "*", [])
623
624 deps += [ ":copy_umbrella_header_$target_name" ]
625 }
626
627 action("umbrella_header_$target_name") {
628 forward_variables_from(invoker, [ "public_headers" ])
629
630 script = "//tools_webrtc/ios/generate_umbrella_header.py"
631
632 outputs = [
633 umbrella_header_path,
634 ]
635 args = [
636 "--out",
637 rebase_path(umbrella_header_path, root_build_dir),
638 "--sources",
639 ] + rebase_path(public_headers, "objc/Framework/Headers/")
640 }
641
642 copy("copy_umbrella_header_$target_name") {
643 sources = [
644 umbrella_header_path,
645 ]
646 outputs = [
647 "$root_out_dir/$output_name.framework/Headers/$output_name.h",
648 ]
649
650 deps = [
651 ":umbrella_header_$target_name",
652 ]
653 }
654 }
655
656 set_defaults("ios_framework_bundle_with_umbrella_header") {
657 configs = default_shared_library_configs
658 }
kthelgason4065a572017-02-14 04:58:56 -0800659}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000660
661if (is_android) {
662 template("rtc_android_library") {
663 android_library(target_name) {
664 forward_variables_from(invoker,
665 "*",
666 [
667 "configs",
668 "public_configs",
669 "suppressed_configs",
670 "visibility",
671 ])
672
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100673 javac_args = []
674
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000675 # Treat warnings as errors.
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100676 javac_args += [ "-Werror" ]
677
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200678 # TODO(crbug.com/824679): Find out why this fails in Chromium
679 if (!build_with_chromium) {
680 javac_args += [
681 "-Xep:ParameterNotNullable:ERROR",
682 "-Xep:FieldMissingNullable:ERROR",
683 "-Xep:ReturnMissingNullable:ERROR",
684 ]
685 }
686
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100687 # Add any arguments defined by the invoker.
688 if (defined(invoker.javac_args)) {
689 javac_args += invoker.javac_args
690 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000691
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200692 if (!defined(deps)) {
693 deps = []
694 }
695 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
696
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000697 no_build_hooks = true
698 }
699 }
700
701 template("rtc_android_apk") {
702 android_apk(target_name) {
703 forward_variables_from(invoker,
704 "*",
705 [
706 "configs",
707 "public_configs",
708 "suppressed_configs",
709 "visibility",
710 ])
711
712 # Treat warnings as errors.
713 javac_args = [ "-Werror" ]
714
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200715 # TODO(crbug.com/824679): Find out why this fails in Chromium
716 if (!build_with_chromium) {
717 javac_args += [
718 "-Xep:ParameterNotNullable:ERROR",
719 "-Xep:FieldMissingNullable:ERROR",
720 "-Xep:ReturnMissingNullable:ERROR",
721 ]
722 }
723
724 if (!defined(deps)) {
725 deps = []
726 }
727 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
728
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000729 no_build_hooks = true
730 }
731 }
732
733 template("rtc_instrumentation_test_apk") {
734 instrumentation_test_apk(target_name) {
735 forward_variables_from(invoker,
736 "*",
737 [
738 "configs",
739 "public_configs",
740 "suppressed_configs",
741 "visibility",
742 ])
743
744 # Treat warnings as errors.
745 javac_args = [ "-Werror" ]
746
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200747 # TODO(crbug.com/824679): Find out why this fails in Chromium
748 if (!build_with_chromium) {
749 javac_args += [
750 "-Xep:ParameterNotNullable:ERROR",
751 "-Xep:FieldMissingNullable:ERROR",
752 "-Xep:ReturnMissingNullable:ERROR",
753 ]
754 }
755
756 if (!defined(deps)) {
757 deps = []
758 }
759 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
760
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000761 no_build_hooks = true
762 }
763 }
764}