blob: 20a572711bee5eae8767e33f5c5762dfd513f9a7 [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() {
Karl Wibergeb254b42017-11-01 15:08:12 +010034 # Include the iLBC audio codec?
35 rtc_include_ilbc = true
36
mbonadei9aa3f0a2017-01-24 06:58:22 -080037 # Disable this to avoid building the Opus audio codec.
38 rtc_include_opus = true
39
minyue2e03c662017-02-01 17:31:11 -080040 # Enable this if the Opus version upon which WebRTC is built supports direct
41 # encoding of 120 ms packets.
minyue-webrtc516711c2017-07-27 17:45:49 +020042 rtc_opus_support_120ms_ptime = true
minyue2e03c662017-02-01 17:31:11 -080043
mbonadei9aa3f0a2017-01-24 06:58:22 -080044 # Enable this to let the Opus audio codec change complexity on the fly.
45 rtc_opus_variable_complexity = false
46
mbonadei9aa3f0a2017-01-24 06:58:22 -080047 # Used to specify an external Jsoncpp include path when not compiling the
48 # library that comes with WebRTC (i.e. rtc_build_json == 0).
49 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
50
51 # Used to specify an external OpenSSL include path when not compiling the
52 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
53 rtc_ssl_root = ""
54
55 # Selects fixed-point code where possible.
56 rtc_prefer_fixed_point = false
57
mbonadei9aa3f0a2017-01-24 06:58:22 -080058 # Disable the code for the intelligibility enhancer by default.
59 rtc_enable_intelligibility_enhancer = false
60
61 # Enable when an external authentication mechanism is used for performing
62 # packet authentication for RTP packets instead of libsrtp.
63 rtc_enable_external_auth = build_with_chromium
64
65 # Selects whether debug dumps for the audio processing module
66 # should be generated.
67 apm_debug_dump = false
68
69 # Set this to true to enable BWE test logging.
70 rtc_enable_bwe_test_logging = false
71
Joachim Bauch93e91342017-12-07 01:25:53 +010072 # Set this to false to skip building examples.
73 rtc_build_examples = true
74
75 # Set this to false to skip building tools.
76 rtc_build_tools = true
77
Joachim Bauch75f18fc2017-12-20 21:25:47 +010078 # Set this to false to skip building code that requires X11.
79 rtc_use_x11 = use_x11
80
mbonadei9aa3f0a2017-01-24 06:58:22 -080081 # Enable to use the Mozilla internal settings.
82 build_with_mozilla = false
83
henrika883d00f2018-03-16 10:09:49 +010084 # Enable use of Android AAudio which requires Android SDK 26 or above and
85 # NDK r16 or above.
86 rtc_enable_android_aaudio = false
87
88 # TODO(henrika): can this flag be removed?
mbonadei9aa3f0a2017-01-24 06:58:22 -080089 rtc_enable_android_opensl = false
90
91 # Link-Time Optimizations.
92 # Executes code generation at link-time instead of compile-time.
93 # https://gcc.gnu.org/wiki/LinkTimeOptimization
94 rtc_use_lto = false
95
96 # Set to "func", "block", "edge" for coverage generation.
97 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
98 # It is recommend to set include_examples=0.
99 # Use llvm's sancov -html-report for human readable reports.
100 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
101 rtc_sanitize_coverage = ""
102
perkj650fdae2017-08-25 05:00:11 -0700103 # Links a default implementation of task queues to targets
104 # that depend on the target rtc_task_queue. Set to false to
105 # use an external implementation.
106 rtc_link_task_queue_impl = true
107
mbonadei9aa3f0a2017-01-24 06:58:22 -0800108 if (current_cpu == "arm" || current_cpu == "arm64") {
109 rtc_prefer_fixed_point = true
110 }
111
mbonadei9aa3f0a2017-01-24 06:58:22 -0800112 # Determines whether NEON code will be built.
113 rtc_build_with_neon =
114 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
115
116 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
117 # all platforms except Android and iOS. Because FFmpeg can be built
118 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
119 # value that includes H.264, for example "Chrome". If FFmpeg is built without
120 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. See
121 # also: |rtc_initialize_ffmpeg|.
122 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
123 # http://www.openh264.org, https://www.ffmpeg.org/
Patrik Höglund3bb11942018-03-16 12:36:26 +0000124 rtc_use_h264 = proprietary_codecs && !is_android && !is_ios
mbonadei9aa3f0a2017-01-24 06:58:22 -0800125
mbonadei9aa3f0a2017-01-24 06:58:22 -0800126 # By default, use normal platform audio support or dummy audio, but don't
127 # use file-based audio playout and record.
128 rtc_use_dummy_audio_file_devices = false
129
henrika7be78832017-06-13 17:34:16 +0200130 # When set to true, replace the audio output with a sinus tone at 440Hz.
131 # The ADM will ask for audio data from WebRTC but instead of reading real
132 # audio samples from NetEQ, a sinus tone will be generated and replace the
133 # real audio samples.
134 rtc_audio_device_plays_sinus_tone = false
135
mbonadei9aa3f0a2017-01-24 06:58:22 -0800136 # When set to true, test targets will declare the files needed to run memcheck
137 # as data dependencies. This is to enable memcheck execution on swarming bots.
138 rtc_use_memcheck = false
139
140 # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done
141 # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must
142 # only be initialized once. Projects that initialize FFmpeg externally, such
143 # as Chromium, must turn this flag off so that WebRTC does not also
144 # initialize.
145 rtc_initialize_ffmpeg = !build_with_chromium
Anders Carlssondd8c1652018-01-30 10:32:13 +0100146
147 # Disable this to build without support for built-in software codecs.
148 rtc_use_builtin_sw_codecs = true
Dan Minor9c686132018-01-15 10:20:00 -0500149}
mbonadei9aa3f0a2017-01-24 06:58:22 -0800150
Dan Minor9c686132018-01-15 10:20:00 -0500151if (!build_with_mozilla) {
152 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -0800153}
154
155# A second declare_args block, so that declarations within it can
156# depend on the possibly overridden variables in the first
157# declare_args block.
158declare_args() {
Dan Minor9c686132018-01-15 10:20:00 -0500159 # Enables the use of protocol buffers for debug recordings.
160 rtc_enable_protobuf = !build_with_mozilla
161
162 # Set this to disable building with support for SCTP data channels.
163 rtc_enable_sctp = !build_with_mozilla
164
165 # Disable these to not build components which can be externally provided.
166 rtc_build_json = !build_with_mozilla
167 rtc_build_libsrtp = !build_with_mozilla
168 rtc_build_libvpx = !build_with_mozilla
169 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 10:20:00 -0500170 rtc_build_opus = !build_with_mozilla
171 rtc_build_ssl = !build_with_mozilla
172 rtc_build_usrsctp = !build_with_mozilla
173
Alessio Bazzica00ec2d92018-04-24 11:47:52 +0200174 # TODO(http://bugs.webrtc.org/9071): Remove flag when openmax_dl is deleted.
175 rtc_build_openmax_dl = false
176
Dan Minor9c686132018-01-15 10:20:00 -0500177 # 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
Alessio Bazzica00ec2d92018-04-24 11:47:52 +0200188 # TODO(http://bugs.webrtc.org/9071): Remove flag when openmax_dl is deleted.
189 rtc_use_openmax_dl = false
Dan Minor9c686132018-01-15 10:20:00 -0500190
191 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
192 # build environments, even if available for Chromium builds.
193 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
194
mbonadei9aa3f0a2017-01-24 06:58:22 -0800195 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
196 rtc_include_pulse_audio = !build_with_chromium
197
198 # Chromium uses its own IO handling, so the internal ADM is only built for
199 # standalone WebRTC.
200 rtc_include_internal_audio_device = !build_with_chromium
201
202 # Include tests in standalone checkout.
Dan Minor9c686132018-01-15 10:20:00 -0500203 rtc_include_tests = !build_with_chromium && !build_with_mozilla
mbonadei9aa3f0a2017-01-24 06:58:22 -0800204}
205
206# Make it possible to provide custom locations for some libraries (move these
207# up into declare_args should we need to actually use them for the GN build).
208rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 06:58:22 -0800209rtc_opus_dir = "//third_party/opus"
210
211# Desktop capturer is supported only on Windows, OSX and Linux.
Joachim Bauch75f18fc2017-12-20 21:25:47 +0100212rtc_desktop_capture_supported = is_win || is_mac || (is_linux && rtc_use_x11)
mbonadei9aa3f0a2017-01-24 06:58:22 -0800213
214###############################################################################
215# Templates
216#
217
Mirko Bonadei92ea95e2017-09-15 06:47:31 +0200218# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 06:58:22 -0800219# chromium.
220# We need absolute paths for all configs in templates as they are shared in
221# different subdirectories.
222webrtc_root = get_path_info(".", "abspath")
223
224# Global configuration that should be applied to all WebRTC targets.
225# You normally shouldn't need to include this in your target as it's
226# automatically included when using the rtc_* templates.
227# It sets defines, include paths and compilation warnings accordingly,
228# both for WebRTC stand-alone builds and for the scenario when WebRTC
229# native code is built as part of Chromium.
230rtc_common_configs = [ webrtc_root + ":common_config" ]
231
kthelgasonc0977102017-04-24 00:57:16 -0700232if (is_mac || is_ios) {
233 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
234}
235
mbonadei9aa3f0a2017-01-24 06:58:22 -0800236# Global public configuration that should be applied to all WebRTC targets. You
237# normally shouldn't need to include this in your target as it's automatically
238# included when using the rtc_* templates. It set the defines, include paths and
239# compilation warnings that should be propagated to dependents of the targets
240# depending on the target having this config.
241rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
242
243# Common configs to remove or add in all rtc targets.
244rtc_remove_configs = []
245rtc_add_configs = rtc_common_configs
246
247set_defaults("rtc_test") {
248 configs = rtc_add_configs
249 suppressed_configs = []
250}
251
252set_defaults("rtc_source_set") {
253 configs = rtc_add_configs
254 suppressed_configs = []
255}
256
257set_defaults("rtc_executable") {
258 configs = rtc_add_configs
259 suppressed_configs = []
260}
261
262set_defaults("rtc_static_library") {
263 configs = rtc_add_configs
264 suppressed_configs = []
265}
266
267set_defaults("rtc_shared_library") {
268 configs = rtc_add_configs
269 suppressed_configs = []
270}
271
Per Kjellandera7f2d842018-01-10 15:54:53 +0000272webrtc_default_visibility = [ webrtc_root + "/*" ]
273if (build_with_chromium) {
274 # Allow Chromium's WebRTC overrides targets to bypass the regular
275 # visibility restrictions.
276 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
277}
278
Karl Wibergbb23c832018-04-22 19:55:00 +0200279# ---- Poisons ----
280#
281# The general idea is that some targets declare that they contain some
282# kind of poison, which makes it impossible for other targets to
283# depend on them (even transitively) unless they declare themselves
284# immune to that particular type of poison.
285#
286# Targets that *contain* poison of type foo should contain the line
287#
288# poisonous = [ "foo" ]
289#
290# and targets that *are immune but arent't themselves poisonous*
291# should contain
292#
293# allow_poison = [ "foo" ]
294#
295# This useful in cases where we have some large target or set of
296# targets and want to ensure that most other targets do not
297# transitively depend on them. For example, almost no high-level
298# target should depend on the audio codecs, since we want WebRTC users
299# to be able to inject any subset of them and actually end up with a
300# binary that doesn't include the codecs they didn't inject.
301#
302# Test-only targets (`testonly` set to true) and non-public targets
303# (`visibility` not containing "*") are automatically immune to all
304# types of poison.
305#
306# Here's the complete list of all types of poison. It must be kept in
307# 1:1 correspondence with the set of //:poison_* targets.
308#
309all_poison_types = [
310 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
311 "audio_codecs",
312]
313
mbonadei9aa3f0a2017-01-24 06:58:22 -0800314template("rtc_test") {
315 test(target_name) {
316 forward_variables_from(invoker,
317 "*",
318 [
319 "configs",
320 "public_configs",
321 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200322 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800323 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100324
325 # Always override to public because when target_os is Android the `test`
326 # template can override it to [ "*" ] and we want to avoid conditional
327 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100328 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800329 configs += invoker.configs
330 configs -= rtc_remove_configs
331 configs -= invoker.suppressed_configs
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000332 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800333 if (defined(invoker.public_configs)) {
334 public_configs += invoker.public_configs
335 }
sakald7fdb802017-05-26 01:51:53 -0700336 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800337 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
338 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700339 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800340 }
341}
342
343template("rtc_source_set") {
344 source_set(target_name) {
345 forward_variables_from(invoker,
346 "*",
347 [
348 "configs",
349 "public_configs",
350 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200351 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800352 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200353 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000354 if (!defined(visibility)) {
355 visibility = webrtc_default_visibility
356 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200357
358 # What's your poison?
359 if (defined(testonly) && testonly) {
360 assert(!defined(poisonous))
361 assert(!defined(allow_poison))
362 } else {
363 if (!defined(poisonous)) {
364 poisonous = []
365 }
366 if (!defined(allow_poison)) {
367 allow_poison = []
368 }
369 if (!defined(assert_no_deps)) {
370 assert_no_deps = []
371 }
372 if (!defined(deps)) {
373 deps = []
374 }
375 foreach(p, poisonous) {
376 deps += [ webrtc_root + ":poison_" + p ]
377 }
378 foreach(poison_type, all_poison_types) {
379 allow_dep = true
380 foreach(v, visibility) {
381 if (v == "*") {
382 allow_dep = false
383 }
384 }
385 foreach(p, allow_poison + poisonous) {
386 if (p == poison_type) {
387 allow_dep = true
388 }
389 }
390 if (!allow_dep) {
391 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
392 }
393 }
394 }
395
mbonadei9aa3f0a2017-01-24 06:58:22 -0800396 configs += invoker.configs
397 configs -= rtc_remove_configs
398 configs -= invoker.suppressed_configs
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000399 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800400 if (defined(invoker.public_configs)) {
401 public_configs += invoker.public_configs
402 }
403 }
404}
405
406template("rtc_executable") {
407 executable(target_name) {
408 forward_variables_from(invoker,
409 "*",
410 [
411 "deps",
412 "configs",
413 "public_configs",
414 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200415 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800416 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200417 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000418 if (!defined(visibility)) {
419 visibility = webrtc_default_visibility
420 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800421 configs += invoker.configs
422 configs -= rtc_remove_configs
423 configs -= invoker.suppressed_configs
424 deps = [
thomasanderson7f52f082017-05-18 23:51:46 -0700425 "//build/config:exe_and_shlib_deps",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800426 ]
427 deps += invoker.deps
perkj650fdae2017-08-25 05:00:11 -0700428
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000429 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800430 if (defined(invoker.public_configs)) {
431 public_configs += invoker.public_configs
432 }
433 }
434}
435
436template("rtc_static_library") {
437 static_library(target_name) {
438 forward_variables_from(invoker,
439 "*",
440 [
441 "configs",
442 "public_configs",
443 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200444 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800445 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200446 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000447 if (!defined(visibility)) {
448 visibility = webrtc_default_visibility
449 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200450
451 # What's your poison?
452 if (defined(testonly) && testonly) {
453 assert(!defined(poisonous))
454 assert(!defined(allow_poison))
455 } else {
456 if (!defined(poisonous)) {
457 poisonous = []
458 }
459 if (!defined(allow_poison)) {
460 allow_poison = []
461 }
462 if (!defined(assert_no_deps)) {
463 assert_no_deps = []
464 }
465 if (!defined(deps)) {
466 deps = []
467 }
468 foreach(p, poisonous) {
469 deps += [ webrtc_root + ":poison_" + p ]
470 }
471 foreach(poison_type, all_poison_types) {
472 allow_dep = true
473 foreach(v, visibility) {
474 if (v == "*") {
475 allow_dep = false
476 }
477 }
478 foreach(p, allow_poison + poisonous) {
479 if (p == poison_type) {
480 allow_dep = true
481 }
482 }
483 if (!allow_dep) {
484 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
485 }
486 }
487 }
488
mbonadei9aa3f0a2017-01-24 06:58:22 -0800489 configs += invoker.configs
490 configs -= rtc_remove_configs
491 configs -= invoker.suppressed_configs
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000492 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800493 if (defined(invoker.public_configs)) {
494 public_configs += invoker.public_configs
495 }
496 }
497}
498
499template("rtc_shared_library") {
500 shared_library(target_name) {
501 forward_variables_from(invoker,
502 "*",
503 [
504 "configs",
505 "public_configs",
506 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200507 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800508 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200509 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000510 if (!defined(visibility)) {
511 visibility = webrtc_default_visibility
512 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200513
514 # What's your poison?
515 if (defined(testonly) && testonly) {
516 assert(!defined(poisonous))
517 assert(!defined(allow_poison))
518 } else {
519 if (!defined(poisonous)) {
520 poisonous = []
521 }
522 if (!defined(allow_poison)) {
523 allow_poison = []
524 }
525 if (!defined(assert_no_deps)) {
526 assert_no_deps = []
527 }
528 if (!defined(deps)) {
529 deps = []
530 }
531 foreach(p, poisonous) {
532 deps += [ webrtc_root + ":poison_" + p ]
533 }
534 foreach(poison_type, all_poison_types) {
535 allow_dep = true
536 foreach(v, visibility) {
537 if (v == "*") {
538 allow_dep = false
539 }
540 }
541 foreach(p, allow_poison + poisonous) {
542 if (p == poison_type) {
543 allow_dep = true
544 }
545 }
546 if (!allow_dep) {
547 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
548 }
549 }
550 }
551
mbonadei9aa3f0a2017-01-24 06:58:22 -0800552 configs += invoker.configs
553 configs -= rtc_remove_configs
554 configs -= invoker.suppressed_configs
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000555 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800556 if (defined(invoker.public_configs)) {
557 public_configs += invoker.public_configs
558 }
559 }
560}
kthelgason4065a572017-02-14 04:58:56 -0800561
562if (is_ios) {
563 set_defaults("rtc_ios_xctest_test") {
564 configs = rtc_add_configs
565 suppressed_configs = []
566 }
567
568 template("rtc_ios_xctest_test") {
569 ios_xctest_test(target_name) {
570 forward_variables_from(invoker,
571 "*",
572 [
573 "configs",
574 "public_configs",
575 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200576 "visibility",
kthelgason4065a572017-02-14 04:58:56 -0800577 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200578 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000579 if (!defined(visibility)) {
580 visibility = webrtc_default_visibility
581 }
kthelgason4065a572017-02-14 04:58:56 -0800582 configs += invoker.configs
583 configs -= rtc_remove_configs
584 configs -= invoker.suppressed_configs
585 public_configs = [ rtc_common_inherited_config ]
586 if (defined(invoker.public_configs)) {
587 public_configs += invoker.public_configs
588 }
589 }
590 }
Anders Carlssondc6b4772018-01-15 13:31:03 +0100591
592 template("ios_framework_bundle_with_umbrella_header") {
593 forward_variables_from(invoker, [ "output_name" ])
594 umbrella_header_path =
595 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
596
597 ios_framework_bundle(target_name) {
598 forward_variables_from(invoker, "*", [])
599
600 deps += [ ":copy_umbrella_header_$target_name" ]
601 }
602
603 action("umbrella_header_$target_name") {
604 forward_variables_from(invoker, [ "public_headers" ])
605
606 script = "//tools_webrtc/ios/generate_umbrella_header.py"
607
608 outputs = [
609 umbrella_header_path,
610 ]
611 args = [
612 "--out",
613 rebase_path(umbrella_header_path, root_build_dir),
614 "--sources",
615 ] + rebase_path(public_headers, "objc/Framework/Headers/")
616 }
617
618 copy("copy_umbrella_header_$target_name") {
619 sources = [
620 umbrella_header_path,
621 ]
622 outputs = [
623 "$root_out_dir/$output_name.framework/Headers/$output_name.h",
624 ]
625
626 deps = [
627 ":umbrella_header_$target_name",
628 ]
629 }
630 }
631
632 set_defaults("ios_framework_bundle_with_umbrella_header") {
633 configs = default_shared_library_configs
634 }
kthelgason4065a572017-02-14 04:58:56 -0800635}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000636
637if (is_android) {
638 template("rtc_android_library") {
639 android_library(target_name) {
640 forward_variables_from(invoker,
641 "*",
642 [
643 "configs",
644 "public_configs",
645 "suppressed_configs",
646 "visibility",
647 ])
648
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100649 javac_args = []
650
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000651 # Treat warnings as errors.
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100652 javac_args += [ "-Werror" ]
653
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200654 # TODO(crbug.com/824679): Find out why this fails in Chromium
655 if (!build_with_chromium) {
656 javac_args += [
657 "-Xep:ParameterNotNullable:ERROR",
658 "-Xep:FieldMissingNullable:ERROR",
659 "-Xep:ReturnMissingNullable:ERROR",
660 ]
661 }
662
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100663 # Add any arguments defined by the invoker.
664 if (defined(invoker.javac_args)) {
665 javac_args += invoker.javac_args
666 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000667
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200668 if (!defined(deps)) {
669 deps = []
670 }
671 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
672
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000673 no_build_hooks = true
674 }
675 }
676
677 template("rtc_android_apk") {
678 android_apk(target_name) {
679 forward_variables_from(invoker,
680 "*",
681 [
682 "configs",
683 "public_configs",
684 "suppressed_configs",
685 "visibility",
686 ])
687
688 # Treat warnings as errors.
689 javac_args = [ "-Werror" ]
690
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200691 # TODO(crbug.com/824679): Find out why this fails in Chromium
692 if (!build_with_chromium) {
693 javac_args += [
694 "-Xep:ParameterNotNullable:ERROR",
695 "-Xep:FieldMissingNullable:ERROR",
696 "-Xep:ReturnMissingNullable:ERROR",
697 ]
698 }
699
700 if (!defined(deps)) {
701 deps = []
702 }
703 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
704
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000705 no_build_hooks = true
706 }
707 }
708
709 template("rtc_instrumentation_test_apk") {
710 instrumentation_test_apk(target_name) {
711 forward_variables_from(invoker,
712 "*",
713 [
714 "configs",
715 "public_configs",
716 "suppressed_configs",
717 "visibility",
718 ])
719
720 # Treat warnings as errors.
721 javac_args = [ "-Werror" ]
722
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200723 # TODO(crbug.com/824679): Find out why this fails in Chromium
724 if (!build_with_chromium) {
725 javac_args += [
726 "-Xep:ParameterNotNullable:ERROR",
727 "-Xep:FieldMissingNullable:ERROR",
728 "-Xep:ReturnMissingNullable:ERROR",
729 ]
730 }
731
732 if (!defined(deps)) {
733 deps = []
734 }
735 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
736
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000737 no_build_hooks = true
738 }
739 }
740}