blob: 95c24d4968d6d235d6539c9c1a600e0a80a78479 [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
mbonadei9aa3f0a2017-01-24 06:58:22 -0800316template("rtc_test") {
317 test(target_name) {
318 forward_variables_from(invoker,
319 "*",
320 [
321 "configs",
322 "public_configs",
323 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200324 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800325 ])
Mirko Bonadeidd411942017-11-21 15:35:27 +0100326
327 # Always override to public because when target_os is Android the `test`
328 # template can override it to [ "*" ] and we want to avoid conditional
329 # visibility.
Mirko Bonadei21558812017-11-21 12:47:34 +0100330 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800331 configs += invoker.configs
332 configs -= rtc_remove_configs
333 configs -= invoker.suppressed_configs
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000334 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800335 if (defined(invoker.public_configs)) {
336 public_configs += invoker.public_configs
337 }
sakald7fdb802017-05-26 01:51:53 -0700338 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 21:48:37 +0800339 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
340 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 01:51:53 -0700341 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800342 }
343}
344
345template("rtc_source_set") {
346 source_set(target_name) {
347 forward_variables_from(invoker,
348 "*",
349 [
350 "configs",
351 "public_configs",
352 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200353 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800354 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200355 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000356 if (!defined(visibility)) {
357 visibility = webrtc_default_visibility
358 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200359
360 # What's your poison?
361 if (defined(testonly) && testonly) {
362 assert(!defined(poisonous))
363 assert(!defined(allow_poison))
364 } else {
365 if (!defined(poisonous)) {
366 poisonous = []
367 }
368 if (!defined(allow_poison)) {
369 allow_poison = []
370 }
371 if (!defined(assert_no_deps)) {
372 assert_no_deps = []
373 }
374 if (!defined(deps)) {
375 deps = []
376 }
377 foreach(p, poisonous) {
378 deps += [ webrtc_root + ":poison_" + p ]
379 }
380 foreach(poison_type, all_poison_types) {
381 allow_dep = true
382 foreach(v, visibility) {
383 if (v == "*") {
384 allow_dep = false
385 }
386 }
387 foreach(p, allow_poison + poisonous) {
388 if (p == poison_type) {
389 allow_dep = true
390 }
391 }
392 if (!allow_dep) {
393 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
394 }
395 }
396 }
397
mbonadei9aa3f0a2017-01-24 06:58:22 -0800398 configs += invoker.configs
399 configs -= rtc_remove_configs
400 configs -= invoker.suppressed_configs
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000401 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800402 if (defined(invoker.public_configs)) {
403 public_configs += invoker.public_configs
404 }
405 }
406}
407
408template("rtc_executable") {
409 executable(target_name) {
410 forward_variables_from(invoker,
411 "*",
412 [
413 "deps",
414 "configs",
415 "public_configs",
416 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200417 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800418 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200419 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000420 if (!defined(visibility)) {
421 visibility = webrtc_default_visibility
422 }
mbonadei9aa3f0a2017-01-24 06:58:22 -0800423 configs += invoker.configs
424 configs -= rtc_remove_configs
425 configs -= invoker.suppressed_configs
426 deps = [
thomasanderson7f52f082017-05-18 23:51:46 -0700427 "//build/config:exe_and_shlib_deps",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800428 ]
429 deps += invoker.deps
perkj650fdae2017-08-25 05:00:11 -0700430
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000431 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800432 if (defined(invoker.public_configs)) {
433 public_configs += invoker.public_configs
434 }
435 }
436}
437
438template("rtc_static_library") {
439 static_library(target_name) {
440 forward_variables_from(invoker,
441 "*",
442 [
443 "configs",
444 "public_configs",
445 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200446 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800447 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200448 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000449 if (!defined(visibility)) {
450 visibility = webrtc_default_visibility
451 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200452
453 # What's your poison?
454 if (defined(testonly) && testonly) {
455 assert(!defined(poisonous))
456 assert(!defined(allow_poison))
457 } else {
458 if (!defined(poisonous)) {
459 poisonous = []
460 }
461 if (!defined(allow_poison)) {
462 allow_poison = []
463 }
464 if (!defined(assert_no_deps)) {
465 assert_no_deps = []
466 }
467 if (!defined(deps)) {
468 deps = []
469 }
470 foreach(p, poisonous) {
471 deps += [ webrtc_root + ":poison_" + p ]
472 }
473 foreach(poison_type, all_poison_types) {
474 allow_dep = true
475 foreach(v, visibility) {
476 if (v == "*") {
477 allow_dep = false
478 }
479 }
480 foreach(p, allow_poison + poisonous) {
481 if (p == poison_type) {
482 allow_dep = true
483 }
484 }
485 if (!allow_dep) {
486 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
487 }
488 }
489 }
490
mbonadei9aa3f0a2017-01-24 06:58:22 -0800491 configs += invoker.configs
492 configs -= rtc_remove_configs
493 configs -= invoker.suppressed_configs
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000494 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800495 if (defined(invoker.public_configs)) {
496 public_configs += invoker.public_configs
497 }
498 }
499}
500
501template("rtc_shared_library") {
502 shared_library(target_name) {
503 forward_variables_from(invoker,
504 "*",
505 [
506 "configs",
507 "public_configs",
508 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200509 "visibility",
mbonadei9aa3f0a2017-01-24 06:58:22 -0800510 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200511 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000512 if (!defined(visibility)) {
513 visibility = webrtc_default_visibility
514 }
Karl Wibergbb23c832018-04-22 19:55:00 +0200515
516 # What's your poison?
517 if (defined(testonly) && testonly) {
518 assert(!defined(poisonous))
519 assert(!defined(allow_poison))
520 } else {
521 if (!defined(poisonous)) {
522 poisonous = []
523 }
524 if (!defined(allow_poison)) {
525 allow_poison = []
526 }
527 if (!defined(assert_no_deps)) {
528 assert_no_deps = []
529 }
530 if (!defined(deps)) {
531 deps = []
532 }
533 foreach(p, poisonous) {
534 deps += [ webrtc_root + ":poison_" + p ]
535 }
536 foreach(poison_type, all_poison_types) {
537 allow_dep = true
538 foreach(v, visibility) {
539 if (v == "*") {
540 allow_dep = false
541 }
542 }
543 foreach(p, allow_poison + poisonous) {
544 if (p == poison_type) {
545 allow_dep = true
546 }
547 }
548 if (!allow_dep) {
549 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
550 }
551 }
552 }
553
mbonadei9aa3f0a2017-01-24 06:58:22 -0800554 configs += invoker.configs
555 configs -= rtc_remove_configs
556 configs -= invoker.suppressed_configs
Mirko Bonadeid161eda2018-04-19 00:07:31 +0000557 public_configs = [ rtc_common_inherited_config ]
mbonadei9aa3f0a2017-01-24 06:58:22 -0800558 if (defined(invoker.public_configs)) {
559 public_configs += invoker.public_configs
560 }
561 }
562}
kthelgason4065a572017-02-14 04:58:56 -0800563
564if (is_ios) {
565 set_defaults("rtc_ios_xctest_test") {
566 configs = rtc_add_configs
567 suppressed_configs = []
568 }
569
570 template("rtc_ios_xctest_test") {
571 ios_xctest_test(target_name) {
572 forward_variables_from(invoker,
573 "*",
574 [
575 "configs",
576 "public_configs",
577 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200578 "visibility",
kthelgason4065a572017-02-14 04:58:56 -0800579 ])
Karl Wiberg138d4ac2017-10-16 11:16:19 +0200580 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53 +0000581 if (!defined(visibility)) {
582 visibility = webrtc_default_visibility
583 }
kthelgason4065a572017-02-14 04:58:56 -0800584 configs += invoker.configs
585 configs -= rtc_remove_configs
586 configs -= invoker.suppressed_configs
587 public_configs = [ rtc_common_inherited_config ]
588 if (defined(invoker.public_configs)) {
589 public_configs += invoker.public_configs
590 }
591 }
592 }
Anders Carlssondc6b4772018-01-15 13:31:03 +0100593
594 template("ios_framework_bundle_with_umbrella_header") {
595 forward_variables_from(invoker, [ "output_name" ])
596 umbrella_header_path =
597 "$target_gen_dir/$output_name.framework/Headers/$output_name.h"
598
599 ios_framework_bundle(target_name) {
600 forward_variables_from(invoker, "*", [])
601
602 deps += [ ":copy_umbrella_header_$target_name" ]
603 }
604
605 action("umbrella_header_$target_name") {
606 forward_variables_from(invoker, [ "public_headers" ])
607
608 script = "//tools_webrtc/ios/generate_umbrella_header.py"
609
610 outputs = [
611 umbrella_header_path,
612 ]
613 args = [
614 "--out",
615 rebase_path(umbrella_header_path, root_build_dir),
616 "--sources",
617 ] + rebase_path(public_headers, "objc/Framework/Headers/")
618 }
619
620 copy("copy_umbrella_header_$target_name") {
621 sources = [
622 umbrella_header_path,
623 ]
624 outputs = [
625 "$root_out_dir/$output_name.framework/Headers/$output_name.h",
626 ]
627
628 deps = [
629 ":umbrella_header_$target_name",
630 ]
631 }
632 }
633
634 set_defaults("ios_framework_bundle_with_umbrella_header") {
635 configs = default_shared_library_configs
636 }
kthelgason4065a572017-02-14 04:58:56 -0800637}
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000638
639if (is_android) {
640 template("rtc_android_library") {
641 android_library(target_name) {
642 forward_variables_from(invoker,
643 "*",
644 [
645 "configs",
646 "public_configs",
647 "suppressed_configs",
648 "visibility",
649 ])
650
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100651 javac_args = []
652
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000653 # Treat warnings as errors.
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100654 javac_args += [ "-Werror" ]
655
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200656 # TODO(crbug.com/824679): Find out why this fails in Chromium
657 if (!build_with_chromium) {
658 javac_args += [
659 "-Xep:ParameterNotNullable:ERROR",
660 "-Xep:FieldMissingNullable:ERROR",
661 "-Xep:ReturnMissingNullable:ERROR",
662 ]
663 }
664
Sami Kalliomäkie7fac682018-03-20 16:32:49 +0100665 # Add any arguments defined by the invoker.
666 if (defined(invoker.javac_args)) {
667 javac_args += invoker.javac_args
668 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000669
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200670 if (!defined(deps)) {
671 deps = []
672 }
673 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
674
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000675 no_build_hooks = true
676 }
677 }
678
679 template("rtc_android_apk") {
680 android_apk(target_name) {
681 forward_variables_from(invoker,
682 "*",
683 [
684 "configs",
685 "public_configs",
686 "suppressed_configs",
687 "visibility",
688 ])
689
690 # Treat warnings as errors.
691 javac_args = [ "-Werror" ]
692
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200693 # TODO(crbug.com/824679): Find out why this fails in Chromium
694 if (!build_with_chromium) {
695 javac_args += [
696 "-Xep:ParameterNotNullable:ERROR",
697 "-Xep:FieldMissingNullable:ERROR",
698 "-Xep:ReturnMissingNullable:ERROR",
699 ]
700 }
701
702 if (!defined(deps)) {
703 deps = []
704 }
705 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
706
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000707 no_build_hooks = true
708 }
709 }
710
711 template("rtc_instrumentation_test_apk") {
712 instrumentation_test_apk(target_name) {
713 forward_variables_from(invoker,
714 "*",
715 [
716 "configs",
717 "public_configs",
718 "suppressed_configs",
719 "visibility",
720 ])
721
722 # Treat warnings as errors.
723 javac_args = [ "-Werror" ]
724
Sami Kalliomäkidc526512018-03-27 17:07:27 +0200725 # TODO(crbug.com/824679): Find out why this fails in Chromium
726 if (!build_with_chromium) {
727 javac_args += [
728 "-Xep:ParameterNotNullable:ERROR",
729 "-Xep:FieldMissingNullable:ERROR",
730 "-Xep:ReturnMissingNullable:ERROR",
731 ]
732 }
733
734 if (!defined(deps)) {
735 deps = []
736 }
737 deps += [ "//third_party/jsr-305:jsr_305_javalib" ]
738
Mirko Bonadeifbb3b7d2017-11-07 15:36:33 +0000739 no_build_hooks = true
740 }
741 }
742}