forked from webrtc-sdk/webrtc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webrtc.gni
1201 lines (1059 loc) · 38.5 KB
/
webrtc.gni
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("//build/config/arm.gni")
import("//build/config/features.gni")
import("//build/config/mips.gni")
import("//build/config/ozone.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/sysroot.gni")
import("//build_overrides/build.gni")
if (!build_with_chromium && is_component_build) {
print("The Gn argument `is_component_build` is currently " +
"ignored for WebRTC builds.")
print("Component builds are supported by Chromium and the argument " +
"`is_component_build` makes it possible to create shared libraries " +
"instead of static libraries.")
print("If an app depends on WebRTC it makes sense to just depend on the " +
"WebRTC static library, so there is no difference between " +
"`is_component_build=true` and `is_component_build=false`.")
print(
"More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md")
assert(!is_component_build, "Component builds are not supported in WebRTC.")
}
if (is_ios) {
import("//build/config/ios/rules.gni")
}
if (is_mac) {
import("//build/config/mac/rules.gni")
}
if (is_fuchsia) {
import("//build/config/fuchsia/config.gni")
}
# This declare_args is separated from the next one because args declared
# in this one, can be read from the next one (args defined in the same
# declare_args cannot be referenced in that scope).
declare_args() {
# Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
# expand to code that will manage symbols visibility.
rtc_enable_symbol_export = false
}
declare_args() {
# Setting this to true, will make RTC_DLOG() expand to log statements instead
# of being removed by the preprocessor.
# This is useful for example to be able to get RTC_DLOGs on a release build.
rtc_dlog_always_on = false
# Enables additional build targets that rely on
# //third_party/google_benchmarks.
rtc_enable_google_benchmarks = true
# Setting this to true will make RTC_OBJC_EXPORT expand to code that will
# manage symbols visibility. By default, Obj-C/Obj-C++ symbols are exported
# if C++ symbols are but setting this arg to true while keeping
# rtc_enable_symbol_export=false will only export RTC_OBJC_EXPORT
# annotated symbols.
rtc_enable_objc_symbol_export = rtc_enable_symbol_export
# Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
# will tell the pre-processor to remove the default definition of symbols
# needed to use field_trial. In that case a new implementation needs to be
# provided.
if (build_with_chromium) {
# When WebRTC is built as part of Chromium it should exclude the default
# implementation of field_trial unless it is building for NACL or
# Chromecast.
rtc_exclude_field_trial_default = !is_nacl && !is_castos && !is_cast_android
} else {
rtc_exclude_field_trial_default = false
}
# Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which
# will tell the pre-processor to remove the default definition of symbols
# needed to use metrics. In that case a new implementation needs to be
# provided.
rtc_exclude_metrics_default = build_with_chromium
# Setting this to true will define WEBRTC_EXCLUDE_SYSTEM_TIME which
# will tell the pre-processor to remove the default definition of the
# SystemTimeNanos() which is defined in rtc_base/system_time.cc. In
# that case a new implementation needs to be provided.
rtc_exclude_system_time = build_with_chromium
# Setting this to false will require the API user to pass in their own
# SSLCertificateVerifier to verify the certificates presented from a
# TLS-TURN server. In return disabling this saves around 100kb in the binary.
rtc_builtin_ssl_root_certificates = true
# Include the iLBC audio codec?
rtc_include_ilbc = true
# Disable this to avoid building the Opus audio codec.
rtc_include_opus = true
# Enable this if the Opus version upon which WebRTC is built supports direct
# encoding of 120 ms packets.
rtc_opus_support_120ms_ptime = true
# Enable this to let the Opus audio codec change complexity on the fly.
rtc_opus_variable_complexity = false
# Used to specify an external Jsoncpp include path when not compiling the
# library that comes with WebRTC (i.e. rtc_build_json == 0).
rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
# Used to specify an external OpenSSL include path when not compiling the
# library that comes with WebRTC (i.e. rtc_build_ssl == 0).
rtc_ssl_root = ""
# Enable when an external authentication mechanism is used for performing
# packet authentication for RTP packets instead of libsrtp.
rtc_enable_external_auth = build_with_chromium
# Selects whether debug dumps for the audio processing module
# should be generated.
apm_debug_dump = false
# Selects whether the audio processing module should be excluded.
rtc_exclude_audio_processing_module = false
# Set this to true to enable BWE test logging.
rtc_enable_bwe_test_logging = false
# Set this to false to skip building examples.
rtc_build_examples = true
# Set this to false to skip building tools.
rtc_build_tools = true
# Set this to false to skip building code that requires X11.
rtc_use_x11 = ozone_platform_x11
# Set this to use PipeWire on the Wayland display server.
# By default it's only enabled on desktop Linux (excludes ChromeOS) and
# only when using the sysroot as PipeWire is not available in older and
# supported Ubuntu and Debian distributions.
rtc_use_pipewire = is_linux && use_sysroot
# Set this to link PipeWire and required libraries directly instead of using the dlopen.
rtc_link_pipewire = false
# Enable to use the Mozilla internal settings.
build_with_mozilla = false
# Experimental: enable use of Android AAudio which requires Android SDK 26 or above
# and NDK r16 or above.
rtc_enable_android_aaudio = false
# Set to "func", "block", "edge" for coverage generation.
# At unit test runtime set UBSAN_OPTIONS="coverage=1".
# It is recommend to set include_examples=0.
# Use llvm's sancov -html-report for human readable reports.
# See http://clang.llvm.org/docs/SanitizerCoverage.html .
rtc_sanitize_coverage = ""
# Selects fixed-point code where possible.
rtc_prefer_fixed_point = false
if (current_cpu == "arm" || current_cpu == "arm64") {
rtc_prefer_fixed_point = true
}
# Determines whether NEON code will be built.
rtc_build_with_neon =
(current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
# Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
# all platforms except Android and iOS. Because FFmpeg can be built
# with/without H.264 support, `ffmpeg_branding` has to separately be set to a
# value that includes H.264, for example "Chrome". If FFmpeg is built without
# H.264, compilation succeeds but `H264DecoderImpl` fails to initialize.
# CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
# http://www.openh264.org, https://www.ffmpeg.org/
#
# Enabling H264 when building with MSVC is currently not supported, see
# bugs.webrtc.org/9213#c13 for more info.
rtc_use_h264 =
proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
# Enable this flag to make webrtc::Mutex be implemented by absl::Mutex.
rtc_use_absl_mutex = false
# By default, use normal platform audio support or dummy audio, but don't
# use file-based audio playout and record.
rtc_use_dummy_audio_file_devices = false
# When set to true, replace the audio output with a sinus tone at 440Hz.
# The ADM will ask for audio data from WebRTC but instead of reading real
# audio samples from NetEQ, a sinus tone will be generated and replace the
# real audio samples.
rtc_audio_device_plays_sinus_tone = false
if (is_ios) {
# Build broadcast extension in AppRTCMobile for iOS. This results in the
# binary only running on iOS 11+, which is why it is disabled by default.
rtc_apprtcmobile_broadcast_extension = false
}
# Determines whether OpenGL is available on iOS.
rtc_ios_use_opengl_rendering = is_ios && target_environment != "catalyst"
# When set to false, builtin audio encoder/decoder factories and all the
# audio codecs they depend on will not be included in libwebrtc.{a|lib}
# (they will still be included in libjingle_peerconnection_so.so and
# WebRTC.framework)
rtc_include_builtin_audio_codecs = true
# When set to true and in a standalone build, it will undefine UNICODE and
# _UNICODE (which are always defined globally by the Chromium Windows
# toolchain).
# This is only needed for testing purposes, WebRTC wants to be sure it
# doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses
# wide character functions.
rtc_win_undef_unicode = false
# When set to true, a capturer implementation that uses the
# Windows.Graphics.Capture APIs will be available for use. This introduces a
# dependency on the Win 10 SDK v10.0.17763.0.
rtc_enable_win_wgc = is_win
# Includes the dav1d decoder in the internal decoder factory when set to true.
rtc_include_dav1d_in_internal_decoder_factory = true
# When enabled, a run-time check will make sure that all field trial keys have
# been registered in accordance with the field trial policy, see
# g3doc/field-trials.md. The value can be set to the following:
#
# "dcheck": RTC_DCHECKs that the field trial has been registered. RTC_DCHECK
# must be enabled separately.
#
# "warn": RTC_LOGs a message with LS_WARNING severity if the field trial
# hasn't been registered.
rtc_strict_field_trials = ""
# If different from "", symbols exported with RTC_OBJC_EXPORT will be prefixed
# with this string.
# See the definition of RTC_OBJC_TYPE_PREFIX in the code.
rtc_objc_prefix = ""
}
if (!build_with_mozilla) {
import("//testing/test.gni")
}
# A second declare_args block, so that declarations within it can
# depend on the possibly overridden variables in the first
# declare_args block.
declare_args() {
# Enables the use of protocol buffers for debug recordings.
rtc_enable_protobuf = !build_with_mozilla
# Set this to disable building with support for SCTP data channels.
rtc_enable_sctp = !build_with_mozilla
# Disable these to not build components which can be externally provided.
rtc_build_json = !build_with_mozilla
rtc_build_libsrtp = !build_with_mozilla
rtc_build_libvpx = !build_with_mozilla
rtc_libvpx_build_vp9 = !build_with_mozilla
rtc_build_opus = !build_with_mozilla
rtc_build_ssl = !build_with_mozilla
# Enable libevent task queues on platforms that support it.
if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
target_cpu == "wasm") {
rtc_enable_libevent = false
rtc_build_libevent = false
} else {
rtc_enable_libevent = true
rtc_build_libevent = !build_with_mozilla
}
# Excluded in Chromium since its prerequisites don't require Pulse Audio.
rtc_include_pulse_audio = !build_with_chromium
# Chromium uses its own IO handling, so the internal ADM is only built for
# standalone WebRTC.
rtc_include_internal_audio_device = !build_with_chromium
# Set this to true to enable the avx2 support in webrtc.
# TODO: Make sure that AVX2 works also for non-clang compilers.
if (is_clang == true) {
rtc_enable_avx2 = true
} else {
rtc_enable_avx2 = false
}
# Set this to true to build the unit tests.
# Disabled when building with Chromium or Mozilla.
rtc_include_tests = !build_with_chromium && !build_with_mozilla
# Set this to false to skip building code that also requires X11 extensions
# such as Xdamage, Xfixes.
rtc_use_x11_extensions = rtc_use_x11
# Set this to true to fully remove logging from WebRTC.
rtc_disable_logging = false
# Set this to true to disable trace events.
rtc_disable_trace_events = false
# Set this to true to disable detailed error message and logging for
# RTC_CHECKs.
rtc_disable_check_msg = false
# Set this to true to disable webrtc metrics.
rtc_disable_metrics = false
# Set this to true to exclude the transient suppressor in the audio processing
# module from the build.
rtc_exclude_transient_suppressor = false
}
declare_args() {
# Enable the dcsctp backend for DataChannels and related unittests
rtc_build_dcsctp = !build_with_mozilla && rtc_enable_sctp
# Enable gRPC used for negotiation in multiprocess tests
rtc_enable_grpc = rtc_enable_protobuf && (is_linux || is_mac)
}
# Make it possible to provide custom locations for some libraries (move these
# up into declare_args should we need to actually use them for the GN build).
rtc_libvpx_dir = "//third_party/libvpx"
rtc_opus_dir = "//third_party/opus"
# Desktop capturer is supported only on Windows, OSX and Linux.
rtc_desktop_capture_supported =
(is_win && current_os != "winuwp") || is_mac ||
((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))
###############################################################################
# Templates
#
# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
# chromium.
# We need absolute paths for all configs in templates as they are shared in
# different subdirectories.
webrtc_root = get_path_info(".", "abspath")
# Global configuration that should be applied to all WebRTC targets.
# You normally shouldn't need to include this in your target as it's
# automatically included when using the rtc_* templates.
# It sets defines, include paths and compilation warnings accordingly,
# both for WebRTC stand-alone builds and for the scenario when WebRTC
# native code is built as part of Chromium.
rtc_common_configs = [ webrtc_root + ":common_config" ]
if (is_mac || is_ios) {
rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
}
# Global public configuration that should be applied to all WebRTC targets. You
# normally shouldn't need to include this in your target as it's automatically
# included when using the rtc_* templates. It set the defines, include paths and
# compilation warnings that should be propagated to dependents of the targets
# depending on the target having this config.
rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
# Common configs to remove or add in all rtc targets.
rtc_remove_configs = []
if (!build_with_chromium && is_clang) {
rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
}
rtc_add_configs = rtc_common_configs
rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
set_defaults("rtc_test") {
configs = rtc_add_configs
suppressed_configs = []
}
set_defaults("rtc_library") {
configs = rtc_add_configs
suppressed_configs = []
absl_deps = []
}
set_defaults("rtc_source_set") {
configs = rtc_add_configs
suppressed_configs = []
absl_deps = []
}
set_defaults("rtc_static_library") {
configs = rtc_add_configs
suppressed_configs = []
absl_deps = []
}
set_defaults("rtc_executable") {
configs = rtc_add_configs
suppressed_configs = []
}
set_defaults("rtc_shared_library") {
configs = rtc_add_configs
suppressed_configs = []
}
webrtc_default_visibility = [ webrtc_root + "/*" ]
if (build_with_chromium) {
# Allow Chromium's WebRTC overrides targets to bypass the regular
# visibility restrictions.
webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
}
# ---- Poisons ----
#
# The general idea is that some targets declare that they contain some
# kind of poison, which makes it impossible for other targets to
# depend on them (even transitively) unless they declare themselves
# immune to that particular type of poison.
#
# Targets that *contain* poison of type foo should contain the line
#
# poisonous = [ "foo" ]
#
# and targets that *are immune but arent't themselves poisonous*
# should contain
#
# allow_poison = [ "foo" ]
#
# This useful in cases where we have some large target or set of
# targets and want to ensure that most other targets do not
# transitively depend on them. For example, almost no high-level
# target should depend on the audio codecs, since we want WebRTC users
# to be able to inject any subset of them and actually end up with a
# binary that doesn't include the codecs they didn't inject.
#
# Test-only targets (`testonly` set to true) and non-public targets
# (`visibility` not containing "*") are automatically immune to all
# types of poison.
#
# Here's the complete list of all types of poison. It must be kept in
# 1:1 correspondence with the set of //:poison_* targets.
#
all_poison_types = [
# Encoders and decoders for specific audio codecs such as Opus and iSAC.
"audio_codecs",
# Default task queue implementation.
"default_task_queue",
# Default echo detector implementation.
"default_echo_detector",
# JSON parsing should not be needed in the "slim and modular" WebRTC.
"rtc_json",
# Software video codecs (VP8 and VP9 through libvpx).
"software_video_codecs",
]
absl_include_config = "//third_party/abseil-cpp:absl_include_config"
absl_define_config = "//third_party/abseil-cpp:absl_define_config"
# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
# that are testonly.
absl_flags_config = webrtc_root + ":absl_flags_configs"
# WebRTC wrapper of Chromium's test() template. This template just adds some
# WebRTC only configuration in order to avoid to duplicate it for every WebRTC
# target.
# The parameter `is_xctest` is different from the one in the Chromium's test()
# template (and it is not forwarded to it). In rtc_test(), the argument
# `is_xctest` is used to avoid to take dependencies that are not needed
# in case the test is a real XCTest (using the XCTest framework).
template("rtc_test") {
test(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"is_xctest",
"public_configs",
"suppressed_configs",
"visibility",
])
# Always override to public because when target_os is Android the `test`
# template can override it to [ "*" ] and we want to avoid conditional
# visibility.
visibility = [ "*" ]
configs += invoker.configs
configs -= rtc_remove_configs
configs -= invoker.suppressed_configs
public_configs = [
rtc_common_inherited_config,
absl_include_config,
absl_define_config,
absl_flags_config,
]
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
if (!build_with_chromium && is_android) {
android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
use_raw_android_executable = false
min_sdk_version = 21
target_sdk_version = 23
deps += [
"//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
webrtc_root + "test:native_test_java",
]
}
# Build //test:google_test_runner_objc when the test is not a real XCTest.
if (is_ios && rtc_include_tests) {
if (!defined(invoker.is_xctest) || !invoker.is_xctest) {
xctest_module_target = "//test:google_test_runner_objc"
}
}
# If absl_deps is [], no action is needed. If not [], then it needs to be
# converted to //third_party/abseil-cpp:absl when build_with_chromium=true
# otherwise it just needs to be added to deps.
if (defined(absl_deps) && absl_deps != []) {
if (!defined(deps)) {
deps = []
}
if (build_with_chromium) {
deps += [ "//third_party/abseil-cpp:absl" ]
} else {
deps += absl_deps
}
}
# TODO(crbug.com/webrtc/13556): Adding the .app folder in the runtime_deps
# shoulnd't be necessary. this code should be removed and the same solution
# as Chromium should be used.
if (is_ios) {
if (!defined(invoker.data)) {
data = []
}
data += [ "${root_out_dir}/${target_name}.app" ]
}
}
}
template("rtc_source_set") {
source_set(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"public_configs",
"suppressed_configs",
"visibility",
])
forward_variables_from(invoker, [ "visibility" ])
if (!defined(visibility)) {
visibility = webrtc_default_visibility
}
# What's your poison?
if (defined(testonly) && testonly) {
assert(!defined(poisonous))
assert(!defined(allow_poison))
} else {
if (!defined(poisonous)) {
poisonous = []
}
if (!defined(allow_poison)) {
allow_poison = []
}
if (!defined(assert_no_deps)) {
assert_no_deps = []
}
if (!defined(deps)) {
deps = []
}
foreach(p, poisonous) {
deps += [ webrtc_root + ":poison_" + p ]
}
foreach(poison_type, all_poison_types) {
allow_dep = true
foreach(v, visibility) {
if (v == "*") {
allow_dep = false
}
}
foreach(p, allow_poison + poisonous) {
if (p == poison_type) {
allow_dep = true
}
}
if (!allow_dep) {
assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
}
}
}
# Chromium should only depend on the WebRTC component in order to
# avoid to statically link WebRTC in a component build.
if (build_with_chromium) {
publicly_visible = false
foreach(v, visibility) {
if (v == "*") {
publicly_visible = true
}
}
if (publicly_visible) {
visibility = []
visibility = webrtc_default_visibility
}
}
if (!defined(testonly) || !testonly) {
configs += rtc_prod_configs
}
configs += invoker.configs
configs += rtc_library_impl_config
configs -= rtc_remove_configs
configs -= invoker.suppressed_configs
public_configs = [
rtc_common_inherited_config,
absl_include_config,
absl_define_config,
]
if (defined(testonly) && testonly) {
public_configs += [ absl_flags_config ]
}
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
# If absl_deps is [], no action is needed. If not [], then it needs to be
# converted to //third_party/abseil-cpp:absl when build_with_chromium=true
# otherwise it just needs to be added to deps.
if (absl_deps != []) {
if (!defined(deps)) {
deps = []
}
if (build_with_chromium) {
deps += [ "//third_party/abseil-cpp:absl" ]
} else {
deps += absl_deps
}
}
}
}
template("rtc_static_library") {
static_library(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"public_configs",
"suppressed_configs",
"visibility",
])
forward_variables_from(invoker, [ "visibility" ])
if (!defined(visibility)) {
visibility = webrtc_default_visibility
}
# What's your poison?
if (defined(testonly) && testonly) {
assert(!defined(poisonous))
assert(!defined(allow_poison))
} else {
if (!defined(poisonous)) {
poisonous = []
}
if (!defined(allow_poison)) {
allow_poison = []
}
if (!defined(assert_no_deps)) {
assert_no_deps = []
}
if (!defined(deps)) {
deps = []
}
foreach(p, poisonous) {
deps += [ webrtc_root + ":poison_" + p ]
}
foreach(poison_type, all_poison_types) {
allow_dep = true
foreach(v, visibility) {
if (v == "*") {
allow_dep = false
}
}
foreach(p, allow_poison + poisonous) {
if (p == poison_type) {
allow_dep = true
}
}
if (!allow_dep) {
assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
}
}
}
if (!defined(testonly) || !testonly) {
configs += rtc_prod_configs
}
configs += invoker.configs
configs += rtc_library_impl_config
configs -= rtc_remove_configs
configs -= invoker.suppressed_configs
public_configs = [
rtc_common_inherited_config,
absl_include_config,
absl_define_config,
]
if (defined(testonly) && testonly) {
public_configs += [ absl_flags_config ]
}
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
# If absl_deps is [], no action is needed. If not [], then it needs to be
# converted to //third_party/abseil-cpp:absl when build_with_chromium=true
# otherwise it just needs to be added to deps.
if (absl_deps != []) {
if (!defined(deps)) {
deps = []
}
if (build_with_chromium) {
deps += [ "//third_party/abseil-cpp:absl" ]
} else {
deps += absl_deps
}
}
}
}
# This template automatically switches the target type between source_set
# and static_library.
#
# This should be the default target type for all the WebRTC targets.
#
# How does it work:
# Since all files in a source_set are linked into a final binary, while files
# in a static library are only linked in if at least one symbol in them is
# referenced, in component builds source_sets are easy to deal with because
# all their object files are passed to the linker to create a shared library.
# In release builds instead, static_libraries are preferred since they allow
# the linker to discard dead code.
# For the same reason, testonly targets will always be expanded to
# source_set in order to be sure that tests are present in the test binary.
template("rtc_library") {
header_only = true
if (defined(invoker.sources)) {
non_header_sources = filter_exclude(invoker.sources,
[
"*.h",
"*.hh",
"*.inc",
])
if (non_header_sources != []) {
header_only = false
}
}
# Header only libraries should use source_set as a static_library with no
# source files will cause issues with macOS libtool.
if (header_only || is_component_build ||
(defined(invoker.testonly) && invoker.testonly)) {
target_type = "source_set"
} else {
target_type = "static_library"
}
target(target_type, target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"public_configs",
"suppressed_configs",
"visibility",
])
forward_variables_from(invoker, [ "visibility" ])
if (!defined(visibility)) {
visibility = webrtc_default_visibility
}
# What's your poison?
if (defined(testonly) && testonly) {
assert(!defined(poisonous))
assert(!defined(allow_poison))
} else {
if (!defined(poisonous)) {
poisonous = []
}
if (!defined(allow_poison)) {
allow_poison = []
}
if (!defined(assert_no_deps)) {
assert_no_deps = []
}
if (!defined(deps)) {
deps = []
}
foreach(p, poisonous) {
deps += [ webrtc_root + ":poison_" + p ]
}
foreach(poison_type, all_poison_types) {
allow_dep = true
foreach(v, visibility) {
if (v == "*") {
allow_dep = false
}
}
foreach(p, allow_poison + poisonous) {
if (p == poison_type) {
allow_dep = true
}
}
if (!allow_dep) {
assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
}
}
}
# Chromium should only depend on the WebRTC component in order to
# avoid to statically link WebRTC in a component build.
if (build_with_chromium) {
publicly_visible = false
foreach(v, visibility) {
if (v == "*") {
publicly_visible = true
}
}
if (publicly_visible) {
visibility = []
visibility = webrtc_default_visibility
}
}
if (!defined(testonly) || !testonly) {
configs += rtc_prod_configs
}
configs += invoker.configs
configs += rtc_library_impl_config
configs -= rtc_remove_configs
configs -= invoker.suppressed_configs
public_configs = [
rtc_common_inherited_config,
absl_include_config,
absl_define_config,
]
if (defined(testonly) && testonly) {
public_configs += [ absl_flags_config ]
}
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
# If absl_deps is [], no action is needed. If not [], then it needs to be
# converted to //third_party/abseil-cpp:absl when build_with_chromium=true
# otherwise it just needs to be added to deps.
if (absl_deps != []) {
if (!defined(deps)) {
deps = []
}
if (build_with_chromium) {
deps += [ "//third_party/abseil-cpp:absl" ]
} else {
deps += absl_deps
}
}
}
}
template("rtc_executable") {
executable(target_name) {
forward_variables_from(invoker,
"*",
[
"deps",
"configs",
"public_configs",
"suppressed_configs",
"visibility",
])
forward_variables_from(invoker, [ "visibility" ])
if (!defined(visibility)) {
visibility = webrtc_default_visibility
}
configs += invoker.configs
configs -= rtc_remove_configs
configs -= invoker.suppressed_configs
deps = invoker.deps
public_configs = [
rtc_common_inherited_config,
absl_include_config,
absl_define_config,
]
if (defined(testonly) && testonly) {
public_configs += [ absl_flags_config ]
}
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
if (is_win) {
deps += [
# Give executables the default manifest on Windows (a no-op elsewhere).
"//build/win:default_exe_manifest",
]
}
}
}
template("rtc_shared_library") {
shared_library(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"public_configs",
"suppressed_configs",
"visibility",
])
forward_variables_from(invoker, [ "visibility" ])
if (!defined(visibility)) {
visibility = webrtc_default_visibility
}
# What's your poison?
if (defined(testonly) && testonly) {
assert(!defined(poisonous))
assert(!defined(allow_poison))
} else {
if (!defined(poisonous)) {
poisonous = []
}
if (!defined(allow_poison)) {
allow_poison = []
}
if (!defined(assert_no_deps)) {
assert_no_deps = []
}
if (!defined(deps)) {
deps = []
}
foreach(p, poisonous) {
deps += [ webrtc_root + ":poison_" + p ]
}
foreach(poison_type, all_poison_types) {
allow_dep = true
foreach(v, visibility) {
if (v == "*") {
allow_dep = false
}
}
foreach(p, allow_poison + poisonous) {
if (p == poison_type) {
allow_dep = true
}
}
if (!allow_dep) {
assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
}
}
}
configs += invoker.configs
configs -= rtc_remove_configs
configs -= invoker.suppressed_configs
public_configs = [
rtc_common_inherited_config,
absl_include_config,
absl_define_config,
]
if (defined(testonly) && testonly) {
public_configs += [ absl_flags_config ]
}
if (defined(invoker.public_configs)) {
public_configs += invoker.public_configs
}
}
}
if (is_mac || is_ios) {
template("apple_framework_bundle_with_umbrella_header") {
forward_variables_from(invoker, [ "output_name" ])
this_target_name = target_name
umbrella_header_path =
"$target_gen_dir/$output_name.framework/WebRTC/$output_name.h"
modulemap_path = "$target_gen_dir/Modules/module.modulemap"