blob: 123e2c225d068c8bb65cba492b64c0cdad5bafce [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
125 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. See
126 # also: |rtc_initialize_ffmpeg|.
127 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
128 # http://www.openh264.org, https://www.ffmpeg.org/
Patrik Höglund3bb11942018-03-16 12:36:26 +0000129 rtc_use_h264 = proprietary_codecs && !is_android && !is_ios
mbonadei9aa3f0a2017-01-24 06:58:22 -0800130
mbonadei9aa3f0a2017-01-24 06:58:22 -0800131 # By default, use normal platform audio support or dummy audio, but don't
132 # use file-based audio playout and record.
133 rtc_use_dummy_audio_file_devices = false
134
henrika7be78832017-06-13 17:34:16 +0200135 # When set to true, replace the audio output with a sinus tone at 440Hz.
136 # The ADM will ask for audio data from WebRTC but instead of reading real
137 # audio samples from NetEQ, a sinus tone will be generated and replace the
138 # real audio samples.
139 rtc_audio_device_plays_sinus_tone = false
140
mbonadei9aa3f0a2017-01-24 06:58:22 -0800141 # When set to true, test targets will declare the files needed to run memcheck
142 # as data dependencies. This is to enable memcheck execution on swarming bots.
143 rtc_use_memcheck = false
144
145 # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done
146 # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must
147 # only be initialized once. Projects that initialize FFmpeg externally, such
148 # as Chromium, must turn this flag off so that WebRTC does not also
149 # initialize.
150 rtc_initialize_ffmpeg = !build_with_chromium
Anders Carlssondd8c1652018-01-30 10:32:13 +0100151
152 # Disable this to build without support for built-in software codecs.
153 rtc_use_builtin_sw_codecs = true
Dan Minor9c686132018-01-15 10:20:00 -0500154}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800155
Dan Minor9c686132018-01-15 10:20:00 -0500156if (!build_with_mozilla) {
157 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800158}
159
160# A second declare_args block, so that declarations within it can
161# depend on the possibly overridden variables in the first
162# declare_args block.
163declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500164 # Enables the use of protocol buffers for debug recordings.
165 rtc_enable_protobuf = !build_with_mozilla
166
167 # Set this to disable building with support for SCTP data channels.
168 rtc_enable_sctp = !build_with_mozilla
169
170 # Disable these to not build components which can be externally provided.
171 rtc_build_json = !build_with_mozilla
172 rtc_build_libsrtp = !build_with_mozilla
173 rtc_build_libvpx = !build_with_mozilla
174 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 10:20:00 -0500175 rtc_build_opus = !build_with_mozilla
176 rtc_build_ssl = !build_with_mozilla
177 rtc_build_usrsctp = !build_with_mozilla
178
179 # Enable libevent task queues on platforms that support it.
180 # rtc_link_task_queue_impl must be set to true for this to
181 # have an effect.
Wez00cecb92018-02-09 10:41:00 -0800182 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia) {
Dan Minor9c686132018-01-15 10:20:00 -0500183 rtc_enable_libevent = false
184 rtc_build_libevent = false
185 } else {
186 rtc_enable_libevent = true
187 rtc_build_libevent = !build_with_mozilla
188 }
189
Dan Minor9c686132018-01-15 10:20:00 -0500190 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
191 # build environments, even if available for Chromium builds.
192 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
193
mbonadei9aa3f0a2017-01-24 06:58:22 -0800194 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
195 rtc_include_pulse_audio = !build_with_chromium
196
197 # Chromium uses its own IO handling, so the internal ADM is only built for
198 # standalone WebRTC.
199 rtc_include_internal_audio_device = !build_with_chromium
200
201 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500202 rtc_include_tests = !build_with_chromium && !build_with_mozilla
mbonadei9aa3f0a2017-01-24 06:58:22 -0800203}
204
205# Make it possible to provide custom locations for some libraries (move these
206# up into declare_args should we need to actually use them for the GN build).
207rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800208rtc_opus_dir = "//third_party/opus"
209
210# Desktop capturer is supported only on Windows, OSX and Linux.
Joachim Bauch75f18fc2017-12-20 21:25:47 +0100211rtc_desktop_capture_supported = is_win || is_mac || (is_linux && rtc_use_x11)
mbonadei9aa3f0a2017-01-24 06:58:22 -0800212
213###############################################################################
214# Templates
215#
216
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200217# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800218# chromium.
219# We need absolute paths for all configs in templates as they are shared in
220# different subdirectories.
221webrtc_root = get_path_info(".", "abspath")
222
223# Global configuration that should be applied to all WebRTC targets.
224# You normally shouldn't need to include this in your target as it's
225# automatically included when using the rtc_* templates.
226# It sets defines, include paths and compilation warnings accordingly,
227# both for WebRTC stand-alone builds and for the scenario when WebRTC
228# native code is built as part of Chromium.
229rtc_common_configs = [ webrtc_root + ":common_config" ]
230
kthelgasonc0977102017-04-24 00:57:16 -0700231if (is_mac || is_ios) {
232 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
233}
234
mbonadei9aa3f0a2017-01-24 06:58:22 -0800235# Global public configuration that should be applied to all WebRTC targets. You
236# normally shouldn't need to include this in your target as it's automatically
237# included when using the rtc_* templates. It set the defines, include paths and
238# compilation warnings that should be propagated to dependents of the targets
239# depending on the target having this config.
240rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
241
242# Common configs to remove or add in all rtc targets.
243rtc_remove_configs = []
244rtc_add_configs = rtc_common_configs
245
246set_defaults("rtc_test") {
247 configs = rtc_add_configs
248 suppressed_configs = []
249}
250
251set_defaults("rtc_source_set") {
252 configs = rtc_add_configs
253 suppressed_configs = []
254}
255
256set_defaults("rtc_executable") {
257 configs = rtc_add_configs
258 suppressed_configs = []
259}
260
261set_defaults("rtc_static_library") {
262 configs = rtc_add_configs
263 suppressed_configs = []
264}
265
266set_defaults("rtc_shared_library") {
267 configs = rtc_add_configs
268 suppressed_configs = []
269}
270
Per Kjellandera7f2d842018-01-10 15:54:53 +0000271webrtc_default_visibility = [ webrtc_root + "/*" ]
272if (build_with_chromium) {
273 # Allow Chromium's WebRTC overrides targets to bypass the regular
274 # visibility restrictions.
275 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
276}
277
Karl Wibergbb23c832018-04-22 19:55:00 +0200278# ---- Poisons ----
279#
280# The general idea is that some targets declare that they contain some
281# kind of poison, which makes it impossible for other targets to
282# depend on them (even transitively) unless they declare themselves
283# immune to that particular type of poison.
284#
285# Targets that *contain* poison of type foo should contain the line
286#
287# poisonous = [ "foo" ]
288#
289# and targets that *are immune but arent't themselves poisonous*
290# should contain
291#
292# allow_poison = [ "foo" ]
293#
294# This useful in cases where we have some large target or set of
295# targets and want to ensure that most other targets do not
296# transitively depend on them. For example, almost no high-level
297# target should depend on the audio codecs, since we want WebRTC users
298# to be able to inject any subset of them and actually end up with a
299# binary that doesn't include the codecs they didn't inject.
300#
301# Test-only targets (`testonly` set to true) and non-public targets
302# (`visibility` not containing "*") are automatically immune to all
303# types of poison.
304#
305# Here's the complete list of all types of poison. It must be kept in
306# 1:1 correspondence with the set of //:poison_* targets.
307#
308all_poison_types = [
309 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
310 "audio_codecs",
Anders Carlsson1f433e42018-04-24 16:39:05 +0200311
312 # Software video codecs (VP8 and VP9 through libvpx).
313 "software_video_codecs",
Karl Wibergbb23c832018-04-22 19:55:00 +0200314]
315
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000316absl_include_config = "//third_party/abseil-cpp:absl_include_config"
317absl_define_config = "//third_party/abseil-cpp:absl_define_config"
318
mbonadei9aa3f0a2017-01-24 06:58:22 -0800319template("rtc_test") {
320 test(target_name) {
321 forward_variables_from(invoker,
322 "*",
323 [
324 "configs",
325 "public_configs",
326 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200327 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800328 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100329
330 # Always override to public because when target_os is Android the `test`
331 # template can override it to [ "*" ] and we want to avoid conditional
332 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100333 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800334 configs += invoker.configs
335 configs -= rtc_remove_configs
336 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000337 public_configs = [
338 rtc_common_inherited_config,
339 absl_include_config,
340 absl_define_config,
341 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800342 if (defined(invoker.public_configs)) {
343 public_configs += invoker.public_configs
344 }
sakald7fdb802017-05-26 01:51:53 -0700345 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800346 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
347 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700348 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800349 }
350}
351
352template("rtc_source_set") {
353 source_set(target_name) {
354 forward_variables_from(invoker,
355 "*",
356 [
357 "configs",
358 "public_configs",
359 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200360 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800361 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200362 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000363 if (!defined(visibility)) {
364 visibility = webrtc_default_visibility
365 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200366
367 # What's your poison?
368 if (defined(testonly) && testonly) {
369 assert(!defined(poisonous))
370 assert(!defined(allow_poison))
371 } else {
372 if (!defined(poisonous)) {
373 poisonous = []
374 }
375 if (!defined(allow_poison)) {
376 allow_poison = []
377 }
378 if (!defined(assert_no_deps)) {
379 assert_no_deps = []
380 }
381 if (!defined(deps)) {
382 deps = []
383 }
384 foreach(p, poisonous) {
385 deps += [ webrtc_root + ":poison_" + p ]
386 }
387 foreach(poison_type, all_poison_types) {
388 allow_dep = true
389 foreach(v, visibility) {
390 if (v == "*") {
391 allow_dep = false
392 }
393 }
394 foreach(p, allow_poison + poisonous) {
395 if (p == poison_type) {
396 allow_dep = true
397 }
398 }
399 if (!allow_dep) {
400 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
401 }
402 }
403 }
404
mbonadei9aa3f0a2017-01-24 06:58:22 -0800405 configs += invoker.configs
406 configs -= rtc_remove_configs
407 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000408 public_configs = [
409 rtc_common_inherited_config,
410 absl_include_config,
411 absl_define_config,
412 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800413 if (defined(invoker.public_configs)) {
414 public_configs += invoker.public_configs
415 }
416 }
417}
418
419template("rtc_executable") {
420 executable(target_name) {
421 forward_variables_from(invoker,
422 "*",
423 [
424 "deps",
425 "configs",
426 "public_configs",
427 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200428 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800429 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200430 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000431 if (!defined(visibility)) {
432 visibility = webrtc_default_visibility
433 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800434 configs += invoker.configs
435 configs -= rtc_remove_configs
436 configs -= invoker.suppressed_configs
437 deps = [
thomasanderson7f52f082017-05-18 23:51:46 -0700438 "//build/config:exe_and_shlib_deps",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800439 ]
440 deps += invoker.deps
perkj650fdae2017-08-25 05:00:11 -0700441
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000442 public_configs = [
443 rtc_common_inherited_config,
444 absl_include_config,
445 absl_define_config,
446 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800447 if (defined(invoker.public_configs)) {
448 public_configs += invoker.public_configs
449 }
450 }
451}
452
453template("rtc_static_library") {
454 static_library(target_name) {
455 forward_variables_from(invoker,
456 "*",
457 [
458 "configs",
459 "public_configs",
460 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200461 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800462 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200463 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000464 if (!defined(visibility)) {
465 visibility = webrtc_default_visibility
466 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200467
468 # What's your poison?
469 if (defined(testonly) && testonly) {
470 assert(!defined(poisonous))
471 assert(!defined(allow_poison))
472 } else {
473 if (!defined(poisonous)) {
474 poisonous = []
475 }
476 if (!defined(allow_poison)) {
477 allow_poison = []
478 }
479 if (!defined(assert_no_deps)) {
480 assert_no_deps = []
481 }
482 if (!defined(deps)) {
483 deps = []
484 }
485 foreach(p, poisonous) {
486 deps += [ webrtc_root + ":poison_" + p ]
487 }
488 foreach(poison_type, all_poison_types) {
489 allow_dep = true
490 foreach(v, visibility) {
491 if (v == "*") {
492 allow_dep = false
493 }
494 }
495 foreach(p, allow_poison + poisonous) {
496 if (p == poison_type) {
497 allow_dep = true
498 }
499 }
500 if (!allow_dep) {
501 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
502 }
503 }
504 }
505
mbonadei9aa3f0a2017-01-24 06:58:22 -0800506 configs += invoker.configs
507 configs -= rtc_remove_configs
508 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000509 public_configs = [
510 rtc_common_inherited_config,
511 absl_include_config,
512 absl_define_config,
513 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800514 if (defined(invoker.public_configs)) {
515 public_configs += invoker.public_configs
516 }
517 }
518}
519
520template("rtc_shared_library") {
521 shared_library(target_name) {
522 forward_variables_from(invoker,
523 "*",
524 [
525 "configs",
526 "public_configs",
527 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200528 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800529 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200530 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000531 if (!defined(visibility)) {
532 visibility = webrtc_default_visibility
533 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200534
535 # What's your poison?
536 if (defined(testonly) && testonly) {
537 assert(!defined(poisonous))
538 assert(!defined(allow_poison))
539 } else {
540 if (!defined(poisonous)) {
541 poisonous = []
542 }
543 if (!defined(allow_poison)) {
544 allow_poison = []
545 }
546 if (!defined(assert_no_deps)) {
547 assert_no_deps = []
548 }
549 if (!defined(deps)) {
550 deps = []
551 }
552 foreach(p, poisonous) {
553 deps += [ webrtc_root + ":poison_" + p ]
554 }
555 foreach(poison_type, all_poison_types) {
556 allow_dep = true
557 foreach(v, visibility) {
558 if (v == "*") {
559 allow_dep = false
560 }
561 }
562 foreach(p, allow_poison + poisonous) {
563 if (p == poison_type) {
564 allow_dep = true
565 }
566 }
567 if (!allow_dep) {
568 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
569 }
570 }
571 }
572
mbonadei9aa3f0a2017-01-24 06:58:22 -0800573 configs += invoker.configs
574 configs -= rtc_remove_configs
575 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000576 public_configs = [
577 rtc_common_inherited_config,
578 absl_include_config,
579 absl_define_config,
580 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800581 if (defined(invoker.public_configs)) {
582 public_configs += invoker.public_configs
583 }
584 }
585}
kthelgason4065a572017-02-14 04:58:56 -0800586
587if (is_ios) {
588 set_defaults("rtc_ios_xctest_test") {
589 configs = rtc_add_configs
590 suppressed_configs = []
591 }
592
593 template("rtc_ios_xctest_test") {
594 ios_xctest_test(target_name) {
595 forward_variables_from(invoker,
596 "*",
597 [
598 "configs",
599 "public_configs",
600 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200601 "visibility",
kthelgason4065a572017-02-14 04:58:56 -0800602 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200603 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000604 if (!defined(visibility)) {
605 visibility = webrtc_default_visibility
606 }
kthelgason4065a572017-02-14 04:58:56 -0800607 configs += invoker.configs
608 configs -= rtc_remove_configs
609 configs -= invoker.suppressed_configs
610 public_configs = [ rtc_common_inherited_config ]
611 if (defined(invoker.public_configs)) {
612 public_configs += invoker.public_configs
613 }
614 }
615 }
Anders Carlssondc6b4772018-01-15 13:31:03 +0100616
617 template("ios_framework_bundle_with_umbrella_header") {
618 forward_variables_from(invoker, [ "output_name" ])
619 umbrella_header_path =
620 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
621
622 ios_framework_bundle(target_name) {
623 forward_variables_from(invoker, "*", [])
624
625 deps += [ ":copy_umbrella_header_$target_name" ]
626 }
627
628 action("umbrella_header_$target_name") {
629 forward_variables_from(invoker, [ "public_headers" ])
630
631 script = "//tools_webrtc/ios/generate_umbrella_header.py"
632
633 outputs = [
634 umbrella_header_path,
635 ]
636 args = [
637 "--out",
638 rebase_path(umbrella_header_path, root_build_dir),
639 "--sources",
640 ] + rebase_path(public_headers, "objc/Framework/Headers/")
641 }
642
643 copy("copy_umbrella_header_$target_name") {
644 sources = [
645 umbrella_header_path,
646 ]
647 outputs = [
648 "$root_out_dir/$output_name.framework/Headers/$output_name.h",
649 ]
650
651 deps = [
652 ":umbrella_header_$target_name",
653 ]
654 }
655 }
656
657 set_defaults("ios_framework_bundle_with_umbrella_header") {
658 configs = default_shared_library_configs
659 }
kthelgason4065a572017-02-14 04:58:56 -0800660}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000661
662if (is_android) {
663 template("rtc_android_library") {
664 android_library(target_name) {
665 forward_variables_from(invoker,
666 "*",
667 [
668 "configs",
669 "public_configs",
670 "suppressed_configs",
671 "visibility",
672 ])
673
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100674 javac_args = []
675
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000676 # Treat warnings as errors.
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100677 javac_args += [ "-Werror" ]
678
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200679 # TODO(crbug.com/824679): Find out why this fails in Chromium
680 if (!build_with_chromium) {
681 javac_args += [
682 "-Xep:ParameterNotNullable:ERROR",
683 "-Xep:FieldMissingNullable:ERROR",
684 "-Xep:ReturnMissingNullable:ERROR",
685 ]
686 }
687
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100688 # Add any arguments defined by the invoker.
689 if (defined(invoker.javac_args)) {
690 javac_args += invoker.javac_args
691 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000692
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200693 if (!defined(deps)) {
694 deps = []
695 }
696 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
697
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000698 no_build_hooks = true
699 }
700 }
701
702 template("rtc_android_apk") {
703 android_apk(target_name) {
704 forward_variables_from(invoker,
705 "*",
706 [
707 "configs",
708 "public_configs",
709 "suppressed_configs",
710 "visibility",
711 ])
712
713 # Treat warnings as errors.
714 javac_args = [ "-Werror" ]
715
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200716 # TODO(crbug.com/824679): Find out why this fails in Chromium
717 if (!build_with_chromium) {
718 javac_args += [
719 "-Xep:ParameterNotNullable:ERROR",
720 "-Xep:FieldMissingNullable:ERROR",
721 "-Xep:ReturnMissingNullable:ERROR",
722 ]
723 }
724
725 if (!defined(deps)) {
726 deps = []
727 }
728 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
729
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000730 no_build_hooks = true
731 }
732 }
733
734 template("rtc_instrumentation_test_apk") {
735 instrumentation_test_apk(target_name) {
736 forward_variables_from(invoker,
737 "*",
738 [
739 "configs",
740 "public_configs",
741 "suppressed_configs",
742 "visibility",
743 ])
744
745 # Treat warnings as errors.
746 javac_args = [ "-Werror" ]
747
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200748 # TODO(crbug.com/824679): Find out why this fails in Chromium
749 if (!build_with_chromium) {
750 javac_args += [
751 "-Xep:ParameterNotNullable:ERROR",
752 "-Xep:FieldMissingNullable:ERROR",
753 "-Xep:ReturnMissingNullable:ERROR",
754 ]
755 }
756
757 if (!defined(deps)) {
758 deps = []
759 }
760 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
761
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000762 no_build_hooks = true
763 }
764 }
765}