blob: 3b495080a9857f851db95f5fa7e5b651a04a9a99 [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() {
Benjamin Wrightd6f86e82018-05-08 13:12:25 -070034 # Setting this to false will require the API user to pass in their own
35 # SSLCertificateVerifier to verify the certificates presented from a
36 # TLS-TURN server. In return disabling this saves around 100kb in the binary.
37 rtc_builtin_ssl_root_certificates = true
38
Karl Wibergeb254b42017-11-01 15:08:12 +010039 # Include the iLBC audio codec?
40 rtc_include_ilbc = true
41
mbonadei9aa3f0a2017-01-24 06:58:22 -080042 # Disable this to avoid building the Opus audio codec.
43 rtc_include_opus = true
44
minyue2e03c662017-02-01 17:31:11 -080045 # Enable this if the Opus version upon which WebRTC is built supports direct
46 # encoding of 120 ms packets.
minyue-webrtc516711c2017-07-27 17:45:49 +020047 rtc_opus_support_120ms_ptime = true
minyue2e03c662017-02-01 17:31:11 -080048
mbonadei9aa3f0a2017-01-24 06:58:22 -080049 # Enable this to let the Opus audio codec change complexity on the fly.
50 rtc_opus_variable_complexity = false
51
mbonadei9aa3f0a2017-01-24 06:58:22 -080052 # Used to specify an external Jsoncpp include path when not compiling the
53 # library that comes with WebRTC (i.e. rtc_build_json == 0).
54 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
55
56 # Used to specify an external OpenSSL include path when not compiling the
57 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
58 rtc_ssl_root = ""
59
60 # Selects fixed-point code where possible.
61 rtc_prefer_fixed_point = false
62
mbonadei9aa3f0a2017-01-24 06:58:22 -080063 # Disable the code for the intelligibility enhancer by default.
64 rtc_enable_intelligibility_enhancer = false
65
66 # Enable when an external authentication mechanism is used for performing
67 # packet authentication for RTP packets instead of libsrtp.
68 rtc_enable_external_auth = build_with_chromium
69
70 # Selects whether debug dumps for the audio processing module
71 # should be generated.
72 apm_debug_dump = false
73
74 # Set this to true to enable BWE test logging.
75 rtc_enable_bwe_test_logging = false
76
Joachim Bauch93e91342017-12-07 01:25:53 +010077 # Set this to false to skip building examples.
78 rtc_build_examples = true
79
80 # Set this to false to skip building tools.
81 rtc_build_tools = true
82
Joachim Bauch75f18fc2017-12-20 21:25:47 +010083 # Set this to false to skip building code that requires X11.
84 rtc_use_x11 = use_x11
85
mbonadei9aa3f0a2017-01-24 06:58:22 -080086 # Enable to use the Mozilla internal settings.
87 build_with_mozilla = false
88
henrika883d00f2018-03-16 10:09:49 +010089 # Enable use of Android AAudio which requires Android SDK 26 or above and
90 # NDK r16 or above.
91 rtc_enable_android_aaudio = false
92
93 # TODO(henrika): can this flag be removed?
mbonadei9aa3f0a2017-01-24 06:58:22 -080094 rtc_enable_android_opensl = false
95
96 # Link-Time Optimizations.
97 # Executes code generation at link-time instead of compile-time.
98 # https://gcc.gnu.org/wiki/LinkTimeOptimization
99 rtc_use_lto = false
100
101 # Set to "func", "block", "edge" for coverage generation.
102 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
103 # It is recommend to set include_examples=0.
104 # Use llvm's sancov -html-report for human readable reports.
105 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
106 rtc_sanitize_coverage = ""
107
perkj650fdae2017-08-25 05:00:11 -0700108 # Links a default implementation of task queues to targets
109 # that depend on the target rtc_task_queue. Set to false to
110 # use an external implementation.
111 rtc_link_task_queue_impl = true
112
mbonadei9aa3f0a2017-01-24 06:58:22 -0800113 if (current_cpu == "arm" || current_cpu == "arm64") {
114 rtc_prefer_fixed_point = true
115 }
116
mbonadei9aa3f0a2017-01-24 06:58:22 -0800117 # Determines whether NEON code will be built.
118 rtc_build_with_neon =
119 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
120
121 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
122 # all platforms except Android and iOS. Because FFmpeg can be built
123 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
124 # value that includes H.264, for example "Chrome". If FFmpeg is built without
Sergey Silkinfe288eb2018-06-25 16:22:38 +0200125 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize.
mbonadei9aa3f0a2017-01-24 06:58:22 -0800126 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
127 # http://www.openh264.org, https://www.ffmpeg.org/
Patrik Höglund3bb11942018-03-16 12:36:26 +0000128 rtc_use_h264 = proprietary_codecs && !is_android && !is_ios
mbonadei9aa3f0a2017-01-24 06:58:22 -0800129
mbonadei9aa3f0a2017-01-24 06:58:22 -0800130 # By default, use normal platform audio support or dummy audio, but don't
131 # use file-based audio playout and record.
132 rtc_use_dummy_audio_file_devices = false
133
henrika7be78832017-06-13 17:34:16 +0200134 # When set to true, replace the audio output with a sinus tone at 440Hz.
135 # The ADM will ask for audio data from WebRTC but instead of reading real
136 # audio samples from NetEQ, a sinus tone will be generated and replace the
137 # real audio samples.
138 rtc_audio_device_plays_sinus_tone = false
139
mbonadei9aa3f0a2017-01-24 06:58:22 -0800140 # When set to true, test targets will declare the files needed to run memcheck
141 # as data dependencies. This is to enable memcheck execution on swarming bots.
142 rtc_use_memcheck = false
143
Anders Carlssondd8c1652018-01-30 10:32:13 +0100144 # Disable this to build without support for built-in software codecs.
145 rtc_use_builtin_sw_codecs = true
Anders Carlsson358f2e02018-06-04 10:24:37 +0200146
147 if (is_ios) {
148 # Build broadcast extension in AppRTCMobile for iOS. This results in the
149 # binary only running on iOS 11+, which is why it is disabled by default.
150 rtc_apprtcmobile_broadcast_extension = false
151 }
Dan Minor9c686132018-01-15 10:20:00 -0500152}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800153
Dan Minor9c686132018-01-15 10:20:00 -0500154if (!build_with_mozilla) {
155 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800156}
157
158# A second declare_args block, so that declarations within it can
159# depend on the possibly overridden variables in the first
160# declare_args block.
161declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500162 # Enables the use of protocol buffers for debug recordings.
163 rtc_enable_protobuf = !build_with_mozilla
164
165 # Set this to disable building with support for SCTP data channels.
166 rtc_enable_sctp = !build_with_mozilla
167
168 # Disable these to not build components which can be externally provided.
169 rtc_build_json = !build_with_mozilla
170 rtc_build_libsrtp = !build_with_mozilla
171 rtc_build_libvpx = !build_with_mozilla
172 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 10:20:00 -0500173 rtc_build_opus = !build_with_mozilla
174 rtc_build_ssl = !build_with_mozilla
175 rtc_build_usrsctp = !build_with_mozilla
176
177 # Enable libevent task queues on platforms that support it.
178 # rtc_link_task_queue_impl must be set to true for this to
179 # have an effect.
Wez00cecb92018-02-09 10:41:00 -0800180 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia) {
Dan Minor9c686132018-01-15 10:20:00 -0500181 rtc_enable_libevent = false
182 rtc_build_libevent = false
183 } else {
184 rtc_enable_libevent = true
185 rtc_build_libevent = !build_with_mozilla
186 }
187
Dan Minor9c686132018-01-15 10:20:00 -0500188 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
189 # build environments, even if available for Chromium builds.
190 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
191
mbonadei9aa3f0a2017-01-24 06:58:22 -0800192 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
193 rtc_include_pulse_audio = !build_with_chromium
194
195 # Chromium uses its own IO handling, so the internal ADM is only built for
196 # standalone WebRTC.
197 rtc_include_internal_audio_device = !build_with_chromium
198
199 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500200 rtc_include_tests = !build_with_chromium && !build_with_mozilla
mbonadei9aa3f0a2017-01-24 06:58:22 -0800201}
202
203# Make it possible to provide custom locations for some libraries (move these
204# up into declare_args should we need to actually use them for the GN build).
205rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800206rtc_opus_dir = "//third_party/opus"
207
208# Desktop capturer is supported only on Windows, OSX and Linux.
Joachim Bauch75f18fc2017-12-20 21:25:47 +0100209rtc_desktop_capture_supported = is_win || is_mac || (is_linux && rtc_use_x11)
mbonadei9aa3f0a2017-01-24 06:58:22 -0800210
211###############################################################################
212# Templates
213#
214
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200215# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800216# chromium.
217# We need absolute paths for all configs in templates as they are shared in
218# different subdirectories.
219webrtc_root = get_path_info(".", "abspath")
220
221# Global configuration that should be applied to all WebRTC targets.
222# You normally shouldn't need to include this in your target as it's
223# automatically included when using the rtc_* templates.
224# It sets defines, include paths and compilation warnings accordingly,
225# both for WebRTC stand-alone builds and for the scenario when WebRTC
226# native code is built as part of Chromium.
227rtc_common_configs = [ webrtc_root + ":common_config" ]
228
kthelgasonc0977102017-04-24 00:57:16 -0700229if (is_mac || is_ios) {
230 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
231}
232
mbonadei9aa3f0a2017-01-24 06:58:22 -0800233# Global public configuration that should be applied to all WebRTC targets. You
234# normally shouldn't need to include this in your target as it's automatically
235# included when using the rtc_* templates. It set the defines, include paths and
236# compilation warnings that should be propagated to dependents of the targets
237# depending on the target having this config.
238rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
239
240# Common configs to remove or add in all rtc targets.
241rtc_remove_configs = []
242rtc_add_configs = rtc_common_configs
243
244set_defaults("rtc_test") {
245 configs = rtc_add_configs
246 suppressed_configs = []
247}
248
249set_defaults("rtc_source_set") {
250 configs = rtc_add_configs
251 suppressed_configs = []
252}
253
254set_defaults("rtc_executable") {
255 configs = rtc_add_configs
256 suppressed_configs = []
257}
258
259set_defaults("rtc_static_library") {
260 configs = rtc_add_configs
261 suppressed_configs = []
262}
263
264set_defaults("rtc_shared_library") {
265 configs = rtc_add_configs
266 suppressed_configs = []
267}
268
Per Kjellandera7f2d842018-01-10 15:54:53 +0000269webrtc_default_visibility = [ webrtc_root + "/*" ]
270if (build_with_chromium) {
271 # Allow Chromium's WebRTC overrides targets to bypass the regular
272 # visibility restrictions.
273 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
274}
275
Karl Wibergbb23c832018-04-22 19:55:00 +0200276# ---- Poisons ----
277#
278# The general idea is that some targets declare that they contain some
279# kind of poison, which makes it impossible for other targets to
280# depend on them (even transitively) unless they declare themselves
281# immune to that particular type of poison.
282#
283# Targets that *contain* poison of type foo should contain the line
284#
285# poisonous = [ "foo" ]
286#
287# and targets that *are immune but arent't themselves poisonous*
288# should contain
289#
290# allow_poison = [ "foo" ]
291#
292# This useful in cases where we have some large target or set of
293# targets and want to ensure that most other targets do not
294# transitively depend on them. For example, almost no high-level
295# target should depend on the audio codecs, since we want WebRTC users
296# to be able to inject any subset of them and actually end up with a
297# binary that doesn't include the codecs they didn't inject.
298#
299# Test-only targets (`testonly` set to true) and non-public targets
300# (`visibility` not containing "*") are automatically immune to all
301# types of poison.
302#
303# Here's the complete list of all types of poison. It must be kept in
304# 1:1 correspondence with the set of //:poison_* targets.
305#
306all_poison_types = [
307 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
308 "audio_codecs",
Anders Carlsson1f433e42018-04-24 16:39:05 +0200309
310 # Software video codecs (VP8 and VP9 through libvpx).
311 "software_video_codecs",
Karl Wibergbb23c832018-04-22 19:55:00 +0200312]
313
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000314absl_include_config = "//third_party/abseil-cpp:absl_include_config"
315absl_define_config = "//third_party/abseil-cpp:absl_define_config"
316
mbonadei9aa3f0a2017-01-24 06:58:22 -0800317template("rtc_test") {
318 test(target_name) {
319 forward_variables_from(invoker,
320 "*",
321 [
322 "configs",
323 "public_configs",
324 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200325 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800326 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100327
328 # Always override to public because when target_os is Android the `test`
329 # template can override it to [ "*" ] and we want to avoid conditional
330 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100331 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800332 configs += invoker.configs
333 configs -= rtc_remove_configs
334 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000335 public_configs = [
336 rtc_common_inherited_config,
337 absl_include_config,
338 absl_define_config,
339 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800340 if (defined(invoker.public_configs)) {
341 public_configs += invoker.public_configs
342 }
sakald7fdb802017-05-26 01:51:53 -0700343 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800344 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
345 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700346 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800347 }
348}
349
350template("rtc_source_set") {
351 source_set(target_name) {
352 forward_variables_from(invoker,
353 "*",
354 [
355 "configs",
356 "public_configs",
357 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200358 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800359 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200360 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000361 if (!defined(visibility)) {
362 visibility = webrtc_default_visibility
363 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200364
365 # What's your poison?
366 if (defined(testonly) && testonly) {
367 assert(!defined(poisonous))
368 assert(!defined(allow_poison))
369 } else {
370 if (!defined(poisonous)) {
371 poisonous = []
372 }
373 if (!defined(allow_poison)) {
374 allow_poison = []
375 }
376 if (!defined(assert_no_deps)) {
377 assert_no_deps = []
378 }
379 if (!defined(deps)) {
380 deps = []
381 }
382 foreach(p, poisonous) {
383 deps += [ webrtc_root + ":poison_" + p ]
384 }
385 foreach(poison_type, all_poison_types) {
386 allow_dep = true
387 foreach(v, visibility) {
388 if (v == "*") {
389 allow_dep = false
390 }
391 }
392 foreach(p, allow_poison + poisonous) {
393 if (p == poison_type) {
394 allow_dep = true
395 }
396 }
397 if (!allow_dep) {
398 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
399 }
400 }
401 }
402
mbonadei9aa3f0a2017-01-24 06:58:22 -0800403 configs += invoker.configs
404 configs -= rtc_remove_configs
405 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000406 public_configs = [
407 rtc_common_inherited_config,
408 absl_include_config,
409 absl_define_config,
410 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800411 if (defined(invoker.public_configs)) {
412 public_configs += invoker.public_configs
413 }
414 }
415}
416
417template("rtc_executable") {
418 executable(target_name) {
419 forward_variables_from(invoker,
420 "*",
421 [
422 "deps",
423 "configs",
424 "public_configs",
425 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200426 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800427 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200428 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000429 if (!defined(visibility)) {
430 visibility = webrtc_default_visibility
431 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800432 configs += invoker.configs
433 configs -= rtc_remove_configs
434 configs -= invoker.suppressed_configs
Tom Anderson9614a312018-06-11 15:10:34 -0700435 deps = invoker.deps
perkj650fdae2017-08-25 05:00:11 -0700436
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000437 public_configs = [
438 rtc_common_inherited_config,
439 absl_include_config,
440 absl_define_config,
441 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800442 if (defined(invoker.public_configs)) {
443 public_configs += invoker.public_configs
444 }
445 }
446}
447
448template("rtc_static_library") {
449 static_library(target_name) {
450 forward_variables_from(invoker,
451 "*",
452 [
453 "configs",
454 "public_configs",
455 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200456 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800457 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200458 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000459 if (!defined(visibility)) {
460 visibility = webrtc_default_visibility
461 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200462
463 # What's your poison?
464 if (defined(testonly) && testonly) {
465 assert(!defined(poisonous))
466 assert(!defined(allow_poison))
467 } else {
468 if (!defined(poisonous)) {
469 poisonous = []
470 }
471 if (!defined(allow_poison)) {
472 allow_poison = []
473 }
474 if (!defined(assert_no_deps)) {
475 assert_no_deps = []
476 }
477 if (!defined(deps)) {
478 deps = []
479 }
480 foreach(p, poisonous) {
481 deps += [ webrtc_root + ":poison_" + p ]
482 }
483 foreach(poison_type, all_poison_types) {
484 allow_dep = true
485 foreach(v, visibility) {
486 if (v == "*") {
487 allow_dep = false
488 }
489 }
490 foreach(p, allow_poison + poisonous) {
491 if (p == poison_type) {
492 allow_dep = true
493 }
494 }
495 if (!allow_dep) {
496 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
497 }
498 }
499 }
500
mbonadei9aa3f0a2017-01-24 06:58:22 -0800501 configs += invoker.configs
502 configs -= rtc_remove_configs
503 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000504 public_configs = [
505 rtc_common_inherited_config,
506 absl_include_config,
507 absl_define_config,
508 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800509 if (defined(invoker.public_configs)) {
510 public_configs += invoker.public_configs
511 }
512 }
513}
514
515template("rtc_shared_library") {
516 shared_library(target_name) {
517 forward_variables_from(invoker,
518 "*",
519 [
520 "configs",
521 "public_configs",
522 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200523 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800524 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200525 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000526 if (!defined(visibility)) {
527 visibility = webrtc_default_visibility
528 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200529
530 # What's your poison?
531 if (defined(testonly) && testonly) {
532 assert(!defined(poisonous))
533 assert(!defined(allow_poison))
534 } else {
535 if (!defined(poisonous)) {
536 poisonous = []
537 }
538 if (!defined(allow_poison)) {
539 allow_poison = []
540 }
541 if (!defined(assert_no_deps)) {
542 assert_no_deps = []
543 }
544 if (!defined(deps)) {
545 deps = []
546 }
547 foreach(p, poisonous) {
548 deps += [ webrtc_root + ":poison_" + p ]
549 }
550 foreach(poison_type, all_poison_types) {
551 allow_dep = true
552 foreach(v, visibility) {
553 if (v == "*") {
554 allow_dep = false
555 }
556 }
557 foreach(p, allow_poison + poisonous) {
558 if (p == poison_type) {
559 allow_dep = true
560 }
561 }
562 if (!allow_dep) {
563 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
564 }
565 }
566 }
567
mbonadei9aa3f0a2017-01-24 06:58:22 -0800568 configs += invoker.configs
569 configs -= rtc_remove_configs
570 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000571 public_configs = [
572 rtc_common_inherited_config,
573 absl_include_config,
574 absl_define_config,
575 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800576 if (defined(invoker.public_configs)) {
577 public_configs += invoker.public_configs
578 }
579 }
580}
kthelgason4065a572017-02-14 04:58:56 -0800581
582if (is_ios) {
583 set_defaults("rtc_ios_xctest_test") {
584 configs = rtc_add_configs
585 suppressed_configs = []
586 }
587
588 template("rtc_ios_xctest_test") {
589 ios_xctest_test(target_name) {
590 forward_variables_from(invoker,
591 "*",
592 [
593 "configs",
594 "public_configs",
595 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200596 "visibility",
kthelgason4065a572017-02-14 04:58:56 -0800597 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200598 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000599 if (!defined(visibility)) {
600 visibility = webrtc_default_visibility
601 }
kthelgason4065a572017-02-14 04:58:56 -0800602 configs += invoker.configs
603 configs -= rtc_remove_configs
604 configs -= invoker.suppressed_configs
605 public_configs = [ rtc_common_inherited_config ]
606 if (defined(invoker.public_configs)) {
607 public_configs += invoker.public_configs
608 }
609 }
610 }
Anders Carlssondc6b4772018-01-15 13:31:03 +0100611
612 template("ios_framework_bundle_with_umbrella_header") {
613 forward_variables_from(invoker, [ "output_name" ])
614 umbrella_header_path =
615 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
616
617 ios_framework_bundle(target_name) {
618 forward_variables_from(invoker, "*", [])
619
620 deps += [ ":copy_umbrella_header_$target_name" ]
621 }
622
623 action("umbrella_header_$target_name") {
624 forward_variables_from(invoker, [ "public_headers" ])
625
626 script = "//tools_webrtc/ios/generate_umbrella_header.py"
627
628 outputs = [
629 umbrella_header_path,
630 ]
631 args = [
632 "--out",
633 rebase_path(umbrella_header_path, root_build_dir),
634 "--sources",
635 ] + rebase_path(public_headers, "objc/Framework/Headers/")
636 }
637
638 copy("copy_umbrella_header_$target_name") {
639 sources = [
640 umbrella_header_path,
641 ]
642 outputs = [
643 "$root_out_dir/$output_name.framework/Headers/$output_name.h",
644 ]
645
646 deps = [
647 ":umbrella_header_$target_name",
648 ]
649 }
650 }
651
652 set_defaults("ios_framework_bundle_with_umbrella_header") {
653 configs = default_shared_library_configs
654 }
kthelgason4065a572017-02-14 04:58:56 -0800655}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000656
657if (is_android) {
658 template("rtc_android_library") {
659 android_library(target_name) {
660 forward_variables_from(invoker,
661 "*",
662 [
663 "configs",
664 "public_configs",
665 "suppressed_configs",
666 "visibility",
667 ])
668
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100669 javac_args = []
670
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000671 # Treat warnings as errors.
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100672 javac_args += [ "-Werror" ]
673
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200674 # TODO(crbug.com/824679): Find out why this fails in Chromium
675 if (!build_with_chromium) {
676 javac_args += [
677 "-Xep:ParameterNotNullable:ERROR",
678 "-Xep:FieldMissingNullable:ERROR",
679 "-Xep:ReturnMissingNullable:ERROR",
680 ]
681 }
682
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100683 # Add any arguments defined by the invoker.
684 if (defined(invoker.javac_args)) {
685 javac_args += invoker.javac_args
686 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000687
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200688 if (!defined(deps)) {
689 deps = []
690 }
691 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
692
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000693 no_build_hooks = true
694 }
695 }
696
697 template("rtc_android_apk") {
698 android_apk(target_name) {
699 forward_variables_from(invoker,
700 "*",
701 [
702 "configs",
703 "public_configs",
704 "suppressed_configs",
705 "visibility",
706 ])
707
708 # Treat warnings as errors.
709 javac_args = [ "-Werror" ]
710
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200711 # TODO(crbug.com/824679): Find out why this fails in Chromium
712 if (!build_with_chromium) {
713 javac_args += [
714 "-Xep:ParameterNotNullable:ERROR",
715 "-Xep:FieldMissingNullable:ERROR",
716 "-Xep:ReturnMissingNullable:ERROR",
717 ]
718 }
719
720 if (!defined(deps)) {
721 deps = []
722 }
723 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
724
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000725 no_build_hooks = true
726 }
727 }
728
729 template("rtc_instrumentation_test_apk") {
730 instrumentation_test_apk(target_name) {
731 forward_variables_from(invoker,
732 "*",
733 [
734 "configs",
735 "public_configs",
736 "suppressed_configs",
737 "visibility",
738 ])
739
740 # Treat warnings as errors.
741 javac_args = [ "-Werror" ]
742
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200743 # TODO(crbug.com/824679): Find out why this fails in Chromium
744 if (!build_with_chromium) {
745 javac_args += [
746 "-Xep:ParameterNotNullable:ERROR",
747 "-Xep:FieldMissingNullable:ERROR",
748 "-Xep:ReturnMissingNullable:ERROR",
749 ]
750 }
751
752 if (!defined(deps)) {
753 deps = []
754 }
755 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
756
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000757 no_build_hooks = true
758 }
759 }
760}