blob: 5e4a5d3c812818246227ef5e0b435be231d7b255 [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
Christoffer Jansson25e41562022-09-23 06:38:5438if (is_fuchsia) {
39 import("//build/config/fuchsia/config.gni")
40}
41
Mirko Bonadei5f078452021-07-30 20:32:5542# This declare_args is separated from the next one because args declared
43# in this one, can be read from the next one (args defined in the same
44# declare_args cannot be referenced in that scope).
mbonadei9aa3f0a2017-01-24 14:58:2245declare_args() {
Mirko Bonadei028248c2018-10-10 10:19:0246 # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h)
47 # expand to code that will manage symbols visibility.
48 rtc_enable_symbol_export = false
Mirko Bonadei5f078452021-07-30 20:32:5549}
50
51declare_args() {
Mirko Bonadei339965f2021-10-12 11:23:4452 # Setting this to true, will make RTC_DLOG() expand to log statements instead
Mirko Bonadei56ed4682021-10-12 06:55:4253 # of being removed by the preprocessor.
54 # This is useful for example to be able to get RTC_DLOGs on a release build.
55 rtc_dlog_always_on = false
56
Peter Kasting1e6d77c2023-03-13 23:01:0057 # Enables additional build targets that rely on
58 # //third_party/google_benchmarks.
59 rtc_enable_google_benchmarks = true
60
Mirko Bonadei5f078452021-07-30 20:32:5561 # Setting this to true will make RTC_OBJC_EXPORT expand to code that will
62 # manage symbols visibility. By default, Obj-C/Obj-C++ symbols are exported
63 # if C++ symbols are but setting this arg to true while keeping
64 # rtc_enable_symbol_export=false will only export RTC_OBJC_EXPORT
65 # annotated symbols.
66 rtc_enable_objc_symbol_export = rtc_enable_symbol_export
Mirko Bonadei028248c2018-10-10 10:19:0267
Mirko Bonadei31b0b452018-08-22 08:37:1168 # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which
Mirko Bonadei70400902018-08-21 13:44:2869 # will tell the pre-processor to remove the default definition of symbols
70 # needed to use field_trial. In that case a new implementation needs to be
71 # provided.
Mirko Bonadei31b0b452018-08-22 08:37:1172 if (build_with_chromium) {
73 # When WebRTC is built as part of Chromium it should exclude the default
74 # implementation of field_trial unless it is building for NACL or
75 # Chromecast.
Ryan Keanecf7802d2022-06-10 21:33:1876 rtc_exclude_field_trial_default = !is_nacl && !is_castos && !is_cast_android
Mirko Bonadei31b0b452018-08-22 08:37:1177 } else {
78 rtc_exclude_field_trial_default = false
79 }
Mirko Bonadei70400902018-08-21 13:44:2880
Mirko Bonadei906add42018-09-05 14:03:1681 # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which
82 # will tell the pre-processor to remove the default definition of symbols
83 # needed to use metrics. In that case a new implementation needs to be
84 # provided.
85 rtc_exclude_metrics_default = build_with_chromium
86
Johannes Kronda20c732021-02-19 15:39:4187 # Setting this to true will define WEBRTC_EXCLUDE_SYSTEM_TIME which
88 # will tell the pre-processor to remove the default definition of the
89 # SystemTimeNanos() which is defined in rtc_base/system_time.cc. In
90 # that case a new implementation needs to be provided.
Johannes Kronbb52bdf2021-02-25 09:10:0891 rtc_exclude_system_time = build_with_chromium
Johannes Kronda20c732021-02-19 15:39:4192
Benjamin Wrightd6f86e82018-05-08 20:12:2593 # Setting this to false will require the API user to pass in their own
94 # SSLCertificateVerifier to verify the certificates presented from a
95 # TLS-TURN server. In return disabling this saves around 100kb in the binary.
96 rtc_builtin_ssl_root_certificates = true
97
Karl Wibergeb254b42017-11-01 14:08:1298 # Include the iLBC audio codec?
Olga Sharonova5fbd7582020-07-09 09:50:4299 rtc_include_ilbc = true
Karl Wibergeb254b42017-11-01 14:08:12100
mbonadei9aa3f0a2017-01-24 14:58:22101 # Disable this to avoid building the Opus audio codec.
102 rtc_include_opus = true
103
minyue2e03c662017-02-02 01:31:11104 # Enable this if the Opus version upon which WebRTC is built supports direct
105 # encoding of 120 ms packets.
minyue-webrtc516711c2017-07-27 15:45:49106 rtc_opus_support_120ms_ptime = true
minyue2e03c662017-02-02 01:31:11107
mbonadei9aa3f0a2017-01-24 14:58:22108 # Enable this to let the Opus audio codec change complexity on the fly.
109 rtc_opus_variable_complexity = false
110
mbonadei9aa3f0a2017-01-24 14:58:22111 # Used to specify an external Jsoncpp include path when not compiling the
112 # library that comes with WebRTC (i.e. rtc_build_json == 0).
113 rtc_jsoncpp_root = "//third_party/jsoncpp/source/include"
114
115 # Used to specify an external OpenSSL include path when not compiling the
116 # library that comes with WebRTC (i.e. rtc_build_ssl == 0).
117 rtc_ssl_root = ""
118
mbonadei9aa3f0a2017-01-24 14:58:22119 # Enable when an external authentication mechanism is used for performing
120 # packet authentication for RTP packets instead of libsrtp.
121 rtc_enable_external_auth = build_with_chromium
122
123 # Selects whether debug dumps for the audio processing module
124 # should be generated.
125 apm_debug_dump = false
126
Per Åhgrencc73ed32020-04-26 21:56:17127 # Selects whether the audio processing module should be excluded.
128 rtc_exclude_audio_processing_module = false
129
mbonadei9aa3f0a2017-01-24 14:58:22130 # Set this to true to enable BWE test logging.
131 rtc_enable_bwe_test_logging = false
132
Joachim Bauch93e91342017-12-07 00:25:53133 # Set this to false to skip building examples.
134 rtc_build_examples = true
135
136 # Set this to false to skip building tools.
137 rtc_build_tools = true
138
Joachim Bauch75f18fc2017-12-20 20:25:47139 # Set this to false to skip building code that requires X11.
Maksim Sisovef4d0b62021-09-20 06:02:01140 rtc_use_x11 = ozone_platform_x11
Joachim Bauch75f18fc2017-12-20 20:25:47141
Tomas Popela318da512018-11-13 05:32:23142 # Set this to use PipeWire on the Wayland display server.
Tomas Popela762543f2018-12-12 13:37:51143 # By default it's only enabled on desktop Linux (excludes ChromeOS) and
144 # only when using the sysroot as PipeWire is not available in older and
145 # supported Ubuntu and Debian distributions.
Artem Titov4d6a76d2021-09-03 10:07:20146 rtc_use_pipewire = is_linux && use_sysroot
Tomas Popela762543f2018-12-12 13:37:51147
Jan Gruliche1e05af2021-09-21 18:36:16148 # Set this to link PipeWire and required libraries directly instead of using the dlopen.
Tomas Popela762543f2018-12-12 13:37:51149 rtc_link_pipewire = false
Tomas Popela318da512018-11-13 05:32:23150
mbonadei9aa3f0a2017-01-24 14:58:22151 # Enable to use the Mozilla internal settings.
152 build_with_mozilla = false
153
Philipp Hanckee95ebda2020-09-17 14:13:20154 # Experimental: enable use of Android AAudio which requires Android SDK 26 or above
155 # and NDK r16 or above.
henrika883d00f2018-03-16 09:09:49156 rtc_enable_android_aaudio = false
157
mbonadei9aa3f0a2017-01-24 14:58:22158 # Set to "func", "block", "edge" for coverage generation.
159 # At unit test runtime set UBSAN_OPTIONS="coverage=1".
160 # It is recommend to set include_examples=0.
161 # Use llvm's sancov -html-report for human readable reports.
162 # See http://clang.llvm.org/docs/SanitizerCoverage.html .
163 rtc_sanitize_coverage = ""
164
Philipp Hanckeaeac9f82020-09-11 09:58:18165 # Selects fixed-point code where possible.
166 rtc_prefer_fixed_point = false
mbonadei9aa3f0a2017-01-24 14:58:22167 if (current_cpu == "arm" || current_cpu == "arm64") {
168 rtc_prefer_fixed_point = true
169 }
170
mbonadei9aa3f0a2017-01-24 14:58:22171 # Determines whether NEON code will be built.
172 rtc_build_with_neon =
173 (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64"
174
175 # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on
176 # all platforms except Android and iOS. Because FFmpeg can be built
Artem Titov22a6b2d2021-07-27 14:25:56177 # with/without H.264 support, `ffmpeg_branding` has to separately be set to a
mbonadei9aa3f0a2017-01-24 14:58:22178 # value that includes H.264, for example "Chrome". If FFmpeg is built without
Artem Titov22a6b2d2021-07-27 14:25:56179 # H.264, compilation succeeds but `H264DecoderImpl` fails to initialize.
mbonadei9aa3f0a2017-01-24 14:58:22180 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING.
181 # http://www.openh264.org, https://www.ffmpeg.org/
Mirko Bonadeiee0a85c2019-01-15 09:47:18182 #
183 # Enabling H264 when building with MSVC is currently not supported, see
184 # bugs.webrtc.org/9213#c13 for more info.
185 rtc_use_h264 =
186 proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang)
mbonadei9aa3f0a2017-01-24 14:58:22187
Markus Handell8e75bd42020-06-05 09:47:40188 # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex.
189 rtc_use_absl_mutex = false
190
mbonadei9aa3f0a2017-01-24 14:58:22191 # By default, use normal platform audio support or dummy audio, but don't
192 # use file-based audio playout and record.
193 rtc_use_dummy_audio_file_devices = false
194
henrika7be78832017-06-13 15:34:16195 # When set to true, replace the audio output with a sinus tone at 440Hz.
196 # The ADM will ask for audio data from WebRTC but instead of reading real
197 # audio samples from NetEQ, a sinus tone will be generated and replace the
198 # real audio samples.
199 rtc_audio_device_plays_sinus_tone = false
200
Anders Carlsson358f2e02018-06-04 08:24:37201 if (is_ios) {
202 # Build broadcast extension in AppRTCMobile for iOS. This results in the
203 # binary only running on iOS 11+, which is why it is disabled by default.
204 rtc_apprtcmobile_broadcast_extension = false
205 }
Anders Carlsson7bca8ca2018-08-30 07:30:29206
Jordan Rose53d3fc92021-07-06 19:16:41207 # Determines whether OpenGL is available on iOS/macOS.
208 rtc_ios_macos_use_opengl_rendering =
209 !(is_ios && target_environment == "catalyst")
210
Jiawei Ou08745302019-02-12 19:36:13211 # When set to false, builtin audio encoder/decoder factories and all the
212 # audio codecs they depend on will not be included in libwebrtc.{a|lib}
213 # (they will still be included in libjingle_peerconnection_so.so and
214 # WebRTC.framework)
215 rtc_include_builtin_audio_codecs = true
216
Mirko Bonadei20574f42019-03-28 06:50:07217 # When set to true and in a standalone build, it will undefine UNICODE and
218 # _UNICODE (which are always defined globally by the Chromium Windows
219 # toolchain).
220 # This is only needed for testing purposes, WebRTC wants to be sure it
221 # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses
222 # wide character functions.
223 rtc_win_undef_unicode = false
Austin Orion25b0dee2020-10-01 20:47:54224
225 # When set to true, a capturer implementation that uses the
Austin Orion66241e42021-04-22 20:22:25226 # Windows.Graphics.Capture APIs will be available for use. This introduces a
227 # dependency on the Win 10 SDK v10.0.17763.0.
Austin Orion78f04d82021-04-23 19:37:26228 rtc_enable_win_wgc = is_win
philipelb09d8722021-11-23 10:00:24229
230 # Includes the dav1d decoder in the internal decoder factory when set to true.
231 rtc_include_dav1d_in_internal_decoder_factory = true
Emil Lundmark6bf20cc2022-09-21 13:20:22232
Emil Lundmark9109e852023-02-28 12:57:01233 # When enabled, a run-time check will make sure that all field trial keys have
234 # been registered in accordance with the field trial policy, see
235 # g3doc/field-trials.md. The value can be set to the following:
236 #
237 # "dcheck": RTC_DCHECKs that the field trial has been registered. RTC_DCHECK
238 # must be enabled separately.
239 #
240 # "warn": RTC_LOGs a message with LS_WARNING severity if the field trial
241 # hasn't been registered.
242 rtc_strict_field_trials = ""
Dan Minor9c686132018-01-15 15:20:00243}
mbonadei9aa3f0a2017-01-24 14:58:22244
Dan Minor9c686132018-01-15 15:20:00245if (!build_with_mozilla) {
246 import("//testing/test.gni")
mbonadei9aa3f0a2017-01-24 14:58:22247}
248
249# A second declare_args block, so that declarations within it can
250# depend on the possibly overridden variables in the first
251# declare_args block.
252declare_args() {
Dan Minor9c686132018-01-15 15:20:00253 # Enables the use of protocol buffers for debug recordings.
254 rtc_enable_protobuf = !build_with_mozilla
255
256 # Set this to disable building with support for SCTP data channels.
257 rtc_enable_sctp = !build_with_mozilla
258
259 # Disable these to not build components which can be externally provided.
260 rtc_build_json = !build_with_mozilla
261 rtc_build_libsrtp = !build_with_mozilla
262 rtc_build_libvpx = !build_with_mozilla
263 rtc_libvpx_build_vp9 = !build_with_mozilla
Dan Minor9c686132018-01-15 15:20:00264 rtc_build_opus = !build_with_mozilla
265 rtc_build_ssl = !build_with_mozilla
Dan Minor9c686132018-01-15 15:20:00266
267 # Enable libevent task queues on platforms that support it.
Mirko Bonadei775c02e2019-06-19 17:05:00268 if (is_win || is_mac || is_ios || is_nacl || is_fuchsia ||
269 target_cpu == "wasm") {
Dan Minor9c686132018-01-15 15:20:00270 rtc_enable_libevent = false
271 rtc_build_libevent = false
272 } else {
273 rtc_enable_libevent = true
274 rtc_build_libevent = !build_with_mozilla
275 }
276
mbonadei9aa3f0a2017-01-24 14:58:22277 # Excluded in Chromium since its prerequisites don't require Pulse Audio.
278 rtc_include_pulse_audio = !build_with_chromium
279
280 # Chromium uses its own IO handling, so the internal ADM is only built for
281 # standalone WebRTC.
282 rtc_include_internal_audio_device = !build_with_chromium
283
Zhaoliang Ma72e43212020-08-17 09:13:41284 # Set this to true to enable the avx2 support in webrtc.
Per Åhgrena43178c2020-09-25 10:02:32285 # TODO: Make sure that AVX2 works also for non-clang compilers.
286 if (is_clang == true) {
287 rtc_enable_avx2 = true
288 } else {
289 rtc_enable_avx2 = false
290 }
Zhaoliang Ma72e43212020-08-17 09:13:41291
Philipp Hancke1a89bc82021-03-02 20:23:24292 # Set this to true to build the unit tests.
293 # Disabled when building with Chromium or Mozilla.
Dan Minor9c686132018-01-15 15:20:00294 rtc_include_tests = !build_with_chromium && !build_with_mozilla
Oleh Prypin240b8932019-06-07 11:27:07295
296 # Set this to false to skip building code that also requires X11 extensions
297 # such as Xdamage, Xfixes.
298 rtc_use_x11_extensions = rtc_use_x11
Artem Titov6a4a1462019-11-26 15:24:46299
300 # Set this to true to fully remove logging from WebRTC.
301 rtc_disable_logging = false
Doudou Kisabaka2dec4962019-11-28 13:24:31302
303 # Set this to true to disable trace events.
304 rtc_disable_trace_events = false
Artem Titov9dc209a2019-11-28 16:09:30305
306 # Set this to true to disable detailed error message and logging for
307 # RTC_CHECKs.
308 rtc_disable_check_msg = false
Ying Wangef3998f2019-12-09 12:06:53309
310 # Set this to true to disable webrtc metrics.
Mirko Bonadei3c4fda22019-12-10 14:02:53311 rtc_disable_metrics = false
sazaaa42ecd2020-04-01 13:24:40312
313 # Set this to true to exclude the transient suppressor in the audio processing
314 # module from the build.
315 rtc_exclude_transient_suppressor = false
mbonadei9aa3f0a2017-01-24 14:58:22316}
317
Florent Castellia80c3e52021-04-15 13:02:56318declare_args() {
Florent Castellia6983c62021-05-06 08:50:07319 # Enable the dcsctp backend for DataChannels and related unittests
320 rtc_build_dcsctp = !build_with_mozilla && rtc_enable_sctp
321
Florent Castelli023be3c2022-03-15 15:01:52322 # Enable gRPC used for negotiation in multiprocess tests
323 rtc_enable_grpc = rtc_enable_protobuf && (is_linux || is_mac)
Florent Castellia80c3e52021-04-15 13:02:56324}
325
mbonadei9aa3f0a2017-01-24 14:58:22326# Make it possible to provide custom locations for some libraries (move these
327# up into declare_args should we need to actually use them for the GN build).
328rtc_libvpx_dir = "//third_party/libvpx"
mbonadei9aa3f0a2017-01-24 14:58:22329rtc_opus_dir = "//third_party/opus"
330
331# Desktop capturer is supported only on Windows, OSX and Linux.
Oleh Prypin240b8932019-06-07 11:27:07332rtc_desktop_capture_supported =
333 (is_win && current_os != "winuwp") || is_mac ||
Hidehiko Abef264e702020-09-10 09:10:11334 ((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire))
mbonadei9aa3f0a2017-01-24 14:58:22335
336###############################################################################
337# Templates
338#
339
Mirko Bonadei92ea95e2017-09-15 04:47:31340# Points to // in webrtc stand-alone or to //third_party/webrtc/ in
mbonadei9aa3f0a2017-01-24 14:58:22341# chromium.
342# We need absolute paths for all configs in templates as they are shared in
343# different subdirectories.
344webrtc_root = get_path_info(".", "abspath")
345
346# Global configuration that should be applied to all WebRTC targets.
347# You normally shouldn't need to include this in your target as it's
348# automatically included when using the rtc_* templates.
349# It sets defines, include paths and compilation warnings accordingly,
350# both for WebRTC stand-alone builds and for the scenario when WebRTC
351# native code is built as part of Chromium.
Mirko Bonadei5f078452021-07-30 20:32:55352rtc_common_configs = [ webrtc_root + ":common_config" ]
mbonadei9aa3f0a2017-01-24 14:58:22353
kthelgasonc0977102017-04-24 07:57:16354if (is_mac || is_ios) {
355 rtc_common_configs += [ "//build/config/compiler:enable_arc" ]
356}
357
mbonadei9aa3f0a2017-01-24 14:58:22358# Global public configuration that should be applied to all WebRTC targets. You
359# normally shouldn't need to include this in your target as it's automatically
360# included when using the rtc_* templates. It set the defines, include paths and
361# compilation warnings that should be propagated to dependents of the targets
362# depending on the target having this config.
363rtc_common_inherited_config = webrtc_root + ":common_inherited_config"
364
365# Common configs to remove or add in all rtc targets.
366rtc_remove_configs = []
Mirko Bonadeifc52b912019-03-01 09:32:56367if (!build_with_chromium && is_clang) {
368 rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
369}
mbonadei9aa3f0a2017-01-24 14:58:22370rtc_add_configs = rtc_common_configs
Mirko Bonadei96ede16a2018-09-06 11:45:44371rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ]
Mirko Bonadei32ce18c2018-09-18 11:15:54372rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ]
mbonadei9aa3f0a2017-01-24 14:58:22373
374set_defaults("rtc_test") {
375 configs = rtc_add_configs
376 suppressed_configs = []
377}
378
Mirko Bonadei86d053c2019-10-17 19:32:04379set_defaults("rtc_library") {
380 configs = rtc_add_configs
381 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 19:23:41382 absl_deps = []
Mirko Bonadei86d053c2019-10-17 19:32:04383}
384
mbonadei9aa3f0a2017-01-24 14:58:22385set_defaults("rtc_source_set") {
386 configs = rtc_add_configs
387 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 19:23:41388 absl_deps = []
mbonadei9aa3f0a2017-01-24 14:58:22389}
390
Mirko Bonadei86d053c2019-10-17 19:32:04391set_defaults("rtc_static_library") {
mbonadei9aa3f0a2017-01-24 14:58:22392 configs = rtc_add_configs
393 suppressed_configs = []
Mirko Bonadei8b7cfa12020-06-03 19:23:41394 absl_deps = []
mbonadei9aa3f0a2017-01-24 14:58:22395}
396
Mirko Bonadei86d053c2019-10-17 19:32:04397set_defaults("rtc_executable") {
mbonadei9aa3f0a2017-01-24 14:58:22398 configs = rtc_add_configs
399 suppressed_configs = []
400}
401
402set_defaults("rtc_shared_library") {
403 configs = rtc_add_configs
404 suppressed_configs = []
405}
406
Per Kjellandera7f2d842018-01-10 15:54:53407webrtc_default_visibility = [ webrtc_root + "/*" ]
408if (build_with_chromium) {
409 # Allow Chromium's WebRTC overrides targets to bypass the regular
410 # visibility restrictions.
411 webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ]
412}
413
Karl Wibergbb23c832018-04-22 17:55:00414# ---- Poisons ----
415#
416# The general idea is that some targets declare that they contain some
417# kind of poison, which makes it impossible for other targets to
418# depend on them (even transitively) unless they declare themselves
419# immune to that particular type of poison.
420#
421# Targets that *contain* poison of type foo should contain the line
422#
423# poisonous = [ "foo" ]
424#
425# and targets that *are immune but arent't themselves poisonous*
426# should contain
427#
428# allow_poison = [ "foo" ]
429#
430# This useful in cases where we have some large target or set of
431# targets and want to ensure that most other targets do not
432# transitively depend on them. For example, almost no high-level
433# target should depend on the audio codecs, since we want WebRTC users
434# to be able to inject any subset of them and actually end up with a
435# binary that doesn't include the codecs they didn't inject.
436#
437# Test-only targets (`testonly` set to true) and non-public targets
438# (`visibility` not containing "*") are automatically immune to all
439# types of poison.
440#
441# Here's the complete list of all types of poison. It must be kept in
442# 1:1 correspondence with the set of //:poison_* targets.
443#
444all_poison_types = [
445 # Encoders and decoders for specific audio codecs such as Opus and iSAC.
446 "audio_codecs",
Anders Carlsson1f433e42018-04-24 14:39:05447
Danil Chapovalov41300af2019-07-10 10:44:43448 # Default task queue implementation.
449 "default_task_queue",
Sam Zackrisson492fdf42019-10-25 08:45:58450
Sam Zackrisson03cb7e52021-12-06 14:40:04451 # Default echo detector implementation.
452 "default_echo_detector",
453
Sam Zackrisson492fdf42019-10-25 08:45:58454 # JSON parsing should not be needed in the "slim and modular" WebRTC.
455 "rtc_json",
456
457 # Software video codecs (VP8 and VP9 through libvpx).
458 "software_video_codecs",
Karl Wibergbb23c832018-04-22 17:55:00459]
460
Mirko Bonadei9a89a492018-05-29 14:22:32461absl_include_config = "//third_party/abseil-cpp:absl_include_config"
462absl_define_config = "//third_party/abseil-cpp:absl_define_config"
463
Mirko Bonadei2ab97f62019-07-18 11:44:12464# Abseil Flags are testonly, so this config will only be applied to WebRTC targets
465# that are testonly.
466absl_flags_config = webrtc_root + ":absl_flags_configs"
467
Mirko Bonadeie99b6cc2020-11-25 15:41:37468# WebRTC wrapper of Chromium's test() template. This template just adds some
469# WebRTC only configuration in order to avoid to duplicate it for every WebRTC
470# target.
471# The parameter `is_xctest` is different from the one in the Chromium's test()
472# template (and it is not forwarded to it). In rtc_test(), the argument
473# `is_xctest` is used to avoid to take dependencies that are not needed
474# in case the test is a real XCTest (using the XCTest framework).
mbonadei9aa3f0a2017-01-24 14:58:22475template("rtc_test") {
476 test(target_name) {
477 forward_variables_from(invoker,
478 "*",
479 [
480 "configs",
Mirko Bonadeie99b6cc2020-11-25 15:41:37481 "is_xctest",
mbonadei9aa3f0a2017-01-24 14:58:22482 "public_configs",
483 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19484 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22485 ])
Mirko Bonadeidd411942017-11-21 14:35:27486
487 # Always override to public because when target_os is Android the `test`
488 # template can override it to [ "*" ] and we want to avoid conditional
489 # visibility.
Mirko Bonadei21558812017-11-21 11:47:34490 visibility = [ "*" ]
mbonadei9aa3f0a2017-01-24 14:58:22491 configs += invoker.configs
492 configs -= rtc_remove_configs
493 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32494 public_configs = [
495 rtc_common_inherited_config,
496 absl_include_config,
497 absl_define_config,
Mirko Bonadei2ab97f62019-07-18 11:44:12498 absl_flags_config,
Mirko Bonadei9a89a492018-05-29 14:22:32499 ]
mbonadei9aa3f0a2017-01-24 14:58:22500 if (defined(invoker.public_configs)) {
501 public_configs += invoker.public_configs
502 }
sakald7fdb802017-05-26 08:51:53503 if (!build_with_chromium && is_android) {
Jianjun Zhu037f3e42017-08-15 13:48:37504 android_manifest = webrtc_root + "test/android/AndroidManifest.xml"
Peter Kotwicz3ceb16e2021-04-14 22:53:11505 use_raw_android_executable = false
Jeremy Leconteb19cfee2020-06-25 20:57:49506 min_sdk_version = 21
Mirko Bonadeibd393b22020-07-10 21:00:41507 target_sdk_version = 23
Mirko Bonadei80939352021-04-12 17:03:37508 deps += [
509 "//build/android/gtest_apk:native_test_instrumentation_test_runner_java",
510 webrtc_root + "test:native_test_java",
511 ]
sakald7fdb802017-05-26 08:51:53512 }
Mirko Bonadeie99b6cc2020-11-25 15:41:37513
Björn Terelius49850c32022-05-04 08:59:56514 # Build //test:google_test_runner_objc when the test is not a real XCTest.
Jeremy Leconteb8ba8c92022-03-15 08:08:29515 if (is_ios && rtc_include_tests) {
Mirko Bonadeie99b6cc2020-11-25 15:41:37516 if (!defined(invoker.is_xctest) || !invoker.is_xctest) {
Björn Terelius49850c32022-05-04 08:59:56517 xctest_module_target = "//test:google_test_runner_objc"
Mirko Bonadeie99b6cc2020-11-25 15:41:37518 }
519 }
Andrey Logvin78646002021-01-29 10:50:19520
521 # If absl_deps is [], no action is needed. If not [], then it needs to be
522 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
523 # otherwise it just needs to be added to deps.
524 if (defined(absl_deps) && absl_deps != []) {
525 if (!defined(deps)) {
526 deps = []
527 }
528 if (build_with_chromium) {
529 deps += [ "//third_party/abseil-cpp:absl" ]
530 } else {
531 deps += absl_deps
532 }
533 }
534
Jeremy Leconted15f3e12022-02-18 09:16:32535 # TODO(crbug.com/webrtc/13556): Adding the .app folder in the runtime_deps
536 # shoulnd't be necessary. this code should be removed and the same solution
537 # as Chromium should be used.
538 if (is_ios) {
539 if (!defined(invoker.data)) {
540 data = []
541 }
542 data += [ "${root_out_dir}/${target_name}.app" ]
543 }
mbonadei9aa3f0a2017-01-24 14:58:22544 }
545}
546
547template("rtc_source_set") {
548 source_set(target_name) {
549 forward_variables_from(invoker,
550 "*",
551 [
552 "configs",
553 "public_configs",
554 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19555 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22556 ])
Karl Wiberg138d4ac2017-10-16 09:16:19557 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53558 if (!defined(visibility)) {
559 visibility = webrtc_default_visibility
560 }
Karl Wibergbb23c832018-04-22 17:55:00561
562 # What's your poison?
563 if (defined(testonly) && testonly) {
564 assert(!defined(poisonous))
565 assert(!defined(allow_poison))
566 } else {
567 if (!defined(poisonous)) {
568 poisonous = []
569 }
570 if (!defined(allow_poison)) {
571 allow_poison = []
572 }
573 if (!defined(assert_no_deps)) {
574 assert_no_deps = []
575 }
576 if (!defined(deps)) {
577 deps = []
578 }
579 foreach(p, poisonous) {
580 deps += [ webrtc_root + ":poison_" + p ]
581 }
582 foreach(poison_type, all_poison_types) {
583 allow_dep = true
584 foreach(v, visibility) {
585 if (v == "*") {
586 allow_dep = false
587 }
588 }
589 foreach(p, allow_poison + poisonous) {
590 if (p == poison_type) {
591 allow_dep = true
592 }
593 }
594 if (!allow_dep) {
595 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
596 }
597 }
598 }
599
Mirko Bonadei92dd35d2019-11-15 15:08:41600 # Chromium should only depend on the WebRTC component in order to
601 # avoid to statically link WebRTC in a component build.
602 if (build_with_chromium) {
603 publicly_visible = false
604 foreach(v, visibility) {
605 if (v == "*") {
606 publicly_visible = true
607 }
608 }
609 if (publicly_visible) {
610 visibility = []
611 visibility = webrtc_default_visibility
612 }
613 }
614
Mirko Bonadei96ede16a2018-09-06 11:45:44615 if (!defined(testonly) || !testonly) {
616 configs += rtc_prod_configs
617 }
618
mbonadei9aa3f0a2017-01-24 14:58:22619 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 11:15:54620 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 14:58:22621 configs -= rtc_remove_configs
622 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32623 public_configs = [
624 rtc_common_inherited_config,
625 absl_include_config,
626 absl_define_config,
627 ]
Mirko Bonadei2ab97f62019-07-18 11:44:12628 if (defined(testonly) && testonly) {
629 public_configs += [ absl_flags_config ]
630 }
mbonadei9aa3f0a2017-01-24 14:58:22631 if (defined(invoker.public_configs)) {
632 public_configs += invoker.public_configs
633 }
Mirko Bonadei8b7cfa12020-06-03 19:23:41634
Mirko Bonadei96115cf2020-06-23 21:39:56635 # If absl_deps is [], no action is needed. If not [], then it needs to be
636 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 19:23:41637 # otherwise it just needs to be added to deps.
638 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 12:30:41639 if (!defined(deps)) {
640 deps = []
641 }
Mirko Bonadei08ce9862020-06-11 09:25:32642 if (build_with_chromium) {
643 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 19:23:41644 } else {
645 deps += absl_deps
646 }
647 }
mbonadei9aa3f0a2017-01-24 14:58:22648 }
649}
650
mbonadei9aa3f0a2017-01-24 14:58:22651template("rtc_static_library") {
652 static_library(target_name) {
653 forward_variables_from(invoker,
654 "*",
655 [
656 "configs",
657 "public_configs",
658 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19659 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22660 ])
Karl Wiberg138d4ac2017-10-16 09:16:19661 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53662 if (!defined(visibility)) {
663 visibility = webrtc_default_visibility
664 }
Karl Wibergbb23c832018-04-22 17:55:00665
666 # What's your poison?
667 if (defined(testonly) && testonly) {
668 assert(!defined(poisonous))
669 assert(!defined(allow_poison))
670 } else {
671 if (!defined(poisonous)) {
672 poisonous = []
673 }
674 if (!defined(allow_poison)) {
675 allow_poison = []
676 }
677 if (!defined(assert_no_deps)) {
678 assert_no_deps = []
679 }
680 if (!defined(deps)) {
681 deps = []
682 }
683 foreach(p, poisonous) {
684 deps += [ webrtc_root + ":poison_" + p ]
685 }
686 foreach(poison_type, all_poison_types) {
687 allow_dep = true
688 foreach(v, visibility) {
689 if (v == "*") {
690 allow_dep = false
691 }
692 }
693 foreach(p, allow_poison + poisonous) {
694 if (p == poison_type) {
695 allow_dep = true
696 }
697 }
698 if (!allow_dep) {
699 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
700 }
701 }
702 }
703
Mirko Bonadei96ede16a2018-09-06 11:45:44704 if (!defined(testonly) || !testonly) {
705 configs += rtc_prod_configs
706 }
707
mbonadei9aa3f0a2017-01-24 14:58:22708 configs += invoker.configs
Mirko Bonadei32ce18c2018-09-18 11:15:54709 configs += rtc_library_impl_config
mbonadei9aa3f0a2017-01-24 14:58:22710 configs -= rtc_remove_configs
711 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32712 public_configs = [
713 rtc_common_inherited_config,
714 absl_include_config,
715 absl_define_config,
716 ]
Mirko Bonadei2ab97f62019-07-18 11:44:12717 if (defined(testonly) && testonly) {
718 public_configs += [ absl_flags_config ]
719 }
mbonadei9aa3f0a2017-01-24 14:58:22720 if (defined(invoker.public_configs)) {
721 public_configs += invoker.public_configs
722 }
Mirko Bonadei8b7cfa12020-06-03 19:23:41723
Mirko Bonadei96115cf2020-06-23 21:39:56724 # If absl_deps is [], no action is needed. If not [], then it needs to be
725 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 19:23:41726 # otherwise it just needs to be added to deps.
727 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 12:30:41728 if (!defined(deps)) {
729 deps = []
730 }
Mirko Bonadei08ce9862020-06-11 09:25:32731 if (build_with_chromium) {
732 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 19:23:41733 } else {
734 deps += absl_deps
735 }
736 }
mbonadei9aa3f0a2017-01-24 14:58:22737 }
738}
739
Mirko Bonadei86d053c2019-10-17 19:32:04740# This template automatically switches the target type between source_set
741# and static_library.
742#
Florent Castelli87b6e7b2022-04-26 00:22:35743# This should be the default target type for all the WebRTC targets.
Mirko Bonadei86d053c2019-10-17 19:32:04744#
745# How does it work:
746# Since all files in a source_set are linked into a final binary, while files
747# in a static library are only linked in if at least one symbol in them is
748# referenced, in component builds source_sets are easy to deal with because
749# all their object files are passed to the linker to create a shared library.
750# In release builds instead, static_libraries are preferred since they allow
751# the linker to discard dead code.
752# For the same reason, testonly targets will always be expanded to
753# source_set in order to be sure that tests are present in the test binary.
754template("rtc_library") {
Florent Castelli87b6e7b2022-04-26 00:22:35755 header_only = true
756 if (defined(invoker.sources)) {
757 non_header_sources = filter_exclude(invoker.sources,
758 [
759 "*.h",
760 "*.hh",
761 "*.inc",
762 ])
763 if (non_header_sources != []) {
764 header_only = false
765 }
766 }
767
768 # Header only libraries should use source_set as a static_library with no
769 # source files will cause issues with macOS libtool.
770 if (header_only || is_component_build ||
771 (defined(invoker.testonly) && invoker.testonly)) {
Mirko Bonadei86d053c2019-10-17 19:32:04772 target_type = "source_set"
773 } else {
774 target_type = "static_library"
775 }
776 target(target_type, target_name) {
777 forward_variables_from(invoker,
778 "*",
779 [
780 "configs",
781 "public_configs",
782 "suppressed_configs",
783 "visibility",
784 ])
785 forward_variables_from(invoker, [ "visibility" ])
786 if (!defined(visibility)) {
787 visibility = webrtc_default_visibility
788 }
789
790 # What's your poison?
791 if (defined(testonly) && testonly) {
792 assert(!defined(poisonous))
793 assert(!defined(allow_poison))
794 } else {
795 if (!defined(poisonous)) {
796 poisonous = []
797 }
798 if (!defined(allow_poison)) {
799 allow_poison = []
800 }
801 if (!defined(assert_no_deps)) {
802 assert_no_deps = []
803 }
804 if (!defined(deps)) {
805 deps = []
806 }
807 foreach(p, poisonous) {
808 deps += [ webrtc_root + ":poison_" + p ]
809 }
810 foreach(poison_type, all_poison_types) {
811 allow_dep = true
812 foreach(v, visibility) {
813 if (v == "*") {
814 allow_dep = false
815 }
816 }
817 foreach(p, allow_poison + poisonous) {
818 if (p == poison_type) {
819 allow_dep = true
820 }
821 }
822 if (!allow_dep) {
823 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
824 }
825 }
826 }
827
Mirko Bonadei92dd35d2019-11-15 15:08:41828 # Chromium should only depend on the WebRTC component in order to
829 # avoid to statically link WebRTC in a component build.
830 if (build_with_chromium) {
831 publicly_visible = false
832 foreach(v, visibility) {
833 if (v == "*") {
834 publicly_visible = true
835 }
836 }
837 if (publicly_visible) {
838 visibility = []
839 visibility = webrtc_default_visibility
840 }
841 }
842
Mirko Bonadei86d053c2019-10-17 19:32:04843 if (!defined(testonly) || !testonly) {
844 configs += rtc_prod_configs
845 }
846
847 configs += invoker.configs
848 configs += rtc_library_impl_config
849 configs -= rtc_remove_configs
850 configs -= invoker.suppressed_configs
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 }
Mirko Bonadei8b7cfa12020-06-03 19:23:41862
Mirko Bonadei96115cf2020-06-23 21:39:56863 # If absl_deps is [], no action is needed. If not [], then it needs to be
864 # converted to //third_party/abseil-cpp:absl when build_with_chromium=true
Mirko Bonadei8b7cfa12020-06-03 19:23:41865 # otherwise it just needs to be added to deps.
866 if (absl_deps != []) {
Mirko Bonadei2dcf3482020-06-05 12:30:41867 if (!defined(deps)) {
868 deps = []
869 }
Mirko Bonadei08ce9862020-06-11 09:25:32870 if (build_with_chromium) {
871 deps += [ "//third_party/abseil-cpp:absl" ]
Mirko Bonadei8b7cfa12020-06-03 19:23:41872 } else {
873 deps += absl_deps
874 }
875 }
Mirko Bonadei86d053c2019-10-17 19:32:04876 }
877}
878
879template("rtc_executable") {
880 executable(target_name) {
881 forward_variables_from(invoker,
882 "*",
883 [
884 "deps",
885 "configs",
886 "public_configs",
887 "suppressed_configs",
888 "visibility",
889 ])
890 forward_variables_from(invoker, [ "visibility" ])
891 if (!defined(visibility)) {
892 visibility = webrtc_default_visibility
893 }
894 configs += invoker.configs
895 configs -= rtc_remove_configs
896 configs -= invoker.suppressed_configs
897 deps = invoker.deps
898
899 public_configs = [
900 rtc_common_inherited_config,
901 absl_include_config,
902 absl_define_config,
903 ]
904 if (defined(testonly) && testonly) {
905 public_configs += [ absl_flags_config ]
906 }
907 if (defined(invoker.public_configs)) {
908 public_configs += invoker.public_configs
909 }
910 if (is_win) {
911 deps += [
912 # Give executables the default manifest on Windows (a no-op elsewhere).
913 "//build/win:default_exe_manifest",
914 ]
915 }
916 }
917}
918
mbonadei9aa3f0a2017-01-24 14:58:22919template("rtc_shared_library") {
920 shared_library(target_name) {
921 forward_variables_from(invoker,
922 "*",
923 [
924 "configs",
925 "public_configs",
926 "suppressed_configs",
Karl Wiberg138d4ac2017-10-16 09:16:19927 "visibility",
mbonadei9aa3f0a2017-01-24 14:58:22928 ])
Karl Wiberg138d4ac2017-10-16 09:16:19929 forward_variables_from(invoker, [ "visibility" ])
Per Kjellandera7f2d842018-01-10 15:54:53930 if (!defined(visibility)) {
931 visibility = webrtc_default_visibility
932 }
Karl Wibergbb23c832018-04-22 17:55:00933
934 # What's your poison?
935 if (defined(testonly) && testonly) {
936 assert(!defined(poisonous))
937 assert(!defined(allow_poison))
938 } else {
939 if (!defined(poisonous)) {
940 poisonous = []
941 }
942 if (!defined(allow_poison)) {
943 allow_poison = []
944 }
945 if (!defined(assert_no_deps)) {
946 assert_no_deps = []
947 }
948 if (!defined(deps)) {
949 deps = []
950 }
951 foreach(p, poisonous) {
952 deps += [ webrtc_root + ":poison_" + p ]
953 }
954 foreach(poison_type, all_poison_types) {
955 allow_dep = true
956 foreach(v, visibility) {
957 if (v == "*") {
958 allow_dep = false
959 }
960 }
961 foreach(p, allow_poison + poisonous) {
962 if (p == poison_type) {
963 allow_dep = true
964 }
965 }
966 if (!allow_dep) {
967 assert_no_deps += [ webrtc_root + ":poison_" + poison_type ]
968 }
969 }
970 }
971
mbonadei9aa3f0a2017-01-24 14:58:22972 configs += invoker.configs
973 configs -= rtc_remove_configs
974 configs -= invoker.suppressed_configs
Mirko Bonadei9a89a492018-05-29 14:22:32975 public_configs = [
976 rtc_common_inherited_config,
977 absl_include_config,
978 absl_define_config,
979 ]
Mirko Bonadei2ab97f62019-07-18 11:44:12980 if (defined(testonly) && testonly) {
981 public_configs += [ absl_flags_config ]
982 }
mbonadei9aa3f0a2017-01-24 14:58:22983 if (defined(invoker.public_configs)) {
984 public_configs += invoker.public_configs
985 }
986 }
987}
kthelgason4065a5762017-02-14 12:58:56988
Byoungchan Lee26b23b82022-04-08 09:23:14989if (is_mac || is_ios) {
990 template("apple_framework_bundle_with_umbrella_header") {
Anders Carlssondc6b4772018-01-15 12:31:03991 forward_variables_from(invoker, [ "output_name" ])
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28992 this_target_name = target_name
Anders Carlssondc6b4772018-01-15 12:31:03993 umbrella_header_path =
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28994 "$target_gen_dir/$output_name.framework/WebRTC/$output_name.h"
Byoungchan Lee26b23b82022-04-08 09:23:14995 modulemap_path = "$target_gen_dir/Modules/module.modulemap"
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:28996
997 action_foreach("create_bracket_include_headers_$target_name") {
998 script = "//tools_webrtc/apple/copy_framework_header.py"
999 sources = invoker.sources
1000 output_name = invoker.output_name
1001 outputs = [
1002 "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}",
1003 ]
1004 args = [
1005 "--input",
1006 "{{source}}",
1007 "--output",
1008 rebase_path(target_gen_dir, root_build_dir) +
1009 "/$output_name.framework/WebRTC/{{source_file_part}}",
1010 ]
1011 }
Anders Carlssondc6b4772018-01-15 12:31:031012
Byoungchan Lee26b23b82022-04-08 09:23:141013 if (is_mac) {
1014 mac_framework_bundle(target_name) {
1015 forward_variables_from(invoker, "*", [ "configs" ])
1016 if (defined(invoker.configs)) {
1017 configs += invoker.configs
1018 }
1019
1020 framework_version = "A"
1021 framework_contents = [
1022 "Headers",
1023 "Modules",
1024 "Resources",
1025 ]
1026
1027 ldflags = [
1028 "-all_load",
1029 "-install_name",
1030 "@rpath/$output_name.framework/$output_name",
1031 ]
1032
1033 deps += [
1034 ":copy_framework_headers_$this_target_name",
1035 ":copy_modulemap_$this_target_name",
1036 ":copy_umbrella_header_$this_target_name",
1037 ":create_bracket_include_headers_$this_target_name",
1038 ":modulemap_$this_target_name",
1039 ":umbrella_header_$this_target_name",
1040 ]
1041 }
1042 }
1043 if (is_ios) {
1044 ios_framework_bundle(target_name) {
1045 forward_variables_from(invoker,
1046 "*",
1047 [
1048 "configs",
1049 "public_headers",
1050 ])
1051 if (defined(invoker.configs)) {
1052 configs += invoker.configs
1053 }
1054 public_headers = get_target_outputs(
1055 ":create_bracket_include_headers_$this_target_name")
1056
1057 deps += [
1058 ":copy_umbrella_header_$this_target_name",
1059 ":create_bracket_include_headers_$this_target_name",
1060 ]
1061 }
Anders Carlssondc6b4772018-01-15 12:31:031062 }
1063
Byoungchan Lee26b23b82022-04-08 09:23:141064 if (is_mac || target_environment == "catalyst") {
Jordan Rose53d3fc92021-07-06 19:16:411065 # Catalyst frameworks use the same layout as regular Mac frameworks.
1066 headers_dir = "Versions/A/Headers"
1067 } else {
1068 headers_dir = "Headers"
1069 }
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281070
Anders Carlsson95c56ee2018-09-06 13:48:171071 bundle_data("copy_framework_headers_$this_target_name") {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281072 sources = get_target_outputs(
1073 ":create_bracket_include_headers_$this_target_name")
Anders Carlsson37bbf792018-09-05 14:29:271074
Mirko Bonadeiccbe95f2020-01-21 11:10:101075 outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281076 deps = [ ":create_bracket_include_headers_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 14:29:271077 }
1078
Joel Sutherlandd2fb1bf2018-10-02 20:08:251079 action("modulemap_$this_target_name") {
1080 script = "//tools_webrtc/ios/generate_modulemap.py"
1081 args = [
1082 "--out",
1083 rebase_path(modulemap_path, root_build_dir),
1084 "--name",
1085 output_name,
1086 ]
Mirko Bonadeiccbe95f2020-01-21 11:10:101087 outputs = [ modulemap_path ]
Joel Sutherlandd2fb1bf2018-10-02 20:08:251088 }
1089
1090 bundle_data("copy_modulemap_$this_target_name") {
Mirko Bonadeiccbe95f2020-01-21 11:10:101091 sources = [ modulemap_path ]
1092 outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ]
1093 deps = [ ":modulemap_$this_target_name" ]
Joel Sutherlandd2fb1bf2018-10-02 20:08:251094 }
1095
Anders Carlsson95c56ee2018-09-06 13:48:171096 action("umbrella_header_$this_target_name") {
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281097 sources = get_target_outputs(
1098 ":create_bracket_include_headers_$this_target_name")
Anders Carlsson37bbf792018-09-05 14:29:271099
1100 script = "//tools_webrtc/ios/generate_umbrella_header.py"
1101
Mirko Bonadeiccbe95f2020-01-21 11:10:101102 outputs = [ umbrella_header_path ]
Anders Carlsson37bbf792018-09-05 14:29:271103 args = [
1104 "--out",
1105 rebase_path(umbrella_header_path, root_build_dir),
1106 "--sources",
1107 ] + sources
Daniel.L (Byoungchan Lee)32026ed2020-10-16 22:49:281108 deps = [ ":create_bracket_include_headers_$this_target_name" ]
Anders Carlsson37bbf792018-09-05 14:29:271109 }
1110
Byoungchan Lee26b23b82022-04-08 09:23:141111 copy("copy_umbrella_header_$target_name") {
Mirko Bonadeiccbe95f2020-01-21 11:10:101112 sources = [ umbrella_header_path ]
Byoungchan Lee26b23b82022-04-08 09:23:141113 outputs =
1114 [ "$root_out_dir/$output_name.framework/$headers_dir/$output_name.h" ]
Anders Carlsson37bbf792018-09-05 14:29:271115
Byoungchan Lee26b23b82022-04-08 09:23:141116 deps = [ ":umbrella_header_$target_name" ]
Anders Carlsson37bbf792018-09-05 14:29:271117 }
1118 }
1119}
1120
Mirko Bonadeifbb3b7d2017-11-07 15:36:331121if (is_android) {
1122 template("rtc_android_library") {
1123 android_library(target_name) {
1124 forward_variables_from(invoker,
1125 "*",
1126 [
1127 "configs",
1128 "public_configs",
1129 "suppressed_configs",
1130 "visibility",
1131 ])
1132
Oleh Prypin05aee742018-11-23 16:29:441133 errorprone_args = []
Sami Kalliomäkie7fac682018-03-20 15:32:491134
Mirko Bonadeifbb3b7d2017-11-07 15:36:331135 # Treat warnings as errors.
Oleh Prypin05aee742018-11-23 16:29:441136 errorprone_args += [ "-Werror" ]
Sami Kalliomäkie7fac682018-03-20 15:32:491137
1138 # Add any arguments defined by the invoker.
Oleh Prypin05aee742018-11-23 16:29:441139 if (defined(invoker.errorprone_args)) {
1140 errorprone_args += invoker.errorprone_args
Sami Kalliomäkie7fac682018-03-20 15:32:491141 }
Mirko Bonadeifbb3b7d2017-11-07 15:36:331142
Sami Kalliomäkidc526512018-03-27 15:07:271143 if (!defined(deps)) {
1144 deps = []
1145 }
Sami Kalliomäkidc526512018-03-27 15:07:271146
Mirko Bonadeifbb3b7d2017-11-07 15:36:331147 no_build_hooks = true
Mirko Bonadei8b7cfa12020-06-03 19:23:411148 not_needed([ "android_manifest" ])
Mirko Bonadeifbb3b7d2017-11-07 15:36:331149 }
1150 }
1151
1152 template("rtc_android_apk") {
1153 android_apk(target_name) {
1154 forward_variables_from(invoker,
1155 "*",
1156 [
1157 "configs",
1158 "public_configs",
1159 "suppressed_configs",
1160 "visibility",
1161 ])
1162
1163 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 11:10:081164 errorprone_args = []
1165 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 15:07:271166
1167 if (!defined(deps)) {
1168 deps = []
1169 }
Sami Kalliomäkidc526512018-03-27 15:07:271170
Mirko Bonadeifbb3b7d2017-11-07 15:36:331171 no_build_hooks = true
1172 }
1173 }
1174
1175 template("rtc_instrumentation_test_apk") {
1176 instrumentation_test_apk(target_name) {
1177 forward_variables_from(invoker,
1178 "*",
1179 [
1180 "configs",
1181 "public_configs",
1182 "suppressed_configs",
1183 "visibility",
1184 ])
1185
1186 # Treat warnings as errors.
Yves Gerey2f385d22019-11-20 11:10:081187 errorprone_args = []
1188 errorprone_args += [ "-Werror" ]
Sami Kalliomäkidc526512018-03-27 15:07:271189
1190 if (!defined(deps)) {
1191 deps = []
1192 }
Sami Kalliomäkidc526512018-03-27 15:07:271193
Mirko Bonadeifbb3b7d2017-11-07 15:36:331194 no_build_hooks = true
1195 }
1196 }
1197}