blob: 6e81fc4285b1c839875f0555f1cb56119cff3778 [file] [log] [blame]
mbonadei9aa3f0a2017-01-24 14:58:221# 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 14:58:228import("//build/config/arm.gni")
9import("//build/config/features.gni")
10import("//build/config/mips.gni")
Maksim Sisovef4d0b62021-09-20 06:02:0111import("//build/config/ozone.gni")
mbonadei9aa3f0a2017-01-24 14:58:2212import("//build/config/sanitizers/sanitizers.gni")
Tomas Popela318da512018-11-13 05:32:2313import("//build/config/sysroot.gni")
mbonadei9aa3f0a2017-01-24 14:58:2214import("//build_overrides/build.gni")
mbonadei96606272017-03-04 03:41:5915
16if (!build_with_chromium && is_component_build) {
17 print("The Gn argument `is_component_build` is currently " +
18 "ignored for WebRTC builds.")
19 print("Component builds are supported by Chromium and the argument " +
20 "`is_component_build` makes it possible to create shared libraries " +
21 "instead of static libraries.")
22 print("If an app depends on WebRTC it makes sense to just depend on the " +
23 "WebRTC static library, so there is no difference between " +
24 "`is_component_build=true` and `is_component_build=false`.")
25 print(
Fanny Linderborg0d2dc1f2021-07-14 14:02:1126 "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md")
mbonadei96606272017-03-04 03:41:5927 assert(!is_component_build, "Component builds are not supported in WebRTC.")
28}
29
kthelgason4065a5762017-02-14 12:58:5630if (is_ios) {
31 import("//build/config/ios/rules.gni")
32}
mbonadei9aa3f0a2017-01-24 14:58:2233
Anders Carlsson37bbf792018-09-05 14:29:2734if (is_mac) {
35 import("//build/config/mac/rules.gni")
36}
37
Mirko Bonadei5f078452021-07-30 20:32:5538# This declare_args is separated from the next one because args declared
39# in this one, can be read from the next one (args defined in the same
40# declare_args cannot be referenced in that scope).
mbonadei9aa3f0a2017-01-24 14:58:2241declare_args() {
Mirko Bonadei028248c2018-10-10 10:19:0242 # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
43 # expand to code that will manage symbols visibility.
44 rtc_enable_symbol_export = false
Mirko Bonadei5f078452021-07-30 20:32:5545}
46
47declare_args() {
Mirko Bonadei339965f2021-10-12 11:23:4448 # Setting this to true, will make RTC_DLOG() expand to log statements instead
Mirko Bonadei56ed4682021-10-12 06:55:4249 # of being removed by the preprocessor.
50 # This is useful for example to be able to get RTC_DLOGs on a release build.
51 rtc_dlog_always_on = false
52
Mirko Bonadei5f078452021-07-30 20:32:5553 # Setting this to true will make RTC_OBJC_EXPORT expand to code that will
54 # manage symbols visibility. By default, Obj-C/Obj-C++ symbols are exported
55 # if C++ symbols are but setting this arg to true while keeping
56 # rtc_enable_symbol_export=false will only export RTC_OBJC_EXPORT
57 # annotated symbols.
58 rtc_enable_objc_symbol_export = rtc_enable_symbol_export
Mirko Bonadei028248c2018-10-10 10:19:0259
Mirko Bonadei31b0b452018-08-22 08:37:1160 # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
Mirko Bonadei70400902018-08-21 13:44:2861 # will tell the pre-processor to remove the default definition of symbols
62 # needed to use field_trial. In that case a new implementation needs to be
63 # provided.
Mirko Bonadei31b0b452018-08-22 08:37:1164 if (build_with_chromium) {
65 # When WebRTC is built as part of Chromium it should exclude the default
66 # implementation of field_trial unless it is building for NACL or
67 # Chromecast.
68 rtc_exclude_field_trial_default = !is_nacl && !is_chromecast
69 } else {
70 rtc_exclude_field_trial_default = false
71 }
Mirko Bonadei70400902018-08-21 13:44:2872
Mirko Bonadei906add42018-09-05 14:03:1673 # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which
74 # will tell the pre-processor to remove the default definition of symbols
75 # needed to use metrics. In that case a new implementation needs to be
76 # provided.
77 rtc_exclude_metrics_default = build_with_chromium
78
Johannes Kronda20c732021-02-19 15:39:4179 # Setting this to true will define WEBRTC_EXCLUDE_SYSTEM_TIME which
80 # will tell the pre-processor to remove the default definition of the
81 # SystemTimeNanos() which is defined in rtc_base/system_time.cc. In
82 # that case a new implementation needs to be provided.
Johannes Kronbb52bdf2021-02-25 09:10:0883 rtc_exclude_system_time = build_with_chromium
Johannes Kronda20c732021-02-19 15:39:4184
Benjamin Wrightd6f86e82018-05-08 20:12:2585 # Setting this to false will require the API user to pass in their own
86 # SSLCertificateVerifier to verify the certificates presented from a
87 # TLS-TURN server. In return disabling this saves around 100kb in the binary.
88 rtc_builtin_ssl_root_certificates = true
89
Karl Wibergeb254b42017-11-01 14:08:1290 # Include the iLBC audio codec?
Olga Sharonova5fbd7582020-07-09 09:50:4291 rtc_include_ilbc = true
Karl Wibergeb254b42017-11-01 14:08:1292
mbonadei9aa3f0a2017-01-24 14:58:2293 # Disable this to avoid building the Opus audio codec.
94 rtc_include_opus = true
95
minyue2e03c662017-02-02 01:31:1196 # Enable this if the Opus version upon which WebRTC is built supports direct
97 # encoding of 120 ms packets.
minyue-webrtc516711c2017-07-27 15:45:4998 rtc_opus_support_120ms_ptime = true
minyue2e03c662017-02-02 01:31:1199
mbonadei9aa3f0a2017-01-24 14:58:22100 # Enable this to let the Opus audio codec change complexity on the fly.
101 rtc_opus_variable_complexity = false
102
mbonadei9aa3f0a2017-01-24 14:58:22103 # Used to specify an external Jsoncpp include path when not compiling the
104 # library that comes with WebRTC (i.e. rtc_build_json == 0).
105 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
106
107 # Used to specify an external OpenSSL include path when not compiling the
108 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
109 rtc_ssl_root = ""
110
mbonadei9aa3f0a2017-01-24 14:58:22111 # Enable when an external authentication mechanism is used for performing
112 # packet authentication for RTP packets instead of libsrtp.
113 rtc_enable_external_auth = build_with_chromium
114
115 # Selects whether debug dumps for the audio processing module
116 # should be generated.
117 apm_debug_dump = false
118
Per Åhgrencc73ed32020-04-26 21:56:17119 # Selects whether the audio processing module should be excluded.
120 rtc_exclude_audio_processing_module = false
121
mbonadei9aa3f0a2017-01-24 14:58:22122 # Set this to true to enable BWE test logging.
123 rtc_enable_bwe_test_logging = false
124
Joachim Bauch93e91342017-12-07 00:25:53125 # Set this to false to skip building examples.
126 rtc_build_examples = true
127
128 # Set this to false to skip building tools.
129 rtc_build_tools = true
130
Joachim Bauch75f18fc2017-12-20 20:25:47131 # Set this to false to skip building code that requires X11.
Maksim Sisovef4d0b62021-09-20 06:02:01132 rtc_use_x11 = ozone_platform_x11
Joachim Bauch75f18fc2017-12-20 20:25:47133
Tomas Popela318da512018-11-13 05:32:23134 # Set this to use PipeWire on the Wayland display server.
Tomas Popela762543f2018-12-12 13:37:51135 # By default it's only enabled on desktop Linux (excludes ChromeOS) and
136 # only when using the sysroot as PipeWire is not available in older and
137 # supported Ubuntu and Debian distributions.
Artem Titov4d6a76d2021-09-03 10:07:20138 rtc_use_pipewire = is_linux && use_sysroot
Tomas Popela762543f2018-12-12 13:37:51139
Jan Gruliche1e05af2021-09-21 18:36:16140 # Set this to link PipeWire and required libraries directly instead of using the dlopen.
Tomas Popela762543f2018-12-12 13:37:51141 rtc_link_pipewire = false
Tomas Popela318da512018-11-13 05:32:23142
mbonadei9aa3f0a2017-01-24 14:58:22143 # Enable to use the Mozilla internal settings.
144 build_with_mozilla = false
145
Philipp Hanckee95ebda2020-09-17 14:13:20146 # Experimental: enable use of Android AAudio which requires Android SDK 26 or above
147 # and NDK r16 or above.
henrika883d00f2018-03-16 09:09:49148 rtc_enable_android_aaudio = false
149
mbonadei9aa3f0a2017-01-24 14:58:22150 # Set to "func", "block", "edge" for coverage generation.
151 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
152 # It is recommend to set include_examples=0.
153 # Use llvm's sancov -html-report for human readable reports.
154 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
155 rtc_sanitize_coverage = ""
156
Philipp Hanckeaeac9f82020-09-11 09:58:18157 # Selects fixed-point code where possible.
158 rtc_prefer_fixed_point = false
mbonadei9aa3f0a2017-01-24 14:58:22159 if (current_cpu == "arm" || current_cpu == "arm64") {
160 rtc_prefer_fixed_point = true
161 }
162
mbonadei9aa3f0a2017-01-24 14:58:22163 # Determines whether NEON code will be built.
164 rtc_build_with_neon =
165 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
166
167 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
168 # all platforms except Android and iOS. Because FFmpeg can be built
Artem Titov22a6b2d2021-07-27 14:25:56169 # with/without H.264 support, `ffmpeg_branding` has to separately be set to a
mbonadei9aa3f0a2017-01-24 14:58:22170 # value that includes H.264, for example "Chrome". If FFmpeg is built without
Artem Titov22a6b2d2021-07-27 14:25:56171 # H.264, compilation succeeds but `H264DecoderImpl` fails to initialize.
mbonadei9aa3f0a2017-01-24 14:58:22172 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
173 # http://www.openh264.org, https://www.ffmpeg.org/
Mirko Bonadeiee0a85c2019-01-15 09:47:18174 #
175 # Enabling H264 when building with MSVC is currently not supported, see
176 # bugs.webrtc.org/9213#c13 for more info.
177 rtc_use_h264 =
178 proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
mbonadei9aa3f0a2017-01-24 14:58:22179
Markus Handell8e75bd42020-06-05 09:47:40180 # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex.
181 rtc_use_absl_mutex = false
182
mbonadei9aa3f0a2017-01-24 14:58:22183 # By default, use normal platform audio support or dummy audio, but don't
184 # use file-based audio playout and record.
185 rtc_use_dummy_audio_file_devices = false
186
henrika7be78832017-06-13 15:34:16187 # When set to true, replace the audio output with a sinus tone at 440Hz.
188 # The ADM will ask for audio data from WebRTC but instead of reading real
189 # audio samples from NetEQ, a sinus tone will be generated and replace the
190 # real audio samples.
191 rtc_audio_device_plays_sinus_tone = false
192
Anders Carlsson358f2e02018-06-04 08:24:37193 if (is_ios) {
194 # Build broadcast extension in AppRTCMobile for iOS. This results in the
195 # binary only running on iOS 11+, which is why it is disabled by default.
196 rtc_apprtcmobile_broadcast_extension = false
197 }
Anders Carlsson7bca8ca2018-08-30 07:30:29198
Jordan Rose53d3fc92021-07-06 19:16:41199 # Determines whether OpenGL is available on iOS/macOS.
200 rtc_ios_macos_use_opengl_rendering =
201 !(is_ios && target_environment == "catalyst")
202
Jiawei Ou08745302019-02-12 19:36:13203 # When set to false, builtin audio encoder/decoder factories and all the
204 # audio codecs they depend on will not be included in libwebrtc.{a|lib}
205 # (they will still be included in libjingle_peerconnection_so.so and
206 # WebRTC.framework)
207 rtc_include_builtin_audio_codecs = true
208
209 # When set to false, builtin video encoder/decoder factories and all the
210 # video codecs they depends on will not be included in libwebrtc.{a|lib}
211 # (they will still be included in libjingle_peerconnection_so.so and
212 # WebRTC.framework)
213 rtc_include_builtin_video_codecs = true
Mirko Bonadei20574f42019-03-28 06:50:07214
215 # When set to true and in a standalone build, it will undefine UNICODE and
216 # _UNICODE (which are always defined globally by the Chromium Windows
217 # toolchain).
218 # This is only needed for testing purposes, WebRTC wants to be sure it
219 # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses
220 # wide character functions.
221 rtc_win_undef_unicode = false
Austin Orion25b0dee2020-10-01 20:47:54222
223 # When set to true, a capturer implementation that uses the
Austin Orion66241e42021-04-22 20:22:25224 # Windows.Graphics.Capture APIs will be available for use. This introduces a
225 # dependency on the Win 10 SDK v10.0.17763.0.
Austin Orion78f04d82021-04-23 19:37:26226 rtc_enable_win_wgc = is_win
philipelb09d8722021-11-23 10:00:24227
228 # Includes the dav1d decoder in the internal decoder factory when set to true.
229 rtc_include_dav1d_in_internal_decoder_factory = true
Dan Minor9c686132018-01-15 15:20:00230}
mbonadei9aa3f0a2017-01-24 14:58:22231
Dan Minor9c686132018-01-15 15:20:00232if (!build_with_mozilla) {
233 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 14:58:22234}
235
236# A second declare_args block, so that declarations within it can
237# depend on the possibly overridden variables in the first
238# declare_args block.
239declare_args() {
Dan Minor9c686132018-01-15 15:20:00240 # Enables the use of protocol buffers for debug recordings.
241 rtc_enable_protobuf = !build_with_mozilla
242
243 # Set this to disable building with support for SCTP data channels.
244 rtc_enable_sctp = !build_with_mozilla
245
246 # Disable these to not build components which can be externally provided.
247 rtc_build_json = !build_with_mozilla
248 rtc_build_libsrtp = !build_with_mozilla
249 rtc_build_libvpx = !build_with_mozilla
250 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 15:20:00251 rtc_build_opus = !build_with_mozilla
252 rtc_build_ssl = !build_with_mozilla
Dan Minor9c686132018-01-15 15:20:00253
254 # Enable libevent task queues on platforms that support it.
Mirko Bonadei775c02e2019-06-19 17:05:00255 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
256 target_cpu == "wasm") {
Dan Minor9c686132018-01-15 15:20:00257 rtc_enable_libevent = false
258 rtc_build_libevent = false
259 } else {
260 rtc_enable_libevent = true
261 rtc_build_libevent = !build_with_mozilla
262 }
263
mbonadei9aa3f0a2017-01-24 14:58:22264 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
265 rtc_include_pulse_audio = !build_with_chromium
266
267 # Chromium uses its own IO handling, so the internal ADM is only built for
268 # standalone WebRTC.
269 rtc_include_internal_audio_device = !build_with_chromium
270
Zhaoliang Ma72e43212020-08-17 09:13:41271 # Set this to true to enable the avx2 support in webrtc.
Per Åhgrena43178c2020-09-25 10:02:32272 # TODO: Make sure that AVX2 works also for non-clang compilers.
273 if (is_clang == true) {
274 rtc_enable_avx2 = true
275 } else {
276 rtc_enable_avx2 = false
277 }
Zhaoliang Ma72e43212020-08-17 09:13:41278
Philipp Hancke1a89bc82021-03-02 20:23:24279 # Set this to true to build the unit tests.
280 # Disabled when building with Chromium or Mozilla.
Dan Minor9c686132018-01-15 15:20:00281 rtc_include_tests = !build_with_chromium && !build_with_mozilla
Oleh Prypin240b8932019-06-07 11:27:07282
283 # Set this to false to skip building code that also requires X11 extensions
284 # such as Xdamage, Xfixes.
285 rtc_use_x11_extensions = rtc_use_x11
Artem Titov6a4a1462019-11-26 15:24:46286
287 # Set this to true to fully remove logging from WebRTC.
288 rtc_disable_logging = false
Doudou Kisabaka2dec4962019-11-28 13:24:31289
290 # Set this to true to disable trace events.
291 rtc_disable_trace_events = false
Artem Titov9dc209a2019-11-28 16:09:30292
293 # Set this to true to disable detailed error message and logging for
294 # RTC_CHECKs.
295 rtc_disable_check_msg = false
Ying Wangef3998f2019-12-09 12:06:53296
297 # Set this to true to disable webrtc metrics.
Mirko Bonadei3c4fda22019-12-10 14:02:53298 rtc_disable_metrics = false
sazaaa42ecd2020-04-01 13:24:40299
300 # Set this to true to exclude the transient suppressor in the audio processing
301 # module from the build.
302 rtc_exclude_transient_suppressor = false
mbonadei9aa3f0a2017-01-24 14:58:22303}
304
Florent Castellia80c3e52021-04-15 13:02:56305declare_args() {
Florent Castellia6983c62021-05-06 08:50:07306 # Enable the dcsctp backend for DataChannels and related unittests
307 rtc_build_dcsctp = !build_with_mozilla && rtc_enable_sctp
308
Florent Castellia80c3e52021-04-15 13:02:56309 # Enable the usrsctp backend for DataChannels and related unittests
310 rtc_build_usrsctp = !build_with_mozilla && rtc_enable_sctp
311}
312
mbonadei9aa3f0a2017-01-24 14:58:22313# Make it possible to provide custom locations for some libraries (move these
314# up into declare_args should we need to actually use them for the GN build).
315rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 14:58:22316rtc_opus_dir = "//third_party/opus"
317
318# Desktop capturer is supported only on Windows, OSX and Linux.
Oleh Prypin240b8932019-06-07 11:27:07319rtc_desktop_capture_supported =
320 (is_win && current_os != "winuwp") || is_mac ||
Hidehiko Abef264e702020-09-10 09:10:11321 ((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))
mbonadei9aa3f0a2017-01-24 14:58:22322
323###############################################################################
324# Templates
325#
326
Mirko Bonadei92ea95e2017-09-15 04:47:31327# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 14:58:22328# chromium.
329# We need absolute paths for all configs in templates as they are shared in
330# different subdirectories.
331webrtc_root = get_path_info(".", "abspath")
332
333# Global configuration that should be applied to all WebRTC targets.
334# You normally shouldn't need to include this in your target as it's
335# automatically included when using the rtc_* templates.
336# It sets defines, include paths and compilation warnings accordingly,
337# both for WebRTC stand-alone builds and for the scenario when WebRTC
338# native code is built as part of Chromium.
Mirko Bonadei5f078452021-07-30 20:32:55339rtc_common_configs = [ webrtc_root + ":common_config" ]
mbonadei9aa3f0a2017-01-24 14:58:22340
kthelgasonc0977102017-04-24 07:57:16341if (is_mac || is_ios) {
342 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
343}
344
mbonadei9aa3f0a2017-01-24 14:58:22345# Global public configuration that should be applied to all WebRTC targets. You
346# normally shouldn't need to include this in your target as it's automatically
347# included when using the rtc_* templates. It set the defines, include paths and
348# compilation warnings that should be propagated to dependents of the targets
349# depending on the target having this config.
350rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
351
352# Common configs to remove or add in all rtc targets.
353rtc_remove_configs = []
Mirko Bonadeifc52b912019-03-01 09:32:56354if (!build_with_chromium && is_clang) {
355 rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
356}
mbonadei9aa3f0a2017-01-24 14:58:22357rtc_add_configs = rtc_common_configs
Mirko Bonadei96ede16a2018-09-06 11:45:44358rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
Mirko Bonadei32ce18c2018-09-18 11:15:54359rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
mbonadei9aa3f0a2017-01-24 14:58:22360
361set_defaults("rtc_test") {
362 configs = rtc_add_configs
363 suppressed_configs = []
364}
365
Mirko Bonadei86d053c2019-10-17 19:32:04366set_defaults("rtc_library") {
367 configs = rtc_add_configs
368 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 19:23:41369 absl_deps = []
Mirko Bonadei86d053c2019-10-17 19:32:04370}
371
mbonadei9aa3f0a2017-01-24 14:58:22372set_defaults("rtc_source_set") {
373 configs = rtc_add_configs
374 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 19:23:41375 absl_deps = []
mbonadei9aa3f0a2017-01-24 14:58:22376}
377
Mirko Bonadei86d053c2019-10-17 19:32:04378set_defaults("rtc_static_library") {
mbonadei9aa3f0a2017-01-24 14:58:22379 configs = rtc_add_configs
380 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 19:23:41381 absl_deps = []
mbonadei9aa3f0a2017-01-24 14:58:22382}
383
Mirko Bonadei86d053c2019-10-17 19:32:04384set_defaults("rtc_executable") {
mbonadei9aa3f0a2017-01-24 14:58:22385 configs = rtc_add_configs
386 suppressed_configs = []
387}
388
389set_defaults("rtc_shared_library") {
390 configs = rtc_add_configs
391 suppressed_configs = []
392}
393
Per Kjellandera7f2d842018-01-10 15:54:53394webrtc_default_visibility = [ webrtc_root + "/*" ]
395if (build_with_chromium) {
396 # Allow Chromium's WebRTC overrides targets to bypass the regular
397 # visibility restrictions.
398 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
399}
400
Karl Wibergbb23c832018-04-22 17:55:00401# ---- Poisons ----
402#
403# The general idea is that some targets declare that they contain some
404# kind of poison, which makes it impossible for other targets to
405# depend on them (even transitively) unless they declare themselves
406# immune to that particular type of poison.
407#
408# Targets that *contain* poison of type foo should contain the line
409#
410# poisonous = [ "foo" ]
411#
412# and targets that *are immune but arent't themselves poisonous*
413# should contain
414#
415# allow_poison = [ "foo" ]
416#
417# This useful in cases where we have some large target or set of
418# targets and want to ensure that most other targets do not
419# transitively depend on them. For example, almost no high-level
420# target should depend on the audio codecs, since we want WebRTC users
421# to be able to inject any subset of them and actually end up with a
422# binary that doesn't include the codecs they didn't inject.
423#
424# Test-only targets (`testonly` set to true) and non-public targets
425# (`visibility` not containing "*") are automatically immune to all
426# types of poison.
427#
428# Here's the complete list of all types of poison. It must be kept in
429# 1:1 correspondence with the set of //:poison_* targets.
430#
431all_poison_types = [
432 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
433 "audio_codecs",
Anders Carlsson1f433e42018-04-24 14:39:05434
Danil Chapovalov41300af2019-07-10 10:44:43435 # Default task queue implementation.
436 "default_task_queue",
Sam Zackrisson492fdf42019-10-25 08:45:58437
Sam Zackrisson03cb7e52021-12-06 14:40:04438 # Default echo detector implementation.
439 "default_echo_detector",
440
Sam Zackrisson492fdf42019-10-25 08:45:58441 # JSON parsing should not be needed in the "slim and modular" WebRTC.
442 "rtc_json",
443
444 # Software video codecs (VP8 and VP9 through libvpx).
445 "software_video_codecs",
Karl Wibergbb23c832018-04-22 17:55:00446]
447
Mirko Bonadei9a89a492018-05-29 14:22:32448absl_include_config = "//third_party/abseil-cpp:absl_include_config"
449absl_define_config = "//third_party/abseil-cpp:absl_define_config"
450
Mirko Bonadei2ab97f62019-07-18 11:44:12451# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
452# that are testonly.
453absl_flags_config = webrtc_root + ":absl_flags_configs"
454
Mirko Bonadeie99b6cc2020-11-25 15:41:37455# WebRTC wrapper of Chromium's test() template. This template just adds some
456# WebRTC only configuration in order to avoid to duplicate it for every WebRTC
457# target.
458# The parameter `is_xctest` is different from the one in the Chromium's test()
459# template (and it is not forwarded to it). In rtc_test(), the argument
460# `is_xctest` is used to avoid to take dependencies that are not needed
461# in case the test is a real XCTest (using the XCTest framework).
mbonadei9aa3f0a2017-01-24 14:58:22462template("rtc_test") {
463 test(target_name) {
464 forward_variables_from(invoker,
465 "*",
466 [
467 "configs",
Mirko Bonadeie99b6cc2020-11-25 15:41:37468 "is_xctest",
mbonadei9aa3f0a2017-01-24 14:58:22469 "public_configs",
470 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19471 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22472 ])
Mirko Bonadeidd411942017-11-21 14:35:27473
474 # Always override to public because when target_os is Android the `test`
475 # template can override it to [ "*" ] and we want to avoid conditional
476 # visibility.
Mirko Bonadei21558812017-11-21 11:47:34477 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 14:58:22478 configs += invoker.configs
479 configs -= rtc_remove_configs
480 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32481 public_configs = [
482 rtc_common_inherited_config,
483 absl_include_config,
484 absl_define_config,
Mirko Bonadei2ab97f62019-07-18 11:44:12485 absl_flags_config,
Mirko Bonadei9a89a492018-05-29 14:22:32486 ]
mbonadei9aa3f0a2017-01-24 14:58:22487 if (defined(invoker.public_configs)) {
488 public_configs += invoker.public_configs
489 }
sakald7fdb802017-05-26 08:51:53490 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 13:48:37491 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
Peter Kotwicz3ceb16e2021-04-14 22:53:11492 use_raw_android_executable = false
Jeremy Leconteb19cfee2020-06-25 20:57:49493 min_sdk_version = 21
Mirko Bonadeibd393b22020-07-10 21:00:41494 target_sdk_version = 23
Mirko Bonadei80939352021-04-12 17:03:37495 deps += [
496 "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
497 webrtc_root + "test:native_test_java",
498 ]
sakald7fdb802017-05-26 08:51:53499 }
Mirko Bonadeie99b6cc2020-11-25 15:41:37500
501 # When not targeting a simulator, building //base/test:google_test_runner
502 # fails, so it is added only when the test is not a real XCTest and when
503 # targeting a simulator.
Mirko Bonadei58678a02020-12-01 09:54:40504 if (is_ios && target_cpu == "x64" && rtc_include_tests) {
Mirko Bonadeie99b6cc2020-11-25 15:41:37505 if (!defined(invoker.is_xctest) || !invoker.is_xctest) {
506 xctest_module_target = "//base/test:google_test_runner"
507 }
508 }
Andrey Logvin78646002021-01-29 10:50:19509
510 # If absl_deps is [], no action is needed. If not [], then it needs to be
511 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
512 # otherwise it just needs to be added to deps.
513 if (defined(absl_deps) && absl_deps != []) {
514 if (!defined(deps)) {
515 deps = []
516 }
517 if (build_with_chromium) {
518 deps += [ "//third_party/abseil-cpp:absl" ]
519 } else {
520 deps += absl_deps
521 }
522 }
523
Mirko Bonadei1d77c3e2021-01-26 16:10:04524 if (using_sanitizer) {
525 if (is_linux) {
526 if (!defined(invoker.data)) {
527 data = []
528 }
529 data +=
530 [ "//third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6" ]
531 }
532 }
mbonadei9aa3f0a2017-01-24 14:58:22533 }
534}
535
536template("rtc_source_set") {
537 source_set(target_name) {
538 forward_variables_from(invoker,
539 "*",
540 [
541 "configs",
542 "public_configs",
543 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19544 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22545 ])
Karl Wiberg138d4ac2017-10-16 09:16:19546 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53547 if (!defined(visibility)) {
548 visibility = webrtc_default_visibility
549 }
Karl Wibergbb23c832018-04-22 17:55:00550
551 # What's your poison?
552 if (defined(testonly) && testonly) {
553 assert(!defined(poisonous))
554 assert(!defined(allow_poison))
555 } else {
556 if (!defined(poisonous)) {
557 poisonous = []
558 }
559 if (!defined(allow_poison)) {
560 allow_poison = []
561 }
562 if (!defined(assert_no_deps)) {
563 assert_no_deps = []
564 }
565 if (!defined(deps)) {
566 deps = []
567 }
568 foreach(p, poisonous) {
569 deps += [ webrtc_root + ":poison_" + p ]
570 }
571 foreach(poison_type, all_poison_types) {
572 allow_dep = true
573 foreach(v, visibility) {
574 if (v == "*") {
575 allow_dep = false
576 }
577 }
578 foreach(p, allow_poison + poisonous) {
579 if (p == poison_type) {
580 allow_dep = true
581 }
582 }
583 if (!allow_dep) {
584 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
585 }
586 }
587 }
588
Mirko Bonadei92dd35d2019-11-15 15:08:41589 # Chromium should only depend on the WebRTC component in order to
590 # avoid to statically link WebRTC in a component build.
591 if (build_with_chromium) {
592 publicly_visible = false
593 foreach(v, visibility) {
594 if (v == "*") {
595 publicly_visible = true
596 }
597 }
598 if (publicly_visible) {
599 visibility = []
600 visibility = webrtc_default_visibility
601 }
602 }
603
Mirko Bonadei96ede16a2018-09-06 11:45:44604 if (!defined(testonly) || !testonly) {
605 configs += rtc_prod_configs
606 }
607
mbonadei9aa3f0a2017-01-24 14:58:22608 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 11:15:54609 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 14:58:22610 configs -= rtc_remove_configs
611 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32612 public_configs = [
613 rtc_common_inherited_config,
614 absl_include_config,
615 absl_define_config,
616 ]
Mirko Bonadei2ab97f62019-07-18 11:44:12617 if (defined(testonly) && testonly) {
618 public_configs += [ absl_flags_config ]
619 }
mbonadei9aa3f0a2017-01-24 14:58:22620 if (defined(invoker.public_configs)) {
621 public_configs += invoker.public_configs
622 }
Mirko Bonadei8b7cfa12020-06-03 19:23:41623
Mirko Bonadei96115cf2020-06-23 21:39:56624 # If absl_deps is [], no action is needed. If not [], then it needs to be
625 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 19:23:41626 # otherwise it just needs to be added to deps.
627 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 12:30:41628 if (!defined(deps)) {
629 deps = []
630 }
Mirko Bonadei08ce9862020-06-11 09:25:32631 if (build_with_chromium) {
632 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 19:23:41633 } else {
634 deps += absl_deps
635 }
636 }
mbonadei9aa3f0a2017-01-24 14:58:22637 }
638}
639
mbonadei9aa3f0a2017-01-24 14:58:22640template("rtc_static_library") {
641 static_library(target_name) {
642 forward_variables_from(invoker,
643 "*",
644 [
645 "configs",
646 "public_configs",
647 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19648 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22649 ])
Karl Wiberg138d4ac2017-10-16 09:16:19650 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53651 if (!defined(visibility)) {
652 visibility = webrtc_default_visibility
653 }
Karl Wibergbb23c832018-04-22 17:55:00654
655 # What's your poison?
656 if (defined(testonly) && testonly) {
657 assert(!defined(poisonous))
658 assert(!defined(allow_poison))
659 } else {
660 if (!defined(poisonous)) {
661 poisonous = []
662 }
663 if (!defined(allow_poison)) {
664 allow_poison = []
665 }
666 if (!defined(assert_no_deps)) {
667 assert_no_deps = []
668 }
669 if (!defined(deps)) {
670 deps = []
671 }
672 foreach(p, poisonous) {
673 deps += [ webrtc_root + ":poison_" + p ]
674 }
675 foreach(poison_type, all_poison_types) {
676 allow_dep = true
677 foreach(v, visibility) {
678 if (v == "*") {
679 allow_dep = false
680 }
681 }
682 foreach(p, allow_poison + poisonous) {
683 if (p == poison_type) {
684 allow_dep = true
685 }
686 }
687 if (!allow_dep) {
688 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
689 }
690 }
691 }
692
Mirko Bonadei96ede16a2018-09-06 11:45:44693 if (!defined(testonly) || !testonly) {
694 configs += rtc_prod_configs
695 }
696
mbonadei9aa3f0a2017-01-24 14:58:22697 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 11:15:54698 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 14:58:22699 configs -= rtc_remove_configs
700 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32701 public_configs = [
702 rtc_common_inherited_config,
703 absl_include_config,
704 absl_define_config,
705 ]
Mirko Bonadei2ab97f62019-07-18 11:44:12706 if (defined(testonly) && testonly) {
707 public_configs += [ absl_flags_config ]
708 }
mbonadei9aa3f0a2017-01-24 14:58:22709 if (defined(invoker.public_configs)) {
710 public_configs += invoker.public_configs
711 }
Mirko Bonadei8b7cfa12020-06-03 19:23:41712
Mirko Bonadei96115cf2020-06-23 21:39:56713 # If absl_deps is [], no action is needed. If not [], then it needs to be
714 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 19:23:41715 # otherwise it just needs to be added to deps.
716 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 12:30:41717 if (!defined(deps)) {
718 deps = []
719 }
Mirko Bonadei08ce9862020-06-11 09:25:32720 if (build_with_chromium) {
721 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 19:23:41722 } else {
723 deps += absl_deps
724 }
725 }
mbonadei9aa3f0a2017-01-24 14:58:22726 }
727}
728
Mirko Bonadei86d053c2019-10-17 19:32:04729# This template automatically switches the target type between source_set
730# and static_library.
731#
732# This should be the default target type for all the WebRTC targets with
733# one exception. Do not use this template for header only targets, in that case
734# rtc_source_set must be used in order to avoid build errors (e.g. libtool
735# complains if the output .a file is empty).
736#
737# How does it work:
738# Since all files in a source_set are linked into a final binary, while files
739# in a static library are only linked in if at least one symbol in them is
740# referenced, in component builds source_sets are easy to deal with because
741# all their object files are passed to the linker to create a shared library.
742# In release builds instead, static_libraries are preferred since they allow
743# the linker to discard dead code.
744# For the same reason, testonly targets will always be expanded to
745# source_set in order to be sure that tests are present in the test binary.
746template("rtc_library") {
747 if (is_component_build || (defined(invoker.testonly) && invoker.testonly)) {
748 target_type = "source_set"
749 } else {
750 target_type = "static_library"
751 }
752 target(target_type, target_name) {
753 forward_variables_from(invoker,
754 "*",
755 [
756 "configs",
757 "public_configs",
758 "suppressed_configs",
759 "visibility",
760 ])
761 forward_variables_from(invoker, [ "visibility" ])
762 if (!defined(visibility)) {
763 visibility = webrtc_default_visibility
764 }
765
766 # What's your poison?
767 if (defined(testonly) && testonly) {
768 assert(!defined(poisonous))
769 assert(!defined(allow_poison))
770 } else {
771 if (!defined(poisonous)) {
772 poisonous = []
773 }
774 if (!defined(allow_poison)) {
775 allow_poison = []
776 }
777 if (!defined(assert_no_deps)) {
778 assert_no_deps = []
779 }
780 if (!defined(deps)) {
781 deps = []
782 }
783 foreach(p, poisonous) {
784 deps += [ webrtc_root + ":poison_" + p ]
785 }
786 foreach(poison_type, all_poison_types) {
787 allow_dep = true
788 foreach(v, visibility) {
789 if (v == "*") {
790 allow_dep = false
791 }
792 }
793 foreach(p, allow_poison + poisonous) {
794 if (p == poison_type) {
795 allow_dep = true
796 }
797 }
798 if (!allow_dep) {
799 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
800 }
801 }
802 }
803
Mirko Bonadei92dd35d2019-11-15 15:08:41804 # Chromium should only depend on the WebRTC component in order to
805 # avoid to statically link WebRTC in a component build.
806 if (build_with_chromium) {
807 publicly_visible = false
808 foreach(v, visibility) {
809 if (v == "*") {
810 publicly_visible = true
811 }
812 }
813 if (publicly_visible) {
814 visibility = []
815 visibility = webrtc_default_visibility
816 }
817 }
818
Mirko Bonadei86d053c2019-10-17 19:32:04819 if (!defined(testonly) || !testonly) {
820 configs += rtc_prod_configs
821 }
822
823 configs += invoker.configs
824 configs += rtc_library_impl_config
825 configs -= rtc_remove_configs
826 configs -= invoker.suppressed_configs
827 public_configs = [
828 rtc_common_inherited_config,
829 absl_include_config,
830 absl_define_config,
831 ]
832 if (defined(testonly) && testonly) {
833 public_configs += [ absl_flags_config ]
834 }
835 if (defined(invoker.public_configs)) {
836 public_configs += invoker.public_configs
837 }
Mirko Bonadei8b7cfa12020-06-03 19:23:41838
Mirko Bonadei96115cf2020-06-23 21:39:56839 # If absl_deps is [], no action is needed. If not [], then it needs to be
840 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 19:23:41841 # otherwise it just needs to be added to deps.
842 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 12:30:41843 if (!defined(deps)) {
844 deps = []
845 }
Mirko Bonadei08ce9862020-06-11 09:25:32846 if (build_with_chromium) {
847 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 19:23:41848 } else {
849 deps += absl_deps
850 }
851 }
Mirko Bonadei86d053c2019-10-17 19:32:04852 }
853}
854
855template("rtc_executable") {
856 executable(target_name) {
857 forward_variables_from(invoker,
858 "*",
859 [
860 "deps",
861 "configs",
862 "public_configs",
863 "suppressed_configs",
864 "visibility",
865 ])
866 forward_variables_from(invoker, [ "visibility" ])
867 if (!defined(visibility)) {
868 visibility = webrtc_default_visibility
869 }
870 configs += invoker.configs
871 configs -= rtc_remove_configs
872 configs -= invoker.suppressed_configs
873 deps = invoker.deps
874
875 public_configs = [
876 rtc_common_inherited_config,
877 absl_include_config,
878 absl_define_config,
879 ]
880 if (defined(testonly) && testonly) {
881 public_configs += [ absl_flags_config ]
882 }
883 if (defined(invoker.public_configs)) {
884 public_configs += invoker.public_configs
885 }
886 if (is_win) {
887 deps += [
888 # Give executables the default manifest on Windows (a no-op elsewhere).
889 "//build/win:default_exe_manifest",
890 ]
891 }
892 }
893}
894
mbonadei9aa3f0a2017-01-24 14:58:22895template("rtc_shared_library") {
896 shared_library(target_name) {
897 forward_variables_from(invoker,
898 "*",
899 [
900 "configs",
901 "public_configs",
902 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19903 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22904 ])
Karl Wiberg138d4ac2017-10-16 09:16:19905 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53906 if (!defined(visibility)) {
907 visibility = webrtc_default_visibility
908 }
Karl Wibergbb23c832018-04-22 17:55:00909
910 # What's your poison?
911 if (defined(testonly) && testonly) {
912 assert(!defined(poisonous))
913 assert(!defined(allow_poison))
914 } else {
915 if (!defined(poisonous)) {
916 poisonous = []
917 }
918 if (!defined(allow_poison)) {
919 allow_poison = []
920 }
921 if (!defined(assert_no_deps)) {
922 assert_no_deps = []
923 }
924 if (!defined(deps)) {
925 deps = []
926 }
927 foreach(p, poisonous) {
928 deps += [ webrtc_root + ":poison_" + p ]
929 }
930 foreach(poison_type, all_poison_types) {
931 allow_dep = true
932 foreach(v, visibility) {
933 if (v == "*") {
934 allow_dep = false
935 }
936 }
937 foreach(p, allow_poison + poisonous) {
938 if (p == poison_type) {
939 allow_dep = true
940 }
941 }
942 if (!allow_dep) {
943 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
944 }
945 }
946 }
947
mbonadei9aa3f0a2017-01-24 14:58:22948 configs += invoker.configs
949 configs -= rtc_remove_configs
950 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32951 public_configs = [
952 rtc_common_inherited_config,
953 absl_include_config,
954 absl_define_config,
955 ]
Mirko Bonadei2ab97f62019-07-18 11:44:12956 if (defined(testonly) && testonly) {
957 public_configs += [ absl_flags_config ]
958 }
mbonadei9aa3f0a2017-01-24 14:58:22959 if (defined(invoker.public_configs)) {
960 public_configs += invoker.public_configs
961 }
962 }
963}
kthelgason4065a5762017-02-14 12:58:56964
965if (is_ios) {
Joel Sutherlandd2fb1bf2018-10-02 20:08:25966 # TODO: Generate module.modulemap file to enable use in Swift
967 # projects. See "mac_framework_bundle_with_umbrella_header".
Anders Carlssondc6b4772018-01-15 12:31:03968 template("ios_framework_bundle_with_umbrella_header") {
969 forward_variables_from(invoker, [ "output_name" ])
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28970 this_target_name = target_name
Anders Carlssondc6b4772018-01-15 12:31:03971 umbrella_header_path =
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28972 "$target_gen_dir/$output_name.framework/WebRTC/$output_name.h"
973
974 action_foreach("create_bracket_include_headers_$target_name") {
975 script = "//tools_webrtc/apple/copy_framework_header.py"
976 sources = invoker.sources
977 output_name = invoker.output_name
978 outputs = [
979 "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}",
980 ]
981 args = [
982 "--input",
983 "{{source}}",
984 "--output",
985 rebase_path(target_gen_dir, root_build_dir) +
986 "/$output_name.framework/WebRTC/{{source_file_part}}",
987 ]
988 }
Anders Carlssondc6b4772018-01-15 12:31:03989
990 ios_framework_bundle(target_name) {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28991 forward_variables_from(invoker, "*", [ "public_headers" ])
992 public_headers = get_target_outputs(
993 ":create_bracket_include_headers_$this_target_name")
994 deps += [
995 ":copy_umbrella_header_$target_name",
996 ":create_bracket_include_headers_$target_name",
997 ]
Anders Carlssondc6b4772018-01-15 12:31:03998 }
999
1000 action("umbrella_header_$target_name") {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281001 public_headers = get_target_outputs(
1002 ":create_bracket_include_headers_$this_target_name")
Anders Carlssondc6b4772018-01-15 12:31:031003
1004 script = "//tools_webrtc/ios/generate_umbrella_header.py"
1005
Mirko Bonadeiccbe95f2020-01-21 11:10:101006 outputs = [ umbrella_header_path ]
Anders Carlssondc6b4772018-01-15 12:31:031007 args = [
1008 "--out",
1009 rebase_path(umbrella_header_path, root_build_dir),
1010 "--sources",
Anders Carlsson7bca8ca2018-08-30 07:30:291011 ] + public_headers
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281012 deps = [ ":create_bracket_include_headers_$this_target_name" ]
Anders Carlssondc6b4772018-01-15 12:31:031013 }
1014
Jordan Rose53d3fc92021-07-06 19:16:411015 if (target_environment == "catalyst") {
1016 # Catalyst frameworks use the same layout as regular Mac frameworks.
1017 headers_dir = "Versions/A/Headers"
1018 } else {
1019 headers_dir = "Headers"
1020 }
Anders Carlssondc6b4772018-01-15 12:31:031021 copy("copy_umbrella_header_$target_name") {
Mirko Bonadeiccbe95f2020-01-21 11:10:101022 sources = [ umbrella_header_path ]
1023 outputs =
Jordan Rose53d3fc92021-07-06 19:16:411024 [ "$root_out_dir/$output_name.framework/$headers_dir/$output_name.h" ]
Anders Carlssondc6b4772018-01-15 12:31:031025
Mirko Bonadeiccbe95f2020-01-21 11:10:101026 deps = [ ":umbrella_header_$target_name" ]
Anders Carlssondc6b4772018-01-15 12:31:031027 }
1028 }
1029
1030 set_defaults("ios_framework_bundle_with_umbrella_header") {
1031 configs = default_shared_library_configs
1032 }
kthelgason4065a5762017-02-14 12:58:561033}
Mirko Bonadeifbb3b7d2017-11-07 15:36:331034
Anders Carlsson37bbf792018-09-05 14:29:271035if (is_mac) {
1036 template("mac_framework_bundle_with_umbrella_header") {
1037 forward_variables_from(invoker, [ "output_name" ])
Anders Carlsson95c56ee2018-09-06 13:48:171038 this_target_name = target_name
1039 umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h"
Joel Sutherlandd2fb1bf2018-10-02 20:08:251040 modulemap_path = "$target_gen_dir/Modules/module.modulemap"
Anders Carlsson37bbf792018-09-05 14:29:271041
1042 mac_framework_bundle(target_name) {
Thomas Anderson6fde78c2019-01-23 18:40:291043 forward_variables_from(invoker, "*", [ "configs" ])
1044 if (defined(invoker.configs)) {
1045 configs += invoker.configs
1046 }
Anders Carlsson37bbf792018-09-05 14:29:271047
1048 framework_version = "A"
Joel Sutherlandd2fb1bf2018-10-02 20:08:251049 framework_contents = [
1050 "Headers",
1051 "Modules",
1052 "Resources",
1053 ]
Anders Carlsson37bbf792018-09-05 14:29:271054
1055 ldflags = [
1056 "-all_load",
1057 "-install_name",
1058 "@rpath/$output_name.framework/$output_name",
1059 ]
1060
1061 deps += [
Anders Carlsson95c56ee2018-09-06 13:48:171062 ":copy_framework_headers_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 20:08:251063 ":copy_modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 13:48:171064 ":copy_umbrella_header_$this_target_name",
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281065 ":create_bracket_include_headers_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 20:08:251066 ":modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 13:48:171067 ":umbrella_header_$this_target_name",
Anders Carlsson37bbf792018-09-05 14:29:271068 ]
1069 }
1070
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281071 action_foreach("create_bracket_include_headers_$this_target_name") {
1072 script = "//tools_webrtc/apple/copy_framework_header.py"
1073 sources = invoker.sources
1074 output_name = invoker.output_name
1075 outputs = [
1076 "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}",
1077 ]
1078 args = [
1079 "--input",
1080 "{{source}}",
1081 "--output",
1082 rebase_path(target_gen_dir, root_build_dir) +
1083 "/$output_name.framework/WebRTC/{{source_file_part}}",
1084 ]
1085 }
1086
Anders Carlsson95c56ee2018-09-06 13:48:171087 bundle_data("copy_framework_headers_$this_target_name") {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281088 sources = get_target_outputs(
1089 ":create_bracket_include_headers_$this_target_name")
Anders Carlsson37bbf792018-09-05 14:29:271090
Mirko Bonadeiccbe95f2020-01-21 11:10:101091 outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281092 deps = [ ":create_bracket_include_headers_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 14:29:271093 }
1094
Joel Sutherlandd2fb1bf2018-10-02 20:08:251095 action("modulemap_$this_target_name") {
1096 script = "//tools_webrtc/ios/generate_modulemap.py"
1097 args = [
1098 "--out",
1099 rebase_path(modulemap_path, root_build_dir),
1100 "--name",
1101 output_name,
1102 ]
Mirko Bonadeiccbe95f2020-01-21 11:10:101103 outputs = [ modulemap_path ]
Joel Sutherlandd2fb1bf2018-10-02 20:08:251104 }
1105
1106 bundle_data("copy_modulemap_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 11:10:101107 sources = [ modulemap_path ]
1108 outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ]
1109 deps = [ ":modulemap_$this_target_name" ]
Joel Sutherlandd2fb1bf2018-10-02 20:08:251110 }
1111
Anders Carlsson95c56ee2018-09-06 13:48:171112 action("umbrella_header_$this_target_name") {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281113 sources = get_target_outputs(
1114 ":create_bracket_include_headers_$this_target_name")
Anders Carlsson37bbf792018-09-05 14:29:271115
1116 script = "//tools_webrtc/ios/generate_umbrella_header.py"
1117
Mirko Bonadeiccbe95f2020-01-21 11:10:101118 outputs = [ umbrella_header_path ]
Anders Carlsson37bbf792018-09-05 14:29:271119 args = [
1120 "--out",
1121 rebase_path(umbrella_header_path, root_build_dir),
1122 "--sources",
1123 ] + sources
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281124 deps = [ ":create_bracket_include_headers_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 14:29:271125 }
1126
Anders Carlsson95c56ee2018-09-06 13:48:171127 bundle_data("copy_umbrella_header_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 11:10:101128 sources = [ umbrella_header_path ]
1129 outputs = [ "{{bundle_contents_dir}}/Headers/$output_name.h" ]
Anders Carlsson37bbf792018-09-05 14:29:271130
Mirko Bonadeiccbe95f2020-01-21 11:10:101131 deps = [ ":umbrella_header_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 14:29:271132 }
1133 }
1134}
1135
Mirko Bonadeifbb3b7d2017-11-07 15:36:331136if (is_android) {
1137 template("rtc_android_library") {
1138 android_library(target_name) {
1139 forward_variables_from(invoker,
1140 "*",
1141 [
1142 "configs",
1143 "public_configs",
1144 "suppressed_configs",
1145 "visibility",
1146 ])
1147
Oleh Prypin05aee742018-11-23 16:29:441148 errorprone_args = []
Sami Kalliomäkie7fac682018-03-20 15:32:491149
Mirko Bonadeifbb3b7d2017-11-07 15:36:331150 # Treat warnings as errors.
Oleh Prypin05aee742018-11-23 16:29:441151 errorprone_args += [ "-Werror" ]
Sami Kalliomäkie7fac682018-03-20 15:32:491152
1153 # Add any arguments defined by the invoker.
Oleh Prypin05aee742018-11-23 16:29:441154 if (defined(invoker.errorprone_args)) {
1155 errorprone_args += invoker.errorprone_args
Sami Kalliomäkie7fac682018-03-20 15:32:491156 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:331157
Sami Kalliomäkidc526512018-03-27 15:07:271158 if (!defined(deps)) {
1159 deps = []
1160 }
Sami Kalliomäkidc526512018-03-27 15:07:271161
Mirko Bonadeifbb3b7d2017-11-07 15:36:331162 no_build_hooks = true
Mirko Bonadei8b7cfa12020-06-03 19:23:411163 not_needed([ "android_manifest" ])
Mirko Bonadeifbb3b7d2017-11-07 15:36:331164 }
1165 }
1166
1167 template("rtc_android_apk") {
1168 android_apk(target_name) {
1169 forward_variables_from(invoker,
1170 "*",
1171 [
1172 "configs",
1173 "public_configs",
1174 "suppressed_configs",
1175 "visibility",
1176 ])
1177
1178 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 11:10:081179 errorprone_args = []
1180 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 15:07:271181
1182 if (!defined(deps)) {
1183 deps = []
1184 }
Sami Kalliomäkidc526512018-03-27 15:07:271185
Mirko Bonadeifbb3b7d2017-11-07 15:36:331186 no_build_hooks = true
1187 }
1188 }
1189
1190 template("rtc_instrumentation_test_apk") {
1191 instrumentation_test_apk(target_name) {
1192 forward_variables_from(invoker,
1193 "*",
1194 [
1195 "configs",
1196 "public_configs",
1197 "suppressed_configs",
1198 "visibility",
1199 ])
1200
1201 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 11:10:081202 errorprone_args = []
1203 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 15:07:271204
1205 if (!defined(deps)) {
1206 deps = []
1207 }
Sami Kalliomäkidc526512018-03-27 15:07:271208
Mirko Bonadeifbb3b7d2017-11-07 15:36:331209 no_build_hooks = true
1210 }
1211 }
1212}