blob: eeb25c0edbd6caccb94ab2297d87048d6bfdeeb6 [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
Anders Carlssondd8c1652018-01-30 10:32:13 +0100140 # Disable this to build without support for built-in software codecs.
141 rtc_use_builtin_sw_codecs = true
Anders Carlsson358f2e02018-06-04 10:24:37 +0200142
143 if (is_ios) {
144 # Build broadcast extension in AppRTCMobile for iOS. This results in the
145 # binary only running on iOS 11+, which is why it is disabled by default.
146 rtc_apprtcmobile_broadcast_extension = false
147 }
Dan Minor9c686132018-01-15 10:20:00 -0500148}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800149
Dan Minor9c686132018-01-15 10:20:00 -0500150if (!build_with_mozilla) {
151 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800152}
153
154# A second declare_args block, so that declarations within it can
155# depend on the possibly overridden variables in the first
156# declare_args block.
157declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500158 # Enables the use of protocol buffers for debug recordings.
159 rtc_enable_protobuf = !build_with_mozilla
160
161 # Set this to disable building with support for SCTP data channels.
162 rtc_enable_sctp = !build_with_mozilla
163
164 # Disable these to not build components which can be externally provided.
165 rtc_build_json = !build_with_mozilla
166 rtc_build_libsrtp = !build_with_mozilla
167 rtc_build_libvpx = !build_with_mozilla
168 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 10:20:00 -0500169 rtc_build_opus = !build_with_mozilla
170 rtc_build_ssl = !build_with_mozilla
171 rtc_build_usrsctp = !build_with_mozilla
172
173 # Enable libevent task queues on platforms that support it.
174 # rtc_link_task_queue_impl must be set to true for this to
175 # have an effect.
Wez00cecb92018-02-09 10:41:00 -0800176 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia) {
Dan Minor9c686132018-01-15 10:20:00 -0500177 rtc_enable_libevent = false
178 rtc_build_libevent = false
179 } else {
180 rtc_enable_libevent = true
181 rtc_build_libevent = !build_with_mozilla
182 }
183
Dan Minor9c686132018-01-15 10:20:00 -0500184 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
185 # build environments, even if available for Chromium builds.
186 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
187
mbonadei9aa3f0a2017-01-24 06:58:22 -0800188 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
189 rtc_include_pulse_audio = !build_with_chromium
190
191 # Chromium uses its own IO handling, so the internal ADM is only built for
192 # standalone WebRTC.
193 rtc_include_internal_audio_device = !build_with_chromium
194
195 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500196 rtc_include_tests = !build_with_chromium && !build_with_mozilla
mbonadei9aa3f0a2017-01-24 06:58:22 -0800197}
198
199# Make it possible to provide custom locations for some libraries (move these
200# up into declare_args should we need to actually use them for the GN build).
201rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800202rtc_opus_dir = "//third_party/opus"
203
204# Desktop capturer is supported only on Windows, OSX and Linux.
Joachim Bauch75f18fc2017-12-20 21:25:47 +0100205rtc_desktop_capture_supported = is_win || is_mac || (is_linux && rtc_use_x11)
mbonadei9aa3f0a2017-01-24 06:58:22 -0800206
207###############################################################################
208# Templates
209#
210
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200211# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800212# chromium.
213# We need absolute paths for all configs in templates as they are shared in
214# different subdirectories.
215webrtc_root = get_path_info(".", "abspath")
216
217# Global configuration that should be applied to all WebRTC targets.
218# You normally shouldn't need to include this in your target as it's
219# automatically included when using the rtc_* templates.
220# It sets defines, include paths and compilation warnings accordingly,
221# both for WebRTC stand-alone builds and for the scenario when WebRTC
222# native code is built as part of Chromium.
223rtc_common_configs = [ webrtc_root + ":common_config" ]
224
kthelgasonc0977102017-04-24 00:57:16 -0700225if (is_mac || is_ios) {
226 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
227}
228
mbonadei9aa3f0a2017-01-24 06:58:22 -0800229# Global public configuration that should be applied to all WebRTC targets. You
230# normally shouldn't need to include this in your target as it's automatically
231# included when using the rtc_* templates. It set the defines, include paths and
232# compilation warnings that should be propagated to dependents of the targets
233# depending on the target having this config.
234rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
235
236# Common configs to remove or add in all rtc targets.
237rtc_remove_configs = []
238rtc_add_configs = rtc_common_configs
239
240set_defaults("rtc_test") {
241 configs = rtc_add_configs
242 suppressed_configs = []
243}
244
245set_defaults("rtc_source_set") {
246 configs = rtc_add_configs
247 suppressed_configs = []
248}
249
250set_defaults("rtc_executable") {
251 configs = rtc_add_configs
252 suppressed_configs = []
253}
254
255set_defaults("rtc_static_library") {
256 configs = rtc_add_configs
257 suppressed_configs = []
258}
259
260set_defaults("rtc_shared_library") {
261 configs = rtc_add_configs
262 suppressed_configs = []
263}
264
Per Kjellandera7f2d842018-01-10 15:54:53 +0000265webrtc_default_visibility = [ webrtc_root + "/*" ]
266if (build_with_chromium) {
267 # Allow Chromium's WebRTC overrides targets to bypass the regular
268 # visibility restrictions.
269 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
270}
271
Karl Wibergbb23c832018-04-22 19:55:00 +0200272# ---- Poisons ----
273#
274# The general idea is that some targets declare that they contain some
275# kind of poison, which makes it impossible for other targets to
276# depend on them (even transitively) unless they declare themselves
277# immune to that particular type of poison.
278#
279# Targets that *contain* poison of type foo should contain the line
280#
281# poisonous = [ "foo" ]
282#
283# and targets that *are immune but arent't themselves poisonous*
284# should contain
285#
286# allow_poison = [ "foo" ]
287#
288# This useful in cases where we have some large target or set of
289# targets and want to ensure that most other targets do not
290# transitively depend on them. For example, almost no high-level
291# target should depend on the audio codecs, since we want WebRTC users
292# to be able to inject any subset of them and actually end up with a
293# binary that doesn't include the codecs they didn't inject.
294#
295# Test-only targets (`testonly` set to true) and non-public targets
296# (`visibility` not containing "*") are automatically immune to all
297# types of poison.
298#
299# Here's the complete list of all types of poison. It must be kept in
300# 1:1 correspondence with the set of //:poison_* targets.
301#
302all_poison_types = [
303 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
304 "audio_codecs",
Anders Carlsson1f433e42018-04-24 16:39:05 +0200305
306 # Software video codecs (VP8 and VP9 through libvpx).
307 "software_video_codecs",
Karl Wibergbb23c832018-04-22 19:55:00 +0200308]
309
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000310absl_include_config = "//third_party/abseil-cpp:absl_include_config"
311absl_define_config = "//third_party/abseil-cpp:absl_define_config"
312
mbonadei9aa3f0a2017-01-24 06:58:22 -0800313template("rtc_test") {
314 test(target_name) {
315 forward_variables_from(invoker,
316 "*",
317 [
318 "configs",
319 "public_configs",
320 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200321 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800322 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100323
324 # Always override to public because when target_os is Android the `test`
325 # template can override it to [ "*" ] and we want to avoid conditional
326 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100327 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800328 configs += invoker.configs
329 configs -= rtc_remove_configs
330 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000331 public_configs = [
332 rtc_common_inherited_config,
333 absl_include_config,
334 absl_define_config,
335 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800336 if (defined(invoker.public_configs)) {
337 public_configs += invoker.public_configs
338 }
sakald7fdb802017-05-26 01:51:53 -0700339 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800340 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
341 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700342 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800343 }
344}
345
346template("rtc_source_set") {
347 source_set(target_name) {
348 forward_variables_from(invoker,
349 "*",
350 [
351 "configs",
352 "public_configs",
353 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200354 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800355 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200356 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000357 if (!defined(visibility)) {
358 visibility = webrtc_default_visibility
359 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200360
361 # What's your poison?
362 if (defined(testonly) && testonly) {
363 assert(!defined(poisonous))
364 assert(!defined(allow_poison))
365 } else {
366 if (!defined(poisonous)) {
367 poisonous = []
368 }
369 if (!defined(allow_poison)) {
370 allow_poison = []
371 }
372 if (!defined(assert_no_deps)) {
373 assert_no_deps = []
374 }
375 if (!defined(deps)) {
376 deps = []
377 }
378 foreach(p, poisonous) {
379 deps += [ webrtc_root + ":poison_" + p ]
380 }
381 foreach(poison_type, all_poison_types) {
382 allow_dep = true
383 foreach(v, visibility) {
384 if (v == "*") {
385 allow_dep = false
386 }
387 }
388 foreach(p, allow_poison + poisonous) {
389 if (p == poison_type) {
390 allow_dep = true
391 }
392 }
393 if (!allow_dep) {
394 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
395 }
396 }
397 }
398
mbonadei9aa3f0a2017-01-24 06:58:22 -0800399 configs += invoker.configs
400 configs -= rtc_remove_configs
401 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000402 public_configs = [
403 rtc_common_inherited_config,
404 absl_include_config,
405 absl_define_config,
406 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800407 if (defined(invoker.public_configs)) {
408 public_configs += invoker.public_configs
409 }
410 }
411}
412
413template("rtc_executable") {
414 executable(target_name) {
415 forward_variables_from(invoker,
416 "*",
417 [
418 "deps",
419 "configs",
420 "public_configs",
421 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200422 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800423 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200424 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000425 if (!defined(visibility)) {
426 visibility = webrtc_default_visibility
427 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800428 configs += invoker.configs
429 configs -= rtc_remove_configs
430 configs -= invoker.suppressed_configs
Tom Anderson9614a312018-06-11 15:10:34 -0700431 deps = invoker.deps
perkj650fdae2017-08-25 05:00:11 -0700432
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000433 public_configs = [
434 rtc_common_inherited_config,
435 absl_include_config,
436 absl_define_config,
437 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800438 if (defined(invoker.public_configs)) {
439 public_configs += invoker.public_configs
440 }
441 }
442}
443
444template("rtc_static_library") {
445 static_library(target_name) {
446 forward_variables_from(invoker,
447 "*",
448 [
449 "configs",
450 "public_configs",
451 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200452 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800453 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200454 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000455 if (!defined(visibility)) {
456 visibility = webrtc_default_visibility
457 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200458
459 # What's your poison?
460 if (defined(testonly) && testonly) {
461 assert(!defined(poisonous))
462 assert(!defined(allow_poison))
463 } else {
464 if (!defined(poisonous)) {
465 poisonous = []
466 }
467 if (!defined(allow_poison)) {
468 allow_poison = []
469 }
470 if (!defined(assert_no_deps)) {
471 assert_no_deps = []
472 }
473 if (!defined(deps)) {
474 deps = []
475 }
476 foreach(p, poisonous) {
477 deps += [ webrtc_root + ":poison_" + p ]
478 }
479 foreach(poison_type, all_poison_types) {
480 allow_dep = true
481 foreach(v, visibility) {
482 if (v == "*") {
483 allow_dep = false
484 }
485 }
486 foreach(p, allow_poison + poisonous) {
487 if (p == poison_type) {
488 allow_dep = true
489 }
490 }
491 if (!allow_dep) {
492 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
493 }
494 }
495 }
496
mbonadei9aa3f0a2017-01-24 06:58:22 -0800497 configs += invoker.configs
498 configs -= rtc_remove_configs
499 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000500 public_configs = [
501 rtc_common_inherited_config,
502 absl_include_config,
503 absl_define_config,
504 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800505 if (defined(invoker.public_configs)) {
506 public_configs += invoker.public_configs
507 }
508 }
509}
510
511template("rtc_shared_library") {
512 shared_library(target_name) {
513 forward_variables_from(invoker,
514 "*",
515 [
516 "configs",
517 "public_configs",
518 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200519 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800520 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200521 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000522 if (!defined(visibility)) {
523 visibility = webrtc_default_visibility
524 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200525
526 # What's your poison?
527 if (defined(testonly) && testonly) {
528 assert(!defined(poisonous))
529 assert(!defined(allow_poison))
530 } else {
531 if (!defined(poisonous)) {
532 poisonous = []
533 }
534 if (!defined(allow_poison)) {
535 allow_poison = []
536 }
537 if (!defined(assert_no_deps)) {
538 assert_no_deps = []
539 }
540 if (!defined(deps)) {
541 deps = []
542 }
543 foreach(p, poisonous) {
544 deps += [ webrtc_root + ":poison_" + p ]
545 }
546 foreach(poison_type, all_poison_types) {
547 allow_dep = true
548 foreach(v, visibility) {
549 if (v == "*") {
550 allow_dep = false
551 }
552 }
553 foreach(p, allow_poison + poisonous) {
554 if (p == poison_type) {
555 allow_dep = true
556 }
557 }
558 if (!allow_dep) {
559 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
560 }
561 }
562 }
563
mbonadei9aa3f0a2017-01-24 06:58:22 -0800564 configs += invoker.configs
565 configs -= rtc_remove_configs
566 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32 +0000567 public_configs = [
568 rtc_common_inherited_config,
569 absl_include_config,
570 absl_define_config,
571 ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800572 if (defined(invoker.public_configs)) {
573 public_configs += invoker.public_configs
574 }
575 }
576}
kthelgason4065a572017-02-14 04:58:56 -0800577
578if (is_ios) {
579 set_defaults("rtc_ios_xctest_test") {
580 configs = rtc_add_configs
581 suppressed_configs = []
582 }
583
584 template("rtc_ios_xctest_test") {
585 ios_xctest_test(target_name) {
586 forward_variables_from(invoker,
587 "*",
588 [
589 "configs",
590 "public_configs",
591 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200592 "visibility",
kthelgason4065a572017-02-14 04:58:56 -0800593 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200594 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000595 if (!defined(visibility)) {
596 visibility = webrtc_default_visibility
597 }
kthelgason4065a572017-02-14 04:58:56 -0800598 configs += invoker.configs
599 configs -= rtc_remove_configs
600 configs -= invoker.suppressed_configs
601 public_configs = [ rtc_common_inherited_config ]
602 if (defined(invoker.public_configs)) {
603 public_configs += invoker.public_configs
604 }
605 }
606 }
Anders Carlssondc6b4772018-01-15 13:31:03 +0100607
608 template("ios_framework_bundle_with_umbrella_header") {
609 forward_variables_from(invoker, [ "output_name" ])
610 umbrella_header_path =
611 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
612
613 ios_framework_bundle(target_name) {
614 forward_variables_from(invoker, "*", [])
615
616 deps += [ ":copy_umbrella_header_$target_name" ]
617 }
618
619 action("umbrella_header_$target_name") {
620 forward_variables_from(invoker, [ "public_headers" ])
621
622 script = "//tools_webrtc/ios/generate_umbrella_header.py"
623
624 outputs = [
625 umbrella_header_path,
626 ]
627 args = [
628 "--out",
629 rebase_path(umbrella_header_path, root_build_dir),
630 "--sources",
631 ] + rebase_path(public_headers, "objc/Framework/Headers/")
632 }
633
634 copy("copy_umbrella_header_$target_name") {
635 sources = [
636 umbrella_header_path,
637 ]
638 outputs = [
639 "$root_out_dir/$output_name.framework/Headers/$output_name.h",
640 ]
641
642 deps = [
643 ":umbrella_header_$target_name",
644 ]
645 }
646 }
647
648 set_defaults("ios_framework_bundle_with_umbrella_header") {
649 configs = default_shared_library_configs
650 }
kthelgason4065a572017-02-14 04:58:56 -0800651}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000652
653if (is_android) {
654 template("rtc_android_library") {
655 android_library(target_name) {
656 forward_variables_from(invoker,
657 "*",
658 [
659 "configs",
660 "public_configs",
661 "suppressed_configs",
662 "visibility",
663 ])
664
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100665 javac_args = []
666
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000667 # Treat warnings as errors.
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100668 javac_args += [ "-Werror" ]
669
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200670 # TODO(crbug.com/824679): Find out why this fails in Chromium
671 if (!build_with_chromium) {
672 javac_args += [
673 "-Xep:ParameterNotNullable:ERROR",
674 "-Xep:FieldMissingNullable:ERROR",
675 "-Xep:ReturnMissingNullable:ERROR",
676 ]
677 }
678
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100679 # Add any arguments defined by the invoker.
680 if (defined(invoker.javac_args)) {
681 javac_args += invoker.javac_args
682 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000683
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200684 if (!defined(deps)) {
685 deps = []
686 }
687 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
688
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000689 no_build_hooks = true
690 }
691 }
692
693 template("rtc_android_apk") {
694 android_apk(target_name) {
695 forward_variables_from(invoker,
696 "*",
697 [
698 "configs",
699 "public_configs",
700 "suppressed_configs",
701 "visibility",
702 ])
703
704 # Treat warnings as errors.
705 javac_args = [ "-Werror" ]
706
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200707 # TODO(crbug.com/824679): Find out why this fails in Chromium
708 if (!build_with_chromium) {
709 javac_args += [
710 "-Xep:ParameterNotNullable:ERROR",
711 "-Xep:FieldMissingNullable:ERROR",
712 "-Xep:ReturnMissingNullable:ERROR",
713 ]
714 }
715
716 if (!defined(deps)) {
717 deps = []
718 }
719 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
720
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000721 no_build_hooks = true
722 }
723 }
724
725 template("rtc_instrumentation_test_apk") {
726 instrumentation_test_apk(target_name) {
727 forward_variables_from(invoker,
728 "*",
729 [
730 "configs",
731 "public_configs",
732 "suppressed_configs",
733 "visibility",
734 ])
735
736 # Treat warnings as errors.
737 javac_args = [ "-Werror" ]
738
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200739 # TODO(crbug.com/824679): Find out why this fails in Chromium
740 if (!build_with_chromium) {
741 javac_args += [
742 "-Xep:ParameterNotNullable:ERROR",
743 "-Xep:FieldMissingNullable:ERROR",
744 "-Xep:ReturnMissingNullable:ERROR",
745 ]
746 }
747
748 if (!defined(deps)) {
749 deps = []
750 }
751 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
752
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000753 no_build_hooks = true
754 }
755 }
756}