blob: b70cba633a93d9ec344ff32c18dc7b1d65736f08 [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")
11import("//build/config/sanitizers/sanitizers.gni")
Tomas Popela318da512018-11-13 05:32:2312import("//build/config/sysroot.gni")
ehmaldonado0d729b32017-02-10 09:38:2313import("//build/config/ui.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(
26 "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md")
27 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
mbonadei9aa3f0a2017-01-24 14:58:2238declare_args() {
Mirko Bonadei028248c2018-10-10 10:19:0239 # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
40 # expand to code that will manage symbols visibility.
41 rtc_enable_symbol_export = false
42
Mirko Bonadei31b0b452018-08-22 08:37:1143 # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
Mirko Bonadei70400902018-08-21 13:44:2844 # will tell the pre-processor to remove the default definition of symbols
45 # needed to use field_trial. In that case a new implementation needs to be
46 # provided.
Mirko Bonadei31b0b452018-08-22 08:37:1147 if (build_with_chromium) {
48 # When WebRTC is built as part of Chromium it should exclude the default
49 # implementation of field_trial unless it is building for NACL or
50 # Chromecast.
51 rtc_exclude_field_trial_default = !is_nacl && !is_chromecast
52 } else {
53 rtc_exclude_field_trial_default = false
54 }
Mirko Bonadei70400902018-08-21 13:44:2855
Mirko Bonadei906add42018-09-05 14:03:1656 # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which
57 # will tell the pre-processor to remove the default definition of symbols
58 # needed to use metrics. In that case a new implementation needs to be
59 # provided.
60 rtc_exclude_metrics_default = build_with_chromium
61
Johannes Kronda20c732021-02-19 15:39:4162 # Setting this to true will define WEBRTC_EXCLUDE_SYSTEM_TIME which
63 # will tell the pre-processor to remove the default definition of the
64 # SystemTimeNanos() which is defined in rtc_base/system_time.cc. In
65 # that case a new implementation needs to be provided.
Johannes Kronbb52bdf2021-02-25 09:10:0866 rtc_exclude_system_time = build_with_chromium
Johannes Kronda20c732021-02-19 15:39:4167
Benjamin Wrightd6f86e82018-05-08 20:12:2568 # Setting this to false will require the API user to pass in their own
69 # SSLCertificateVerifier to verify the certificates presented from a
70 # TLS-TURN server. In return disabling this saves around 100kb in the binary.
71 rtc_builtin_ssl_root_certificates = true
72
Karl Wibergeb254b42017-11-01 14:08:1273 # Include the iLBC audio codec?
Olga Sharonova5fbd7582020-07-09 09:50:4274 rtc_include_ilbc = true
Karl Wibergeb254b42017-11-01 14:08:1275
mbonadei9aa3f0a2017-01-24 14:58:2276 # Disable this to avoid building the Opus audio codec.
77 rtc_include_opus = true
78
minyue2e03c662017-02-02 01:31:1179 # Enable this if the Opus version upon which WebRTC is built supports direct
80 # encoding of 120 ms packets.
minyue-webrtc516711c2017-07-27 15:45:4981 rtc_opus_support_120ms_ptime = true
minyue2e03c662017-02-02 01:31:1182
mbonadei9aa3f0a2017-01-24 14:58:2283 # Enable this to let the Opus audio codec change complexity on the fly.
84 rtc_opus_variable_complexity = false
85
mbonadei9aa3f0a2017-01-24 14:58:2286 # Used to specify an external Jsoncpp include path when not compiling the
87 # library that comes with WebRTC (i.e. rtc_build_json == 0).
88 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
89
90 # Used to specify an external OpenSSL include path when not compiling the
91 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
92 rtc_ssl_root = ""
93
mbonadei9aa3f0a2017-01-24 14:58:2294 # Enable when an external authentication mechanism is used for performing
95 # packet authentication for RTP packets instead of libsrtp.
96 rtc_enable_external_auth = build_with_chromium
97
98 # Selects whether debug dumps for the audio processing module
99 # should be generated.
100 apm_debug_dump = false
101
Per Åhgrencc73ed32020-04-26 21:56:17102 # Selects whether the audio processing module should be excluded.
103 rtc_exclude_audio_processing_module = false
104
mbonadei9aa3f0a2017-01-24 14:58:22105 # Set this to true to enable BWE test logging.
106 rtc_enable_bwe_test_logging = false
107
Joachim Bauch93e91342017-12-07 00:25:53108 # Set this to false to skip building examples.
109 rtc_build_examples = true
110
111 # Set this to false to skip building tools.
112 rtc_build_tools = true
113
Joachim Bauch75f18fc2017-12-20 20:25:47114 # Set this to false to skip building code that requires X11.
115 rtc_use_x11 = use_x11
116
Tomas Popela318da512018-11-13 05:32:23117 # Set this to use PipeWire on the Wayland display server.
Tomas Popela762543f2018-12-12 13:37:51118 # By default it's only enabled on desktop Linux (excludes ChromeOS) and
119 # only when using the sysroot as PipeWire is not available in older and
120 # supported Ubuntu and Debian distributions.
Xiaohan Wang9f32f3b2020-10-01 21:46:54121 rtc_use_pipewire = is_linux && use_sysroot
Tomas Popela762543f2018-12-12 13:37:51122
123 # Set this to link PipeWire directly instead of using the dlopen.
124 rtc_link_pipewire = false
Tomas Popela318da512018-11-13 05:32:23125
Jan Grulichc3c81292020-12-02 08:03:34126 # Set this to use certain PipeWire version
Jan Grulich14b036d2021-02-04 08:53:20127 # Currently WebRTC supports PipeWire 0.2 and PipeWire 0.3 (default)
128 rtc_pipewire_version = "0.3"
Jan Grulichc3c81292020-12-02 08:03:34129
mbonadei9aa3f0a2017-01-24 14:58:22130 # Enable to use the Mozilla internal settings.
131 build_with_mozilla = false
132
Philipp Hanckee95ebda2020-09-17 14:13:20133 # Experimental: enable use of Android AAudio which requires Android SDK 26 or above
134 # and NDK r16 or above.
henrika883d00f2018-03-16 09:09:49135 rtc_enable_android_aaudio = false
136
mbonadei9aa3f0a2017-01-24 14:58:22137 # Set to "func", "block", "edge" for coverage generation.
138 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
139 # It is recommend to set include_examples=0.
140 # Use llvm's sancov -html-report for human readable reports.
141 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
142 rtc_sanitize_coverage = ""
143
Philipp Hanckeaeac9f82020-09-11 09:58:18144 # Selects fixed-point code where possible.
145 rtc_prefer_fixed_point = false
mbonadei9aa3f0a2017-01-24 14:58:22146 if (current_cpu == "arm" || current_cpu == "arm64") {
147 rtc_prefer_fixed_point = true
148 }
149
mbonadei9aa3f0a2017-01-24 14:58:22150 # Determines whether NEON code will be built.
151 rtc_build_with_neon =
152 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
153
154 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
155 # all platforms except Android and iOS. Because FFmpeg can be built
156 # with/without H.264 support, |ffmpeg_branding| has to separately be set to a
157 # value that includes H.264, for example "Chrome". If FFmpeg is built without
Sergey Silkinfe288eb2018-06-25 14:22:38158 # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize.
mbonadei9aa3f0a2017-01-24 14:58:22159 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
160 # http://www.openh264.org, https://www.ffmpeg.org/
Mirko Bonadeiee0a85c2019-01-15 09:47:18161 #
162 # Enabling H264 when building with MSVC is currently not supported, see
163 # bugs.webrtc.org/9213#c13 for more info.
164 rtc_use_h264 =
165 proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
mbonadei9aa3f0a2017-01-24 14:58:22166
Markus Handell8e75bd42020-06-05 09:47:40167 # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex.
168 rtc_use_absl_mutex = false
169
mbonadei9aa3f0a2017-01-24 14:58:22170 # By default, use normal platform audio support or dummy audio, but don't
171 # use file-based audio playout and record.
172 rtc_use_dummy_audio_file_devices = false
173
henrika7be78832017-06-13 15:34:16174 # When set to true, replace the audio output with a sinus tone at 440Hz.
175 # The ADM will ask for audio data from WebRTC but instead of reading real
176 # audio samples from NetEQ, a sinus tone will be generated and replace the
177 # real audio samples.
178 rtc_audio_device_plays_sinus_tone = false
179
Anders Carlsson358f2e02018-06-04 08:24:37180 if (is_ios) {
181 # Build broadcast extension in AppRTCMobile for iOS. This results in the
182 # binary only running on iOS 11+, which is why it is disabled by default.
183 rtc_apprtcmobile_broadcast_extension = false
184 }
Anders Carlsson7bca8ca2018-08-30 07:30:29185
186 # Determines whether Metal is available on iOS/macOS.
187 rtc_use_metal_rendering = is_mac || (is_ios && current_cpu == "arm64")
Jiawei Ou08745302019-02-12 19:36:13188
189 # When set to false, builtin audio encoder/decoder factories and all the
190 # audio codecs they depend on will not be included in libwebrtc.{a|lib}
191 # (they will still be included in libjingle_peerconnection_so.so and
192 # WebRTC.framework)
193 rtc_include_builtin_audio_codecs = true
194
195 # When set to false, builtin video encoder/decoder factories and all the
196 # video codecs they depends on will not be included in libwebrtc.{a|lib}
197 # (they will still be included in libjingle_peerconnection_so.so and
198 # WebRTC.framework)
199 rtc_include_builtin_video_codecs = true
Mirko Bonadei20574f42019-03-28 06:50:07200
201 # When set to true and in a standalone build, it will undefine UNICODE and
202 # _UNICODE (which are always defined globally by the Chromium Windows
203 # toolchain).
204 # This is only needed for testing purposes, WebRTC wants to be sure it
205 # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses
206 # wide character functions.
207 rtc_win_undef_unicode = false
Austin Orion25b0dee2020-10-01 20:47:54208
209 # When set to true, a capturer implementation that uses the
210 # Windows.Graphics.Capture APIs will be available for use. These APIs are
211 # available in the Win 10 SDK v10.0.19041.
212 rtc_enable_win_wgc = false
Dan Minor9c686132018-01-15 15:20:00213}
mbonadei9aa3f0a2017-01-24 14:58:22214
Dan Minor9c686132018-01-15 15:20:00215if (!build_with_mozilla) {
216 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 14:58:22217}
218
219# A second declare_args block, so that declarations within it can
220# depend on the possibly overridden variables in the first
221# declare_args block.
222declare_args() {
Dan Minor9c686132018-01-15 15:20:00223 # Enables the use of protocol buffers for debug recordings.
224 rtc_enable_protobuf = !build_with_mozilla
225
226 # Set this to disable building with support for SCTP data channels.
227 rtc_enable_sctp = !build_with_mozilla
228
229 # Disable these to not build components which can be externally provided.
230 rtc_build_json = !build_with_mozilla
231 rtc_build_libsrtp = !build_with_mozilla
232 rtc_build_libvpx = !build_with_mozilla
233 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 15:20:00234 rtc_build_opus = !build_with_mozilla
235 rtc_build_ssl = !build_with_mozilla
236 rtc_build_usrsctp = !build_with_mozilla
237
238 # Enable libevent task queues on platforms that support it.
Mirko Bonadei775c02e2019-06-19 17:05:00239 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
240 target_cpu == "wasm") {
Dan Minor9c686132018-01-15 15:20:00241 rtc_enable_libevent = false
242 rtc_build_libevent = false
243 } else {
244 rtc_enable_libevent = true
245 rtc_build_libevent = !build_with_mozilla
246 }
247
Dan Minor9c686132018-01-15 15:20:00248 # Build sources requiring GTK. NOTICE: This is not present in Chrome OS
249 # build environments, even if available for Chromium builds.
250 rtc_use_gtk = !build_with_chromium && !build_with_mozilla
251
mbonadei9aa3f0a2017-01-24 14:58:22252 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
253 rtc_include_pulse_audio = !build_with_chromium
254
255 # Chromium uses its own IO handling, so the internal ADM is only built for
256 # standalone WebRTC.
257 rtc_include_internal_audio_device = !build_with_chromium
258
Zhaoliang Ma72e43212020-08-17 09:13:41259 # Set this to true to enable the avx2 support in webrtc.
Per Åhgrena43178c2020-09-25 10:02:32260 # TODO: Make sure that AVX2 works also for non-clang compilers.
261 if (is_clang == true) {
262 rtc_enable_avx2 = true
263 } else {
264 rtc_enable_avx2 = false
265 }
Zhaoliang Ma72e43212020-08-17 09:13:41266
Philipp Hancke1a89bc82021-03-02 20:23:24267 # Set this to true to build the unit tests.
268 # Disabled when building with Chromium or Mozilla.
Dan Minor9c686132018-01-15 15:20:00269 rtc_include_tests = !build_with_chromium && !build_with_mozilla
Oleh Prypin240b8932019-06-07 11:27:07270
271 # Set this to false to skip building code that also requires X11 extensions
272 # such as Xdamage, Xfixes.
273 rtc_use_x11_extensions = rtc_use_x11
Artem Titov6a4a1462019-11-26 15:24:46274
275 # Set this to true to fully remove logging from WebRTC.
276 rtc_disable_logging = false
Doudou Kisabaka2dec4962019-11-28 13:24:31277
278 # Set this to true to disable trace events.
279 rtc_disable_trace_events = false
Artem Titov9dc209a2019-11-28 16:09:30280
281 # Set this to true to disable detailed error message and logging for
282 # RTC_CHECKs.
283 rtc_disable_check_msg = false
Ying Wangef3998f2019-12-09 12:06:53284
285 # Set this to true to disable webrtc metrics.
Mirko Bonadei3c4fda22019-12-10 14:02:53286 rtc_disable_metrics = false
sazaaa42ecd2020-04-01 13:24:40287
288 # Set this to true to exclude the transient suppressor in the audio processing
289 # module from the build.
290 rtc_exclude_transient_suppressor = false
mbonadei9aa3f0a2017-01-24 14:58:22291}
292
293# Make it possible to provide custom locations for some libraries (move these
294# up into declare_args should we need to actually use them for the GN build).
295rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 14:58:22296rtc_opus_dir = "//third_party/opus"
297
298# Desktop capturer is supported only on Windows, OSX and Linux.
Oleh Prypin240b8932019-06-07 11:27:07299rtc_desktop_capture_supported =
300 (is_win && current_os != "winuwp") || is_mac ||
Hidehiko Abef264e702020-09-10 09:10:11301 ((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))
mbonadei9aa3f0a2017-01-24 14:58:22302
303###############################################################################
304# Templates
305#
306
Mirko Bonadei92ea95e2017-09-15 04:47:31307# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 14:58:22308# chromium.
309# We need absolute paths for all configs in templates as they are shared in
310# different subdirectories.
311webrtc_root = get_path_info(".", "abspath")
312
313# Global configuration that should be applied to all WebRTC targets.
314# You normally shouldn't need to include this in your target as it's
315# automatically included when using the rtc_* templates.
316# It sets defines, include paths and compilation warnings accordingly,
317# both for WebRTC stand-alone builds and for the scenario when WebRTC
318# native code is built as part of Chromium.
Will Harrisfc173d02018-08-29 20:56:00319rtc_common_configs = [
320 webrtc_root + ":common_config",
321 "//build/config/compiler:no_size_t_to_int_warning",
322]
mbonadei9aa3f0a2017-01-24 14:58:22323
kthelgasonc0977102017-04-24 07:57:16324if (is_mac || is_ios) {
325 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
326}
327
mbonadei9aa3f0a2017-01-24 14:58:22328# Global public configuration that should be applied to all WebRTC targets. You
329# normally shouldn't need to include this in your target as it's automatically
330# included when using the rtc_* templates. It set the defines, include paths and
331# compilation warnings that should be propagated to dependents of the targets
332# depending on the target having this config.
333rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
334
335# Common configs to remove or add in all rtc targets.
336rtc_remove_configs = []
Mirko Bonadeifc52b912019-03-01 09:32:56337if (!build_with_chromium && is_clang) {
338 rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
339}
mbonadei9aa3f0a2017-01-24 14:58:22340rtc_add_configs = rtc_common_configs
Mirko Bonadei96ede16a2018-09-06 11:45:44341rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
Mirko Bonadei32ce18c2018-09-18 11:15:54342rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
mbonadei9aa3f0a2017-01-24 14:58:22343
344set_defaults("rtc_test") {
345 configs = rtc_add_configs
346 suppressed_configs = []
347}
348
Mirko Bonadei86d053c2019-10-17 19:32:04349set_defaults("rtc_library") {
350 configs = rtc_add_configs
351 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 19:23:41352 absl_deps = []
Mirko Bonadei86d053c2019-10-17 19:32:04353}
354
mbonadei9aa3f0a2017-01-24 14:58:22355set_defaults("rtc_source_set") {
356 configs = rtc_add_configs
357 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 19:23:41358 absl_deps = []
mbonadei9aa3f0a2017-01-24 14:58:22359}
360
Mirko Bonadei86d053c2019-10-17 19:32:04361set_defaults("rtc_static_library") {
mbonadei9aa3f0a2017-01-24 14:58:22362 configs = rtc_add_configs
363 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 19:23:41364 absl_deps = []
mbonadei9aa3f0a2017-01-24 14:58:22365}
366
Mirko Bonadei86d053c2019-10-17 19:32:04367set_defaults("rtc_executable") {
mbonadei9aa3f0a2017-01-24 14:58:22368 configs = rtc_add_configs
369 suppressed_configs = []
370}
371
372set_defaults("rtc_shared_library") {
373 configs = rtc_add_configs
374 suppressed_configs = []
375}
376
Per Kjellandera7f2d842018-01-10 15:54:53377webrtc_default_visibility = [ webrtc_root + "/*" ]
378if (build_with_chromium) {
379 # Allow Chromium's WebRTC overrides targets to bypass the regular
380 # visibility restrictions.
381 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
382}
383
Karl Wibergbb23c832018-04-22 17:55:00384# ---- Poisons ----
385#
386# The general idea is that some targets declare that they contain some
387# kind of poison, which makes it impossible for other targets to
388# depend on them (even transitively) unless they declare themselves
389# immune to that particular type of poison.
390#
391# Targets that *contain* poison of type foo should contain the line
392#
393# poisonous = [ "foo" ]
394#
395# and targets that *are immune but arent't themselves poisonous*
396# should contain
397#
398# allow_poison = [ "foo" ]
399#
400# This useful in cases where we have some large target or set of
401# targets and want to ensure that most other targets do not
402# transitively depend on them. For example, almost no high-level
403# target should depend on the audio codecs, since we want WebRTC users
404# to be able to inject any subset of them and actually end up with a
405# binary that doesn't include the codecs they didn't inject.
406#
407# Test-only targets (`testonly` set to true) and non-public targets
408# (`visibility` not containing "*") are automatically immune to all
409# types of poison.
410#
411# Here's the complete list of all types of poison. It must be kept in
412# 1:1 correspondence with the set of //:poison_* targets.
413#
414all_poison_types = [
415 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
416 "audio_codecs",
Anders Carlsson1f433e42018-04-24 14:39:05417
Danil Chapovalov41300af2019-07-10 10:44:43418 # Default task queue implementation.
419 "default_task_queue",
Sam Zackrisson492fdf42019-10-25 08:45:58420
421 # JSON parsing should not be needed in the "slim and modular" WebRTC.
422 "rtc_json",
423
424 # Software video codecs (VP8 and VP9 through libvpx).
425 "software_video_codecs",
Karl Wibergbb23c832018-04-22 17:55:00426]
427
Mirko Bonadei9a89a492018-05-29 14:22:32428absl_include_config = "//third_party/abseil-cpp:absl_include_config"
429absl_define_config = "//third_party/abseil-cpp:absl_define_config"
430
Mirko Bonadei2ab97f62019-07-18 11:44:12431# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
432# that are testonly.
433absl_flags_config = webrtc_root + ":absl_flags_configs"
434
Mirko Bonadeie99b6cc2020-11-25 15:41:37435# WebRTC wrapper of Chromium's test() template. This template just adds some
436# WebRTC only configuration in order to avoid to duplicate it for every WebRTC
437# target.
438# The parameter `is_xctest` is different from the one in the Chromium's test()
439# template (and it is not forwarded to it). In rtc_test(), the argument
440# `is_xctest` is used to avoid to take dependencies that are not needed
441# in case the test is a real XCTest (using the XCTest framework).
mbonadei9aa3f0a2017-01-24 14:58:22442template("rtc_test") {
443 test(target_name) {
444 forward_variables_from(invoker,
445 "*",
446 [
447 "configs",
Mirko Bonadeie99b6cc2020-11-25 15:41:37448 "is_xctest",
mbonadei9aa3f0a2017-01-24 14:58:22449 "public_configs",
450 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19451 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22452 ])
Mirko Bonadeidd411942017-11-21 14:35:27453
454 # Always override to public because when target_os is Android the `test`
455 # template can override it to [ "*" ] and we want to avoid conditional
456 # visibility.
Mirko Bonadei21558812017-11-21 11:47:34457 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 14:58:22458 configs += invoker.configs
459 configs -= rtc_remove_configs
460 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32461 public_configs = [
462 rtc_common_inherited_config,
463 absl_include_config,
464 absl_define_config,
Mirko Bonadei2ab97f62019-07-18 11:44:12465 absl_flags_config,
Mirko Bonadei9a89a492018-05-29 14:22:32466 ]
mbonadei9aa3f0a2017-01-24 14:58:22467 if (defined(invoker.public_configs)) {
468 public_configs += invoker.public_configs
469 }
sakald7fdb802017-05-26 08:51:53470 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 13:48:37471 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
Jeremy Leconteb19cfee2020-06-25 20:57:49472 min_sdk_version = 21
Mirko Bonadeibd393b22020-07-10 21:00:41473 target_sdk_version = 23
Jianjun Zhu037f3e42017-08-15 13:48:37474 deps += [ webrtc_root + "test:native_test_java" ]
sakald7fdb802017-05-26 08:51:53475 }
Mirko Bonadeie99b6cc2020-11-25 15:41:37476
477 # When not targeting a simulator, building //base/test:google_test_runner
478 # fails, so it is added only when the test is not a real XCTest and when
479 # targeting a simulator.
Mirko Bonadei58678a02020-12-01 09:54:40480 if (is_ios && target_cpu == "x64" && rtc_include_tests) {
Mirko Bonadeie99b6cc2020-11-25 15:41:37481 if (!defined(invoker.is_xctest) || !invoker.is_xctest) {
482 xctest_module_target = "//base/test:google_test_runner"
483 }
484 }
Andrey Logvin78646002021-01-29 10:50:19485
486 # If absl_deps is [], no action is needed. If not [], then it needs to be
487 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
488 # otherwise it just needs to be added to deps.
489 if (defined(absl_deps) && absl_deps != []) {
490 if (!defined(deps)) {
491 deps = []
492 }
493 if (build_with_chromium) {
494 deps += [ "//third_party/abseil-cpp:absl" ]
495 } else {
496 deps += absl_deps
497 }
498 }
499
Mirko Bonadei1d77c3e2021-01-26 16:10:04500 if (using_sanitizer) {
501 if (is_linux) {
502 if (!defined(invoker.data)) {
503 data = []
504 }
505 data +=
506 [ "//third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6" ]
507 }
508 }
mbonadei9aa3f0a2017-01-24 14:58:22509 }
510}
511
512template("rtc_source_set") {
513 source_set(target_name) {
514 forward_variables_from(invoker,
515 "*",
516 [
517 "configs",
518 "public_configs",
519 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19520 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22521 ])
Karl Wiberg138d4ac2017-10-16 09:16:19522 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53523 if (!defined(visibility)) {
524 visibility = webrtc_default_visibility
525 }
Karl Wibergbb23c832018-04-22 17:55:00526
527 # What's your poison?
528 if (defined(testonly) && testonly) {
529 assert(!defined(poisonous))
530 assert(!defined(allow_poison))
531 } else {
532 if (!defined(poisonous)) {
533 poisonous = []
534 }
535 if (!defined(allow_poison)) {
536 allow_poison = []
537 }
538 if (!defined(assert_no_deps)) {
539 assert_no_deps = []
540 }
541 if (!defined(deps)) {
542 deps = []
543 }
544 foreach(p, poisonous) {
545 deps += [ webrtc_root + ":poison_" + p ]
546 }
547 foreach(poison_type, all_poison_types) {
548 allow_dep = true
549 foreach(v, visibility) {
550 if (v == "*") {
551 allow_dep = false
552 }
553 }
554 foreach(p, allow_poison + poisonous) {
555 if (p == poison_type) {
556 allow_dep = true
557 }
558 }
559 if (!allow_dep) {
560 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
561 }
562 }
563 }
564
Mirko Bonadei92dd35d2019-11-15 15:08:41565 # Chromium should only depend on the WebRTC component in order to
566 # avoid to statically link WebRTC in a component build.
567 if (build_with_chromium) {
568 publicly_visible = false
569 foreach(v, visibility) {
570 if (v == "*") {
571 publicly_visible = true
572 }
573 }
574 if (publicly_visible) {
575 visibility = []
576 visibility = webrtc_default_visibility
577 }
578 }
579
Mirko Bonadei96ede16a2018-09-06 11:45:44580 if (!defined(testonly) || !testonly) {
581 configs += rtc_prod_configs
582 }
583
mbonadei9aa3f0a2017-01-24 14:58:22584 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 11:15:54585 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 14:58:22586 configs -= rtc_remove_configs
587 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32588 public_configs = [
589 rtc_common_inherited_config,
590 absl_include_config,
591 absl_define_config,
592 ]
Mirko Bonadei2ab97f62019-07-18 11:44:12593 if (defined(testonly) && testonly) {
594 public_configs += [ absl_flags_config ]
595 }
mbonadei9aa3f0a2017-01-24 14:58:22596 if (defined(invoker.public_configs)) {
597 public_configs += invoker.public_configs
598 }
Mirko Bonadei8b7cfa12020-06-03 19:23:41599
Mirko Bonadei96115cf2020-06-23 21:39:56600 # If absl_deps is [], no action is needed. If not [], then it needs to be
601 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 19:23:41602 # otherwise it just needs to be added to deps.
603 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 12:30:41604 if (!defined(deps)) {
605 deps = []
606 }
Mirko Bonadei08ce9862020-06-11 09:25:32607 if (build_with_chromium) {
608 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 19:23:41609 } else {
610 deps += absl_deps
611 }
612 }
mbonadei9aa3f0a2017-01-24 14:58:22613 }
614}
615
mbonadei9aa3f0a2017-01-24 14:58:22616template("rtc_static_library") {
617 static_library(target_name) {
618 forward_variables_from(invoker,
619 "*",
620 [
621 "configs",
622 "public_configs",
623 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19624 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22625 ])
Karl Wiberg138d4ac2017-10-16 09:16:19626 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53627 if (!defined(visibility)) {
628 visibility = webrtc_default_visibility
629 }
Karl Wibergbb23c832018-04-22 17:55:00630
631 # What's your poison?
632 if (defined(testonly) && testonly) {
633 assert(!defined(poisonous))
634 assert(!defined(allow_poison))
635 } else {
636 if (!defined(poisonous)) {
637 poisonous = []
638 }
639 if (!defined(allow_poison)) {
640 allow_poison = []
641 }
642 if (!defined(assert_no_deps)) {
643 assert_no_deps = []
644 }
645 if (!defined(deps)) {
646 deps = []
647 }
648 foreach(p, poisonous) {
649 deps += [ webrtc_root + ":poison_" + p ]
650 }
651 foreach(poison_type, all_poison_types) {
652 allow_dep = true
653 foreach(v, visibility) {
654 if (v == "*") {
655 allow_dep = false
656 }
657 }
658 foreach(p, allow_poison + poisonous) {
659 if (p == poison_type) {
660 allow_dep = true
661 }
662 }
663 if (!allow_dep) {
664 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
665 }
666 }
667 }
668
Mirko Bonadei96ede16a2018-09-06 11:45:44669 if (!defined(testonly) || !testonly) {
670 configs += rtc_prod_configs
671 }
672
mbonadei9aa3f0a2017-01-24 14:58:22673 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 11:15:54674 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 14:58:22675 configs -= rtc_remove_configs
676 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32677 public_configs = [
678 rtc_common_inherited_config,
679 absl_include_config,
680 absl_define_config,
681 ]
Mirko Bonadei2ab97f62019-07-18 11:44:12682 if (defined(testonly) && testonly) {
683 public_configs += [ absl_flags_config ]
684 }
mbonadei9aa3f0a2017-01-24 14:58:22685 if (defined(invoker.public_configs)) {
686 public_configs += invoker.public_configs
687 }
Mirko Bonadei8b7cfa12020-06-03 19:23:41688
Mirko Bonadei96115cf2020-06-23 21:39:56689 # If absl_deps is [], no action is needed. If not [], then it needs to be
690 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 19:23:41691 # otherwise it just needs to be added to deps.
692 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 12:30:41693 if (!defined(deps)) {
694 deps = []
695 }
Mirko Bonadei08ce9862020-06-11 09:25:32696 if (build_with_chromium) {
697 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 19:23:41698 } else {
699 deps += absl_deps
700 }
701 }
mbonadei9aa3f0a2017-01-24 14:58:22702 }
703}
704
Mirko Bonadei86d053c2019-10-17 19:32:04705# This template automatically switches the target type between source_set
706# and static_library.
707#
708# This should be the default target type for all the WebRTC targets with
709# one exception. Do not use this template for header only targets, in that case
710# rtc_source_set must be used in order to avoid build errors (e.g. libtool
711# complains if the output .a file is empty).
712#
713# How does it work:
714# Since all files in a source_set are linked into a final binary, while files
715# in a static library are only linked in if at least one symbol in them is
716# referenced, in component builds source_sets are easy to deal with because
717# all their object files are passed to the linker to create a shared library.
718# In release builds instead, static_libraries are preferred since they allow
719# the linker to discard dead code.
720# For the same reason, testonly targets will always be expanded to
721# source_set in order to be sure that tests are present in the test binary.
722template("rtc_library") {
723 if (is_component_build || (defined(invoker.testonly) && invoker.testonly)) {
724 target_type = "source_set"
725 } else {
726 target_type = "static_library"
727 }
728 target(target_type, target_name) {
729 forward_variables_from(invoker,
730 "*",
731 [
732 "configs",
733 "public_configs",
734 "suppressed_configs",
735 "visibility",
736 ])
737 forward_variables_from(invoker, [ "visibility" ])
738 if (!defined(visibility)) {
739 visibility = webrtc_default_visibility
740 }
741
742 # What's your poison?
743 if (defined(testonly) && testonly) {
744 assert(!defined(poisonous))
745 assert(!defined(allow_poison))
746 } else {
747 if (!defined(poisonous)) {
748 poisonous = []
749 }
750 if (!defined(allow_poison)) {
751 allow_poison = []
752 }
753 if (!defined(assert_no_deps)) {
754 assert_no_deps = []
755 }
756 if (!defined(deps)) {
757 deps = []
758 }
759 foreach(p, poisonous) {
760 deps += [ webrtc_root + ":poison_" + p ]
761 }
762 foreach(poison_type, all_poison_types) {
763 allow_dep = true
764 foreach(v, visibility) {
765 if (v == "*") {
766 allow_dep = false
767 }
768 }
769 foreach(p, allow_poison + poisonous) {
770 if (p == poison_type) {
771 allow_dep = true
772 }
773 }
774 if (!allow_dep) {
775 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
776 }
777 }
778 }
779
Mirko Bonadei92dd35d2019-11-15 15:08:41780 # Chromium should only depend on the WebRTC component in order to
781 # avoid to statically link WebRTC in a component build.
782 if (build_with_chromium) {
783 publicly_visible = false
784 foreach(v, visibility) {
785 if (v == "*") {
786 publicly_visible = true
787 }
788 }
789 if (publicly_visible) {
790 visibility = []
791 visibility = webrtc_default_visibility
792 }
793 }
794
Mirko Bonadei86d053c2019-10-17 19:32:04795 if (!defined(testonly) || !testonly) {
796 configs += rtc_prod_configs
797 }
798
799 configs += invoker.configs
800 configs += rtc_library_impl_config
801 configs -= rtc_remove_configs
802 configs -= invoker.suppressed_configs
803 public_configs = [
804 rtc_common_inherited_config,
805 absl_include_config,
806 absl_define_config,
807 ]
808 if (defined(testonly) && testonly) {
809 public_configs += [ absl_flags_config ]
810 }
811 if (defined(invoker.public_configs)) {
812 public_configs += invoker.public_configs
813 }
Mirko Bonadei8b7cfa12020-06-03 19:23:41814
Mirko Bonadei96115cf2020-06-23 21:39:56815 # If absl_deps is [], no action is needed. If not [], then it needs to be
816 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 19:23:41817 # otherwise it just needs to be added to deps.
818 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 12:30:41819 if (!defined(deps)) {
820 deps = []
821 }
Mirko Bonadei08ce9862020-06-11 09:25:32822 if (build_with_chromium) {
823 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 19:23:41824 } else {
825 deps += absl_deps
826 }
827 }
Mirko Bonadei86d053c2019-10-17 19:32:04828 }
829}
830
831template("rtc_executable") {
832 executable(target_name) {
833 forward_variables_from(invoker,
834 "*",
835 [
836 "deps",
837 "configs",
838 "public_configs",
839 "suppressed_configs",
840 "visibility",
841 ])
842 forward_variables_from(invoker, [ "visibility" ])
843 if (!defined(visibility)) {
844 visibility = webrtc_default_visibility
845 }
846 configs += invoker.configs
847 configs -= rtc_remove_configs
848 configs -= invoker.suppressed_configs
849 deps = invoker.deps
850
851 public_configs = [
852 rtc_common_inherited_config,
853 absl_include_config,
854 absl_define_config,
855 ]
856 if (defined(testonly) && testonly) {
857 public_configs += [ absl_flags_config ]
858 }
859 if (defined(invoker.public_configs)) {
860 public_configs += invoker.public_configs
861 }
862 if (is_win) {
863 deps += [
864 # Give executables the default manifest on Windows (a no-op elsewhere).
865 "//build/win:default_exe_manifest",
866 ]
867 }
868 }
869}
870
mbonadei9aa3f0a2017-01-24 14:58:22871template("rtc_shared_library") {
872 shared_library(target_name) {
873 forward_variables_from(invoker,
874 "*",
875 [
876 "configs",
877 "public_configs",
878 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19879 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22880 ])
Karl Wiberg138d4ac2017-10-16 09:16:19881 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53882 if (!defined(visibility)) {
883 visibility = webrtc_default_visibility
884 }
Karl Wibergbb23c832018-04-22 17:55:00885
886 # What's your poison?
887 if (defined(testonly) && testonly) {
888 assert(!defined(poisonous))
889 assert(!defined(allow_poison))
890 } else {
891 if (!defined(poisonous)) {
892 poisonous = []
893 }
894 if (!defined(allow_poison)) {
895 allow_poison = []
896 }
897 if (!defined(assert_no_deps)) {
898 assert_no_deps = []
899 }
900 if (!defined(deps)) {
901 deps = []
902 }
903 foreach(p, poisonous) {
904 deps += [ webrtc_root + ":poison_" + p ]
905 }
906 foreach(poison_type, all_poison_types) {
907 allow_dep = true
908 foreach(v, visibility) {
909 if (v == "*") {
910 allow_dep = false
911 }
912 }
913 foreach(p, allow_poison + poisonous) {
914 if (p == poison_type) {
915 allow_dep = true
916 }
917 }
918 if (!allow_dep) {
919 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
920 }
921 }
922 }
923
mbonadei9aa3f0a2017-01-24 14:58:22924 configs += invoker.configs
925 configs -= rtc_remove_configs
926 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32927 public_configs = [
928 rtc_common_inherited_config,
929 absl_include_config,
930 absl_define_config,
931 ]
Mirko Bonadei2ab97f62019-07-18 11:44:12932 if (defined(testonly) && testonly) {
933 public_configs += [ absl_flags_config ]
934 }
mbonadei9aa3f0a2017-01-24 14:58:22935 if (defined(invoker.public_configs)) {
936 public_configs += invoker.public_configs
937 }
938 }
939}
kthelgason4065a5762017-02-14 12:58:56940
941if (is_ios) {
Joel Sutherlandd2fb1bf2018-10-02 20:08:25942 # TODO: Generate module.modulemap file to enable use in Swift
943 # projects. See "mac_framework_bundle_with_umbrella_header".
Anders Carlssondc6b4772018-01-15 12:31:03944 template("ios_framework_bundle_with_umbrella_header") {
945 forward_variables_from(invoker, [ "output_name" ])
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28946 this_target_name = target_name
Anders Carlssondc6b4772018-01-15 12:31:03947 umbrella_header_path =
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28948 "$target_gen_dir/$output_name.framework/WebRTC/$output_name.h"
949
950 action_foreach("create_bracket_include_headers_$target_name") {
951 script = "//tools_webrtc/apple/copy_framework_header.py"
952 sources = invoker.sources
953 output_name = invoker.output_name
954 outputs = [
955 "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}",
956 ]
957 args = [
958 "--input",
959 "{{source}}",
960 "--output",
961 rebase_path(target_gen_dir, root_build_dir) +
962 "/$output_name.framework/WebRTC/{{source_file_part}}",
963 ]
964 }
Anders Carlssondc6b4772018-01-15 12:31:03965
966 ios_framework_bundle(target_name) {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28967 forward_variables_from(invoker, "*", [ "public_headers" ])
968 public_headers = get_target_outputs(
969 ":create_bracket_include_headers_$this_target_name")
970 deps += [
971 ":copy_umbrella_header_$target_name",
972 ":create_bracket_include_headers_$target_name",
973 ]
Anders Carlssondc6b4772018-01-15 12:31:03974 }
975
976 action("umbrella_header_$target_name") {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28977 public_headers = get_target_outputs(
978 ":create_bracket_include_headers_$this_target_name")
Anders Carlssondc6b4772018-01-15 12:31:03979
980 script = "//tools_webrtc/ios/generate_umbrella_header.py"
981
Mirko Bonadeiccbe95f2020-01-21 11:10:10982 outputs = [ umbrella_header_path ]
Anders Carlssondc6b4772018-01-15 12:31:03983 args = [
984 "--out",
985 rebase_path(umbrella_header_path, root_build_dir),
986 "--sources",
Anders Carlsson7bca8ca2018-08-30 07:30:29987 ] + public_headers
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28988 deps = [ ":create_bracket_include_headers_$this_target_name" ]
Anders Carlssondc6b4772018-01-15 12:31:03989 }
990
991 copy("copy_umbrella_header_$target_name") {
Mirko Bonadeiccbe95f2020-01-21 11:10:10992 sources = [ umbrella_header_path ]
993 outputs =
994 [ "$root_out_dir/$output_name.framework/Headers/$output_name.h" ]
Anders Carlssondc6b4772018-01-15 12:31:03995
Mirko Bonadeiccbe95f2020-01-21 11:10:10996 deps = [ ":umbrella_header_$target_name" ]
Anders Carlssondc6b4772018-01-15 12:31:03997 }
998 }
999
1000 set_defaults("ios_framework_bundle_with_umbrella_header") {
1001 configs = default_shared_library_configs
1002 }
kthelgason4065a5762017-02-14 12:58:561003}
Mirko Bonadeifbb3b7d2017-11-07 15:36:331004
Anders Carlsson37bbf792018-09-05 14:29:271005if (is_mac) {
1006 template("mac_framework_bundle_with_umbrella_header") {
1007 forward_variables_from(invoker, [ "output_name" ])
Anders Carlsson95c56ee2018-09-06 13:48:171008 this_target_name = target_name
1009 umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h"
Joel Sutherlandd2fb1bf2018-10-02 20:08:251010 modulemap_path = "$target_gen_dir/Modules/module.modulemap"
Anders Carlsson37bbf792018-09-05 14:29:271011
1012 mac_framework_bundle(target_name) {
Thomas Anderson6fde78c2019-01-23 18:40:291013 forward_variables_from(invoker, "*", [ "configs" ])
1014 if (defined(invoker.configs)) {
1015 configs += invoker.configs
1016 }
Anders Carlsson37bbf792018-09-05 14:29:271017
1018 framework_version = "A"
Joel Sutherlandd2fb1bf2018-10-02 20:08:251019 framework_contents = [
1020 "Headers",
1021 "Modules",
1022 "Resources",
1023 ]
Anders Carlsson37bbf792018-09-05 14:29:271024
1025 ldflags = [
1026 "-all_load",
1027 "-install_name",
1028 "@rpath/$output_name.framework/$output_name",
1029 ]
1030
1031 deps += [
Anders Carlsson95c56ee2018-09-06 13:48:171032 ":copy_framework_headers_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 20:08:251033 ":copy_modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 13:48:171034 ":copy_umbrella_header_$this_target_name",
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281035 ":create_bracket_include_headers_$this_target_name",
Joel Sutherlandd2fb1bf2018-10-02 20:08:251036 ":modulemap_$this_target_name",
Anders Carlsson95c56ee2018-09-06 13:48:171037 ":umbrella_header_$this_target_name",
Anders Carlsson37bbf792018-09-05 14:29:271038 ]
1039 }
1040
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281041 action_foreach("create_bracket_include_headers_$this_target_name") {
1042 script = "//tools_webrtc/apple/copy_framework_header.py"
1043 sources = invoker.sources
1044 output_name = invoker.output_name
1045 outputs = [
1046 "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}",
1047 ]
1048 args = [
1049 "--input",
1050 "{{source}}",
1051 "--output",
1052 rebase_path(target_gen_dir, root_build_dir) +
1053 "/$output_name.framework/WebRTC/{{source_file_part}}",
1054 ]
1055 }
1056
Anders Carlsson95c56ee2018-09-06 13:48:171057 bundle_data("copy_framework_headers_$this_target_name") {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281058 sources = get_target_outputs(
1059 ":create_bracket_include_headers_$this_target_name")
Anders Carlsson37bbf792018-09-05 14:29:271060
Mirko Bonadeiccbe95f2020-01-21 11:10:101061 outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281062 deps = [ ":create_bracket_include_headers_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 14:29:271063 }
1064
Joel Sutherlandd2fb1bf2018-10-02 20:08:251065 action("modulemap_$this_target_name") {
1066 script = "//tools_webrtc/ios/generate_modulemap.py"
1067 args = [
1068 "--out",
1069 rebase_path(modulemap_path, root_build_dir),
1070 "--name",
1071 output_name,
1072 ]
Mirko Bonadeiccbe95f2020-01-21 11:10:101073 outputs = [ modulemap_path ]
Joel Sutherlandd2fb1bf2018-10-02 20:08:251074 }
1075
1076 bundle_data("copy_modulemap_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 11:10:101077 sources = [ modulemap_path ]
1078 outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ]
1079 deps = [ ":modulemap_$this_target_name" ]
Joel Sutherlandd2fb1bf2018-10-02 20:08:251080 }
1081
Anders Carlsson95c56ee2018-09-06 13:48:171082 action("umbrella_header_$this_target_name") {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281083 sources = get_target_outputs(
1084 ":create_bracket_include_headers_$this_target_name")
Anders Carlsson37bbf792018-09-05 14:29:271085
1086 script = "//tools_webrtc/ios/generate_umbrella_header.py"
1087
Mirko Bonadeiccbe95f2020-01-21 11:10:101088 outputs = [ umbrella_header_path ]
Anders Carlsson37bbf792018-09-05 14:29:271089 args = [
1090 "--out",
1091 rebase_path(umbrella_header_path, root_build_dir),
1092 "--sources",
1093 ] + sources
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281094 deps = [ ":create_bracket_include_headers_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 14:29:271095 }
1096
Anders Carlsson95c56ee2018-09-06 13:48:171097 bundle_data("copy_umbrella_header_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 11:10:101098 sources = [ umbrella_header_path ]
1099 outputs = [ "{{bundle_contents_dir}}/Headers/$output_name.h" ]
Anders Carlsson37bbf792018-09-05 14:29:271100
Mirko Bonadeiccbe95f2020-01-21 11:10:101101 deps = [ ":umbrella_header_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 14:29:271102 }
1103 }
1104}
1105
Mirko Bonadeifbb3b7d2017-11-07 15:36:331106if (is_android) {
1107 template("rtc_android_library") {
1108 android_library(target_name) {
1109 forward_variables_from(invoker,
1110 "*",
1111 [
1112 "configs",
1113 "public_configs",
1114 "suppressed_configs",
1115 "visibility",
1116 ])
1117
Oleh Prypin05aee742018-11-23 16:29:441118 errorprone_args = []
Sami Kalliomäkie7fac682018-03-20 15:32:491119
Mirko Bonadeifbb3b7d2017-11-07 15:36:331120 # Treat warnings as errors.
Oleh Prypin05aee742018-11-23 16:29:441121 errorprone_args += [ "-Werror" ]
Sami Kalliomäkie7fac682018-03-20 15:32:491122
1123 # Add any arguments defined by the invoker.
Oleh Prypin05aee742018-11-23 16:29:441124 if (defined(invoker.errorprone_args)) {
1125 errorprone_args += invoker.errorprone_args
Sami Kalliomäkie7fac682018-03-20 15:32:491126 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:331127
Sami Kalliomäkidc526512018-03-27 15:07:271128 if (!defined(deps)) {
1129 deps = []
1130 }
Sami Kalliomäkidc526512018-03-27 15:07:271131
Mirko Bonadeifbb3b7d2017-11-07 15:36:331132 no_build_hooks = true
Mirko Bonadei8b7cfa12020-06-03 19:23:411133 not_needed([ "android_manifest" ])
Mirko Bonadeifbb3b7d2017-11-07 15:36:331134 }
1135 }
1136
1137 template("rtc_android_apk") {
1138 android_apk(target_name) {
1139 forward_variables_from(invoker,
1140 "*",
1141 [
1142 "configs",
1143 "public_configs",
1144 "suppressed_configs",
1145 "visibility",
1146 ])
1147
1148 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 11:10:081149 errorprone_args = []
1150 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 15:07:271151
1152 if (!defined(deps)) {
1153 deps = []
1154 }
Sami Kalliomäkidc526512018-03-27 15:07:271155
Mirko Bonadeifbb3b7d2017-11-07 15:36:331156 no_build_hooks = true
1157 }
1158 }
1159
1160 template("rtc_instrumentation_test_apk") {
1161 instrumentation_test_apk(target_name) {
1162 forward_variables_from(invoker,
1163 "*",
1164 [
1165 "configs",
1166 "public_configs",
1167 "suppressed_configs",
1168 "visibility",
1169 ])
1170
1171 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 11:10:081172 errorprone_args = []
1173 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 15:07:271174
1175 if (!defined(deps)) {
1176 deps = []
1177 }
Sami Kalliomäkidc526512018-03-27 15:07:271178
Mirko Bonadeifbb3b7d2017-11-07 15:36:331179 no_build_hooks = true
1180 }
1181 }
1182}