mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 1 | # 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. |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 8 | import("//build/config/arm.gni") |
| 9 | import("//build/config/features.gni") |
| 10 | import("//build/config/mips.gni") |
Maksim Sisov | ef4d0b6 | 2021-09-20 06:02:01 | [diff] [blame] | 11 | import("//build/config/ozone.gni") |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 12 | import("//build/config/sanitizers/sanitizers.gni") |
Tomas Popela | 318da51 | 2018-11-13 05:32:23 | [diff] [blame] | 13 | import("//build/config/sysroot.gni") |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 14 | import("//build_overrides/build.gni") |
mbonadei | 9660627 | 2017-03-04 03:41:59 | [diff] [blame] | 15 | |
| 16 | if (!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 Linderborg | 0d2dc1f | 2021-07-14 14:02:11 | [diff] [blame] | 26 | "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md") |
mbonadei | 9660627 | 2017-03-04 03:41:59 | [diff] [blame] | 27 | assert(!is_component_build, "Component builds are not supported in WebRTC.") |
| 28 | } |
| 29 | |
kthelgason | 4065a576 | 2017-02-14 12:58:56 | [diff] [blame] | 30 | if (is_ios) { |
| 31 | import("//build/config/ios/rules.gni") |
| 32 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 33 | |
Anders Carlsson | 37bbf79 | 2018-09-05 14:29:27 | [diff] [blame] | 34 | if (is_mac) { |
| 35 | import("//build/config/mac/rules.gni") |
| 36 | } |
| 37 | |
Christoffer Jansson | 25e4156 | 2022-09-23 06:38:54 | [diff] [blame] | 38 | if (is_fuchsia) { |
| 39 | import("//build/config/fuchsia/config.gni") |
| 40 | } |
| 41 | |
Mirko Bonadei | e3b4263 | 2024-03-27 12:13:52 | [diff] [blame] | 42 | if (build_with_chromium) { |
| 43 | import("//media/media_options.gni") |
| 44 | } |
| 45 | |
Mirko Bonadei | 5f07845 | 2021-07-30 20:32:55 | [diff] [blame] | 46 | # This declare_args is separated from the next one because args declared |
| 47 | # in this one, can be read from the next one (args defined in the same |
| 48 | # declare_args cannot be referenced in that scope). |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 49 | declare_args() { |
Mirko Bonadei | 028248c | 2018-10-10 10:19:02 | [diff] [blame] | 50 | # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h) |
| 51 | # expand to code that will manage symbols visibility. |
| 52 | rtc_enable_symbol_export = false |
Mirko Bonadei | 5f07845 | 2021-07-30 20:32:55 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | declare_args() { |
Mirko Bonadei | 339965f | 2021-10-12 11:23:44 | [diff] [blame] | 56 | # Setting this to true, will make RTC_DLOG() expand to log statements instead |
Mirko Bonadei | 56ed468 | 2021-10-12 06:55:42 | [diff] [blame] | 57 | # of being removed by the preprocessor. |
| 58 | # This is useful for example to be able to get RTC_DLOGs on a release build. |
| 59 | rtc_dlog_always_on = false |
| 60 | |
Peter Kasting | 1e6d77c | 2023-03-13 23:01:00 | [diff] [blame] | 61 | # Enables additional build targets that rely on |
| 62 | # //third_party/google_benchmarks. |
| 63 | rtc_enable_google_benchmarks = true |
| 64 | |
Mirko Bonadei | 5f07845 | 2021-07-30 20:32:55 | [diff] [blame] | 65 | # Setting this to true will make RTC_OBJC_EXPORT expand to code that will |
| 66 | # manage symbols visibility. By default, Obj-C/Obj-C++ symbols are exported |
| 67 | # if C++ symbols are but setting this arg to true while keeping |
| 68 | # rtc_enable_symbol_export=false will only export RTC_OBJC_EXPORT |
| 69 | # annotated symbols. |
| 70 | rtc_enable_objc_symbol_export = rtc_enable_symbol_export |
Mirko Bonadei | 028248c | 2018-10-10 10:19:02 | [diff] [blame] | 71 | |
Mirko Bonadei | 31b0b45 | 2018-08-22 08:37:11 | [diff] [blame] | 72 | # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which |
Mirko Bonadei | 7040090 | 2018-08-21 13:44:28 | [diff] [blame] | 73 | # will tell the pre-processor to remove the default definition of symbols |
| 74 | # needed to use field_trial. In that case a new implementation needs to be |
| 75 | # provided. |
Mirko Bonadei | 31b0b45 | 2018-08-22 08:37:11 | [diff] [blame] | 76 | if (build_with_chromium) { |
| 77 | # When WebRTC is built as part of Chromium it should exclude the default |
| 78 | # implementation of field_trial unless it is building for NACL or |
| 79 | # Chromecast. |
Ryan Keane | cf7802d | 2022-06-10 21:33:18 | [diff] [blame] | 80 | rtc_exclude_field_trial_default = !is_nacl && !is_castos && !is_cast_android |
Mirko Bonadei | 31b0b45 | 2018-08-22 08:37:11 | [diff] [blame] | 81 | } else { |
| 82 | rtc_exclude_field_trial_default = false |
| 83 | } |
Mirko Bonadei | 7040090 | 2018-08-21 13:44:28 | [diff] [blame] | 84 | |
Mirko Bonadei | 906add4 | 2018-09-05 14:03:16 | [diff] [blame] | 85 | # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which |
| 86 | # will tell the pre-processor to remove the default definition of symbols |
| 87 | # needed to use metrics. In that case a new implementation needs to be |
| 88 | # provided. |
| 89 | rtc_exclude_metrics_default = build_with_chromium |
| 90 | |
Johannes Kron | da20c73 | 2021-02-19 15:39:41 | [diff] [blame] | 91 | # Setting this to true will define WEBRTC_EXCLUDE_SYSTEM_TIME which |
| 92 | # will tell the pre-processor to remove the default definition of the |
| 93 | # SystemTimeNanos() which is defined in rtc_base/system_time.cc. In |
| 94 | # that case a new implementation needs to be provided. |
Johannes Kron | bb52bdf | 2021-02-25 09:10:08 | [diff] [blame] | 95 | rtc_exclude_system_time = build_with_chromium |
Johannes Kron | da20c73 | 2021-02-19 15:39:41 | [diff] [blame] | 96 | |
Benjamin Wright | d6f86e8 | 2018-05-08 20:12:25 | [diff] [blame] | 97 | # Setting this to false will require the API user to pass in their own |
| 98 | # SSLCertificateVerifier to verify the certificates presented from a |
| 99 | # TLS-TURN server. In return disabling this saves around 100kb in the binary. |
| 100 | rtc_builtin_ssl_root_certificates = true |
| 101 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 102 | # Disable this to avoid building the Opus audio codec. |
| 103 | rtc_include_opus = true |
| 104 | |
minyue | 2e03c66 | 2017-02-02 01:31:11 | [diff] [blame] | 105 | # Enable this if the Opus version upon which WebRTC is built supports direct |
| 106 | # encoding of 120 ms packets. |
minyue-webrtc | 516711c | 2017-07-27 15:45:49 | [diff] [blame] | 107 | rtc_opus_support_120ms_ptime = true |
minyue | 2e03c66 | 2017-02-02 01:31:11 | [diff] [blame] | 108 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 109 | # Enable this to let the Opus audio codec change complexity on the fly. |
| 110 | rtc_opus_variable_complexity = false |
| 111 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 112 | # Used to specify an external Jsoncpp include path when not compiling the |
| 113 | # library that comes with WebRTC (i.e. rtc_build_json == 0). |
| 114 | rtc_jsoncpp_root = "//third_party/jsoncpp/source/include" |
| 115 | |
| 116 | # Used to specify an external OpenSSL include path when not compiling the |
| 117 | # library that comes with WebRTC (i.e. rtc_build_ssl == 0). |
| 118 | rtc_ssl_root = "" |
| 119 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 120 | # Enable when an external authentication mechanism is used for performing |
| 121 | # packet authentication for RTP packets instead of libsrtp. |
| 122 | rtc_enable_external_auth = build_with_chromium |
| 123 | |
| 124 | # Selects whether debug dumps for the audio processing module |
| 125 | # should be generated. |
| 126 | apm_debug_dump = false |
| 127 | |
Per Åhgren | cc73ed3 | 2020-04-26 21:56:17 | [diff] [blame] | 128 | # Selects whether the audio processing module should be excluded. |
| 129 | rtc_exclude_audio_processing_module = false |
| 130 | |
Joachim Bauch | 93e9134 | 2017-12-07 00:25:53 | [diff] [blame] | 131 | # Set this to false to skip building examples. |
| 132 | rtc_build_examples = true |
| 133 | |
| 134 | # Set this to false to skip building tools. |
| 135 | rtc_build_tools = true |
| 136 | |
Joachim Bauch | 75f18fca | 2017-12-20 20:25:47 | [diff] [blame] | 137 | # Set this to false to skip building code that requires X11. |
Maksim Sisov | ef4d0b6 | 2021-09-20 06:02:01 | [diff] [blame] | 138 | rtc_use_x11 = ozone_platform_x11 |
Joachim Bauch | 75f18fca | 2017-12-20 20:25:47 | [diff] [blame] | 139 | |
Tomas Popela | 318da51 | 2018-11-13 05:32:23 | [diff] [blame] | 140 | # Set this to use PipeWire on the Wayland display server. |
Tomas Popela | 762543f | 2018-12-12 13:37:51 | [diff] [blame] | 141 | # By default it's only enabled on desktop Linux (excludes ChromeOS) and |
| 142 | # only when using the sysroot as PipeWire is not available in older and |
| 143 | # supported Ubuntu and Debian distributions. |
Artem Titov | 4d6a76d | 2021-09-03 10:07:20 | [diff] [blame] | 144 | rtc_use_pipewire = is_linux && use_sysroot |
Tomas Popela | 762543f | 2018-12-12 13:37:51 | [diff] [blame] | 145 | |
Jan Grulich | e1e05af | 2021-09-21 18:36:16 | [diff] [blame] | 146 | # Set this to link PipeWire and required libraries directly instead of using the dlopen. |
Tomas Popela | 762543f | 2018-12-12 13:37:51 | [diff] [blame] | 147 | rtc_link_pipewire = false |
Tomas Popela | 318da51 | 2018-11-13 05:32:23 | [diff] [blame] | 148 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 149 | # Enable to use the Mozilla internal settings. |
| 150 | build_with_mozilla = false |
| 151 | |
Philipp Hancke | e95ebda | 2020-09-17 14:13:20 | [diff] [blame] | 152 | # Experimental: enable use of Android AAudio which requires Android SDK 26 or above |
| 153 | # and NDK r16 or above. |
henrika | 883d00f | 2018-03-16 09:09:49 | [diff] [blame] | 154 | rtc_enable_android_aaudio = false |
| 155 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 156 | # Set to "func", "block", "edge" for coverage generation. |
| 157 | # At unit test runtime set UBSAN_OPTIONS="coverage=1". |
| 158 | # It is recommend to set include_examples=0. |
| 159 | # Use llvm's sancov -html-report for human readable reports. |
| 160 | # See http://clang.llvm.org/docs/SanitizerCoverage.html . |
| 161 | rtc_sanitize_coverage = "" |
| 162 | |
Philipp Hancke | aeac9f8 | 2020-09-11 09:58:18 | [diff] [blame] | 163 | # Selects fixed-point code where possible. |
| 164 | rtc_prefer_fixed_point = false |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 165 | if (current_cpu == "arm" || current_cpu == "arm64") { |
| 166 | rtc_prefer_fixed_point = true |
| 167 | } |
| 168 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 169 | # Determines whether NEON code will be built. |
| 170 | rtc_build_with_neon = |
| 171 | (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64" |
| 172 | |
Mosa Morosev | b300a9c | 2025-02-19 11:36:21 | [diff] [blame] | 173 | # Enable this to build OpenH264 encoder/FFmpeg decoder. When building WebRTC |
| 174 | # as part of Chromium, this is delegated to `media_use_openh264`. When |
| 175 | # building WebRTC as a standalone library, this is supported on all platforms |
| 176 | # except Android and iOS. Because FFmpeg can be built with/without H.264 |
| 177 | # support, `ffmpeg_branding` has to separately be set to a value that |
| 178 | # includes H.264, for example "Chrome". If FFmpeg is built without H.264, |
| 179 | # compilation succeeds but `H264DecoderImpl` fails to initialize. |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 180 | # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. |
| 181 | # http://www.openh264.org, https://www.ffmpeg.org/ |
Mirko Bonadei | ee0a85c | 2019-01-15 09:47:18 | [diff] [blame] | 182 | # |
| 183 | # Enabling H264 when building with MSVC is currently not supported, see |
| 184 | # bugs.webrtc.org/9213#c13 for more info. |
Mosa Morosev | b300a9c | 2025-02-19 11:36:21 | [diff] [blame] | 185 | if (build_with_chromium) { |
| 186 | rtc_use_h264 = media_use_openh264 |
| 187 | } else { |
| 188 | rtc_use_h264 = |
| 189 | proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang) |
| 190 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 191 | |
Jan Grulich | 0f86252 | 2024-04-29 14:16:28 | [diff] [blame] | 192 | # Use system OpenH264 |
| 193 | rtc_system_openh264 = false |
| 194 | |
qwu16 | 972f283 | 2023-08-15 09:16:54 | [diff] [blame] | 195 | # Enable to use H265 |
Mirko Bonadei | e3b4263 | 2024-03-27 12:13:52 | [diff] [blame] | 196 | if (build_with_chromium) { |
| 197 | rtc_use_h265 = enable_hevc_parser_and_hw_decoder |
| 198 | } else { |
| 199 | rtc_use_h265 = proprietary_codecs |
| 200 | } |
qwu16 | 972f283 | 2023-08-15 09:16:54 | [diff] [blame] | 201 | |
Markus Handell | 8e75bd4 | 2020-06-05 09:47:40 | [diff] [blame] | 202 | # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex. |
| 203 | rtc_use_absl_mutex = false |
| 204 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 205 | # By default, use normal platform audio support or dummy audio, but don't |
| 206 | # use file-based audio playout and record. |
| 207 | rtc_use_dummy_audio_file_devices = false |
| 208 | |
henrika | 7be7883 | 2017-06-13 15:34:16 | [diff] [blame] | 209 | # When set to true, replace the audio output with a sinus tone at 440Hz. |
| 210 | # The ADM will ask for audio data from WebRTC but instead of reading real |
| 211 | # audio samples from NetEQ, a sinus tone will be generated and replace the |
| 212 | # real audio samples. |
| 213 | rtc_audio_device_plays_sinus_tone = false |
| 214 | |
Anders Carlsson | 358f2e0 | 2018-06-04 08:24:37 | [diff] [blame] | 215 | if (is_ios) { |
| 216 | # Build broadcast extension in AppRTCMobile for iOS. This results in the |
| 217 | # binary only running on iOS 11+, which is why it is disabled by default. |
| 218 | rtc_apprtcmobile_broadcast_extension = false |
| 219 | } |
Anders Carlsson | 7bca8ca | 2018-08-30 07:30:29 | [diff] [blame] | 220 | |
Kári Tristan Helgason | ba50cb3 | 2023-06-28 12:32:04 | [diff] [blame] | 221 | # Determines whether OpenGL is available on iOS. |
| 222 | rtc_ios_use_opengl_rendering = is_ios && target_environment != "catalyst" |
Jordan Rose | 53d3fc9 | 2021-07-06 19:16:41 | [diff] [blame] | 223 | |
Jiawei Ou | 0874530 | 2019-02-12 19:36:13 | [diff] [blame] | 224 | # When set to false, builtin audio encoder/decoder factories and all the |
| 225 | # audio codecs they depend on will not be included in libwebrtc.{a|lib} |
| 226 | # (they will still be included in libjingle_peerconnection_so.so and |
| 227 | # WebRTC.framework) |
| 228 | rtc_include_builtin_audio_codecs = true |
| 229 | |
Mirko Bonadei | 20574f4 | 2019-03-28 06:50:07 | [diff] [blame] | 230 | # When set to true and in a standalone build, it will undefine UNICODE and |
| 231 | # _UNICODE (which are always defined globally by the Chromium Windows |
| 232 | # toolchain). |
| 233 | # This is only needed for testing purposes, WebRTC wants to be sure it |
| 234 | # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses |
| 235 | # wide character functions. |
| 236 | rtc_win_undef_unicode = false |
Austin Orion | 25b0dee | 2020-10-01 20:47:54 | [diff] [blame] | 237 | |
| 238 | # When set to true, a capturer implementation that uses the |
Austin Orion | 66241e4 | 2021-04-22 20:22:25 | [diff] [blame] | 239 | # Windows.Graphics.Capture APIs will be available for use. This introduces a |
| 240 | # dependency on the Win 10 SDK v10.0.17763.0. |
Austin Orion | 78f04d8 | 2021-04-23 19:37:26 | [diff] [blame] | 241 | rtc_enable_win_wgc = is_win |
philipel | b09d872 | 2021-11-23 10:00:24 | [diff] [blame] | 242 | |
| 243 | # Includes the dav1d decoder in the internal decoder factory when set to true. |
| 244 | rtc_include_dav1d_in_internal_decoder_factory = true |
Emil Lundmark | 6bf20cc | 2022-09-21 13:20:22 | [diff] [blame] | 245 | |
Emil Lundmark | 9109e85 | 2023-02-28 12:57:01 | [diff] [blame] | 246 | # When enabled, a run-time check will make sure that all field trial keys have |
| 247 | # been registered in accordance with the field trial policy, see |
| 248 | # g3doc/field-trials.md. The value can be set to the following: |
| 249 | # |
| 250 | # "dcheck": RTC_DCHECKs that the field trial has been registered. RTC_DCHECK |
| 251 | # must be enabled separately. |
| 252 | # |
| 253 | # "warn": RTC_LOGs a message with LS_WARNING severity if the field trial |
| 254 | # hasn't been registered. |
| 255 | rtc_strict_field_trials = "" |
Mirko Bonadei | 9130431 | 2023-07-26 11:01:43 | [diff] [blame] | 256 | |
| 257 | # If different from "", symbols exported with RTC_OBJC_EXPORT will be prefixed |
| 258 | # with this string. |
| 259 | # See the definition of RTC_OBJC_TYPE_PREFIX in the code. |
| 260 | rtc_objc_prefix = "" |
Arthur Sonzogni | 47faf32 | 2023-08-22 09:55:36 | [diff] [blame] | 261 | |
| 262 | # Embedders can define dependencies needed by WebRTC. Dependencies can be |
| 263 | # configs or targets. This can be defined in their `.gn` file. |
| 264 | # |
| 265 | # In practise, this is use by Chromium: Targets from |
| 266 | # `//third_party/webrtc_overrides` are depending on Chrome's `//base`, but |
| 267 | # WebRTC does not declare its public dependencies. See webrtc:8603. Instead |
| 268 | # WebRTC is using a global common dependencies. |
| 269 | rtc_common_public_deps = [] # no-presubmit-check TODO(webrtc:8603) |
Evan Shrubsole | db50b03 | 2024-04-24 13:27:00 | [diff] [blame] | 270 | |
| 271 | # When true, include the Perfetto library. |
| 272 | rtc_use_perfetto = false |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 273 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 274 | |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 275 | if (!build_with_mozilla) { |
| 276 | import("//testing/test.gni") |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | # A second declare_args block, so that declarations within it can |
| 280 | # depend on the possibly overridden variables in the first |
| 281 | # declare_args block. |
| 282 | declare_args() { |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 283 | # Enables the use of protocol buffers for debug recordings. |
| 284 | rtc_enable_protobuf = !build_with_mozilla |
| 285 | |
| 286 | # Set this to disable building with support for SCTP data channels. |
| 287 | rtc_enable_sctp = !build_with_mozilla |
| 288 | |
| 289 | # Disable these to not build components which can be externally provided. |
| 290 | rtc_build_json = !build_with_mozilla |
| 291 | rtc_build_libsrtp = !build_with_mozilla |
| 292 | rtc_build_libvpx = !build_with_mozilla |
| 293 | rtc_libvpx_build_vp9 = !build_with_mozilla |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 294 | rtc_build_opus = !build_with_mozilla |
| 295 | rtc_build_ssl = !build_with_mozilla |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 296 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 297 | # Excluded in Chromium since its prerequisites don't require Pulse Audio. |
| 298 | rtc_include_pulse_audio = !build_with_chromium |
| 299 | |
| 300 | # Chromium uses its own IO handling, so the internal ADM is only built for |
| 301 | # standalone WebRTC. |
| 302 | rtc_include_internal_audio_device = !build_with_chromium |
| 303 | |
Zhaoliang Ma | 72e4321 | 2020-08-17 09:13:41 | [diff] [blame] | 304 | # Set this to true to enable the avx2 support in webrtc. |
Per Åhgren | a43178c | 2020-09-25 10:02:32 | [diff] [blame] | 305 | # TODO: Make sure that AVX2 works also for non-clang compilers. |
| 306 | if (is_clang == true) { |
| 307 | rtc_enable_avx2 = true |
| 308 | } else { |
| 309 | rtc_enable_avx2 = false |
| 310 | } |
Zhaoliang Ma | 72e4321 | 2020-08-17 09:13:41 | [diff] [blame] | 311 | |
Philipp Hancke | 1a89bc8 | 2021-03-02 20:23:24 | [diff] [blame] | 312 | # Set this to true to build the unit tests. |
| 313 | # Disabled when building with Chromium or Mozilla. |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 314 | rtc_include_tests = !build_with_chromium && !build_with_mozilla |
Oleh Prypin | 240b893 | 2019-06-07 11:27:07 | [diff] [blame] | 315 | |
| 316 | # Set this to false to skip building code that also requires X11 extensions |
| 317 | # such as Xdamage, Xfixes. |
| 318 | rtc_use_x11_extensions = rtc_use_x11 |
Artem Titov | 6a4a146 | 2019-11-26 15:24:46 | [diff] [blame] | 319 | |
| 320 | # Set this to true to fully remove logging from WebRTC. |
| 321 | rtc_disable_logging = false |
Doudou Kisabaka | 2dec496 | 2019-11-28 13:24:31 | [diff] [blame] | 322 | |
| 323 | # Set this to true to disable trace events. |
| 324 | rtc_disable_trace_events = false |
Artem Titov | 9dc209a | 2019-11-28 16:09:30 | [diff] [blame] | 325 | |
| 326 | # Set this to true to disable detailed error message and logging for |
| 327 | # RTC_CHECKs. |
| 328 | rtc_disable_check_msg = false |
Ying Wang | ef3998f | 2019-12-09 12:06:53 | [diff] [blame] | 329 | |
| 330 | # Set this to true to disable webrtc metrics. |
Mirko Bonadei | 3c4fda2 | 2019-12-10 14:02:53 | [diff] [blame] | 331 | rtc_disable_metrics = false |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 332 | } |
| 333 | |
Florent Castelli | a80c3e5 | 2021-04-15 13:02:56 | [diff] [blame] | 334 | declare_args() { |
Florent Castelli | a6983c6 | 2021-05-06 08:50:07 | [diff] [blame] | 335 | # Enable the dcsctp backend for DataChannels and related unittests |
| 336 | rtc_build_dcsctp = !build_with_mozilla && rtc_enable_sctp |
| 337 | |
Florent Castelli | 023be3c | 2022-03-15 15:01:52 | [diff] [blame] | 338 | # Enable gRPC used for negotiation in multiprocess tests |
| 339 | rtc_enable_grpc = rtc_enable_protobuf && (is_linux || is_mac) |
Florent Castelli | a80c3e5 | 2021-04-15 13:02:56 | [diff] [blame] | 340 | } |
| 341 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 342 | # Make it possible to provide custom locations for some libraries (move these |
| 343 | # up into declare_args should we need to actually use them for the GN build). |
| 344 | rtc_libvpx_dir = "//third_party/libvpx" |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 345 | rtc_opus_dir = "//third_party/opus" |
| 346 | |
| 347 | # Desktop capturer is supported only on Windows, OSX and Linux. |
Oleh Prypin | 240b893 | 2019-06-07 11:27:07 | [diff] [blame] | 348 | rtc_desktop_capture_supported = |
| 349 | (is_win && current_os != "winuwp") || is_mac || |
Hidehiko Abe | f264e70 | 2020-09-10 09:10:11 | [diff] [blame] | 350 | ((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire)) |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 351 | |
| 352 | ############################################################################### |
| 353 | # Templates |
| 354 | # |
| 355 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 356 | # Points to // in webrtc stand-alone or to //third_party/webrtc/ in |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 357 | # chromium. |
| 358 | # We need absolute paths for all configs in templates as they are shared in |
| 359 | # different subdirectories. |
| 360 | webrtc_root = get_path_info(".", "abspath") |
| 361 | |
| 362 | # Global configuration that should be applied to all WebRTC targets. |
| 363 | # You normally shouldn't need to include this in your target as it's |
| 364 | # automatically included when using the rtc_* templates. |
| 365 | # It sets defines, include paths and compilation warnings accordingly, |
| 366 | # both for WebRTC stand-alone builds and for the scenario when WebRTC |
| 367 | # native code is built as part of Chromium. |
Mirko Bonadei | 5f07845 | 2021-07-30 20:32:55 | [diff] [blame] | 368 | rtc_common_configs = [ webrtc_root + ":common_config" ] |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 369 | |
kthelgason | c097710 | 2017-04-24 07:57:16 | [diff] [blame] | 370 | if (is_mac || is_ios) { |
Christoffer Jansson | fe2e7ea | 2023-08-02 07:41:23 | [diff] [blame] | 371 | if (filter_include(default_compiler_configs, |
| 372 | [ "//build/config/compiler:enable_arc" ]) == []) { |
| 373 | rtc_common_configs += [ "//build/config/compiler:enable_arc" ] |
| 374 | } |
kthelgason | c097710 | 2017-04-24 07:57:16 | [diff] [blame] | 375 | } |
Evan Shrubsole | 047238e | 2024-04-29 11:36:58 | [diff] [blame] | 376 | |
Evan Shrubsole | fa87037 | 2024-05-02 11:59:39 | [diff] [blame] | 377 | if (build_with_chromium) { |
Evan Shrubsole | 047238e | 2024-04-29 11:36:58 | [diff] [blame] | 378 | rtc_use_perfetto = true |
| 379 | } |
| 380 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 381 | # Global public configuration that should be applied to all WebRTC targets. You |
| 382 | # normally shouldn't need to include this in your target as it's automatically |
| 383 | # included when using the rtc_* templates. It set the defines, include paths and |
| 384 | # compilation warnings that should be propagated to dependents of the targets |
| 385 | # depending on the target having this config. |
| 386 | rtc_common_inherited_config = webrtc_root + ":common_inherited_config" |
| 387 | |
| 388 | # Common configs to remove or add in all rtc targets. |
| 389 | rtc_remove_configs = [] |
Mirko Bonadei | fc52b91 | 2019-03-01 09:32:56 | [diff] [blame] | 390 | if (!build_with_chromium && is_clang) { |
| 391 | rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 392 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 393 | rtc_add_configs = rtc_common_configs |
Mirko Bonadei | 96ede16a | 2018-09-06 11:45:44 | [diff] [blame] | 394 | rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ] |
Mirko Bonadei | 32ce18c | 2018-09-18 11:15:54 | [diff] [blame] | 395 | rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ] |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 396 | |
| 397 | set_defaults("rtc_test") { |
| 398 | configs = rtc_add_configs |
Arthur Sonzogni | 47faf32 | 2023-08-22 09:55:36 | [diff] [blame] | 399 | public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 400 | suppressed_configs = [] |
| 401 | } |
| 402 | |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 403 | set_defaults("rtc_library") { |
| 404 | configs = rtc_add_configs |
Arthur Sonzogni | 47faf32 | 2023-08-22 09:55:36 | [diff] [blame] | 405 | public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 406 | suppressed_configs = [] |
| 407 | } |
| 408 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 409 | set_defaults("rtc_source_set") { |
| 410 | configs = rtc_add_configs |
Arthur Sonzogni | 47faf32 | 2023-08-22 09:55:36 | [diff] [blame] | 411 | public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 412 | suppressed_configs = [] |
| 413 | } |
| 414 | |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 415 | set_defaults("rtc_static_library") { |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 416 | configs = rtc_add_configs |
Arthur Sonzogni | 47faf32 | 2023-08-22 09:55:36 | [diff] [blame] | 417 | public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 418 | suppressed_configs = [] |
| 419 | } |
| 420 | |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 421 | set_defaults("rtc_executable") { |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 422 | configs = rtc_add_configs |
Arthur Sonzogni | 47faf32 | 2023-08-22 09:55:36 | [diff] [blame] | 423 | public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 424 | suppressed_configs = [] |
| 425 | } |
| 426 | |
| 427 | set_defaults("rtc_shared_library") { |
| 428 | configs = rtc_add_configs |
Arthur Sonzogni | 47faf32 | 2023-08-22 09:55:36 | [diff] [blame] | 429 | public_deps = rtc_common_public_deps # no-presubmit-check TODO(webrtc:8603) |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 430 | suppressed_configs = [] |
| 431 | } |
| 432 | |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 433 | webrtc_default_visibility = [ webrtc_root + "/*" ] |
| 434 | if (build_with_chromium) { |
| 435 | # Allow Chromium's WebRTC overrides targets to bypass the regular |
| 436 | # visibility restrictions. |
| 437 | webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ] |
| 438 | } |
| 439 | |
Karl Wiberg | bb23c83 | 2018-04-22 17:55:00 | [diff] [blame] | 440 | # ---- Poisons ---- |
| 441 | # |
| 442 | # The general idea is that some targets declare that they contain some |
| 443 | # kind of poison, which makes it impossible for other targets to |
| 444 | # depend on them (even transitively) unless they declare themselves |
| 445 | # immune to that particular type of poison. |
| 446 | # |
| 447 | # Targets that *contain* poison of type foo should contain the line |
| 448 | # |
| 449 | # poisonous = [ "foo" ] |
| 450 | # |
| 451 | # and targets that *are immune but arent't themselves poisonous* |
| 452 | # should contain |
| 453 | # |
| 454 | # allow_poison = [ "foo" ] |
| 455 | # |
| 456 | # This useful in cases where we have some large target or set of |
| 457 | # targets and want to ensure that most other targets do not |
| 458 | # transitively depend on them. For example, almost no high-level |
| 459 | # target should depend on the audio codecs, since we want WebRTC users |
| 460 | # to be able to inject any subset of them and actually end up with a |
| 461 | # binary that doesn't include the codecs they didn't inject. |
| 462 | # |
| 463 | # Test-only targets (`testonly` set to true) and non-public targets |
| 464 | # (`visibility` not containing "*") are automatically immune to all |
| 465 | # types of poison. |
| 466 | # |
| 467 | # Here's the complete list of all types of poison. It must be kept in |
| 468 | # 1:1 correspondence with the set of //:poison_* targets. |
| 469 | # |
| 470 | all_poison_types = [ |
| 471 | # Encoders and decoders for specific audio codecs such as Opus and iSAC. |
| 472 | "audio_codecs", |
Anders Carlsson | 1f433e4 | 2018-04-24 14:39:05 | [diff] [blame] | 473 | |
Sam Zackrisson | 03cb7e5 | 2021-12-06 14:40:04 | [diff] [blame] | 474 | # Default echo detector implementation. |
| 475 | "default_echo_detector", |
| 476 | |
Danil Chapovalov | 9fdceb8 | 2023-11-27 09:57:22 | [diff] [blame] | 477 | # Implementations of the utilities exposed through `Environment`. |
| 478 | # Most webrtc classes must use propagated `Environment`. Only few top-level |
| 479 | # classes are allowed to create `Environment` from individual utilities. |
| 480 | "environment_construction", |
| 481 | |
Sam Zackrisson | 492fdf4 | 2019-10-25 08:45:58 | [diff] [blame] | 482 | # Software video codecs (VP8 and VP9 through libvpx). |
| 483 | "software_video_codecs", |
Karl Wiberg | bb23c83 | 2018-04-22 17:55:00 | [diff] [blame] | 484 | ] |
| 485 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 | [diff] [blame] | 486 | absl_include_config = "//third_party/abseil-cpp:absl_include_config" |
| 487 | absl_define_config = "//third_party/abseil-cpp:absl_define_config" |
| 488 | |
Mirko Bonadei | 2ab97f6 | 2019-07-18 11:44:12 | [diff] [blame] | 489 | # Abseil Flags are testonly, so this config will only be applied to WebRTC targets |
| 490 | # that are testonly. |
| 491 | absl_flags_config = webrtc_root + ":absl_flags_configs" |
| 492 | |
Mirko Bonadei | e99b6cc | 2020-11-25 15:41:37 | [diff] [blame] | 493 | # WebRTC wrapper of Chromium's test() template. This template just adds some |
| 494 | # WebRTC only configuration in order to avoid to duplicate it for every WebRTC |
| 495 | # target. |
| 496 | # The parameter `is_xctest` is different from the one in the Chromium's test() |
| 497 | # template (and it is not forwarded to it). In rtc_test(), the argument |
| 498 | # `is_xctest` is used to avoid to take dependencies that are not needed |
| 499 | # in case the test is a real XCTest (using the XCTest framework). |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 500 | template("rtc_test") { |
| 501 | test(target_name) { |
| 502 | forward_variables_from(invoker, |
| 503 | "*", |
| 504 | [ |
| 505 | "configs", |
Mirko Bonadei | e99b6cc | 2020-11-25 15:41:37 | [diff] [blame] | 506 | "is_xctest", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 507 | "public_configs", |
| 508 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 509 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 510 | ]) |
Mirko Bonadei | dd41194 | 2017-11-21 14:35:27 | [diff] [blame] | 511 | |
| 512 | # Always override to public because when target_os is Android the `test` |
| 513 | # template can override it to [ "*" ] and we want to avoid conditional |
| 514 | # visibility. |
Mirko Bonadei | 2155881 | 2017-11-21 11:47:34 | [diff] [blame] | 515 | visibility = [ "*" ] |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 516 | configs += invoker.configs |
| 517 | configs -= rtc_remove_configs |
| 518 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 | [diff] [blame] | 519 | public_configs = [ |
| 520 | rtc_common_inherited_config, |
| 521 | absl_include_config, |
| 522 | absl_define_config, |
Mirko Bonadei | 2ab97f6 | 2019-07-18 11:44:12 | [diff] [blame] | 523 | absl_flags_config, |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 | [diff] [blame] | 524 | ] |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 525 | if (defined(invoker.public_configs)) { |
| 526 | public_configs += invoker.public_configs |
| 527 | } |
sakal | d7fdb80 | 2017-05-26 08:51:53 | [diff] [blame] | 528 | if (!build_with_chromium && is_android) { |
Björn Terelius | 711e1a8 | 2024-12-04 14:54:49 | [diff] [blame] | 529 | use_default_launcher = false |
Jianjun Zhu | 037f3e4 | 2017-08-15 13:48:37 | [diff] [blame] | 530 | android_manifest = webrtc_root + "test/android/AndroidManifest.xml" |
Peter Kotwicz | 3ceb16e | 2021-04-14 22:53:11 | [diff] [blame] | 531 | use_raw_android_executable = false |
Jeremy Leconte | b19cfee | 2020-06-25 20:57:49 | [diff] [blame] | 532 | min_sdk_version = 21 |
Mirko Bonadei | a4f557f | 2025-01-10 08:35:53 | [diff] [blame] | 533 | target_sdk_version = 24 |
Mirko Bonadei | 8093935 | 2021-04-12 17:03:37 | [diff] [blame] | 534 | deps += [ |
| 535 | "//build/android/gtest_apk:native_test_instrumentation_test_runner_java", |
Björn Terelius | 711e1a8 | 2024-12-04 14:54:49 | [diff] [blame] | 536 | webrtc_root + "sdk/android:native_test_jni_onload", |
| 537 | webrtc_root + "sdk/android:base_java", |
Mirko Bonadei | 8093935 | 2021-04-12 17:03:37 | [diff] [blame] | 538 | webrtc_root + "test:native_test_java", |
Björn Terelius | 711e1a8 | 2024-12-04 14:54:49 | [diff] [blame] | 539 | webrtc_root + "test:native_test_support", |
Mirko Bonadei | a3b2dd4 | 2025-02-13 09:22:25 | [diff] [blame] | 540 | "//third_party/jni_zero:jni_zero_java", |
Mirko Bonadei | 8093935 | 2021-04-12 17:03:37 | [diff] [blame] | 541 | ] |
sakal | d7fdb80 | 2017-05-26 08:51:53 | [diff] [blame] | 542 | } |
Mirko Bonadei | e99b6cc | 2020-11-25 15:41:37 | [diff] [blame] | 543 | |
Björn Terelius | 49850c3 | 2022-05-04 08:59:56 | [diff] [blame] | 544 | # Build //test:google_test_runner_objc when the test is not a real XCTest. |
Jeremy Leconte | b8ba8c9 | 2022-03-15 08:08:29 | [diff] [blame] | 545 | if (is_ios && rtc_include_tests) { |
Mirko Bonadei | e99b6cc | 2020-11-25 15:41:37 | [diff] [blame] | 546 | if (!defined(invoker.is_xctest) || !invoker.is_xctest) { |
Björn Terelius | 49850c3 | 2022-05-04 08:59:56 | [diff] [blame] | 547 | xctest_module_target = "//test:google_test_runner_objc" |
Mirko Bonadei | e99b6cc | 2020-11-25 15:41:37 | [diff] [blame] | 548 | } |
| 549 | } |
Andrey Logvin | 7864600 | 2021-01-29 10:50:19 | [diff] [blame] | 550 | |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 551 | assert( |
| 552 | !defined(absl_deps), |
| 553 | "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.") |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 554 | |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 555 | # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 556 | if (build_with_chromium && defined(deps)) { |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 557 | absl_dependencies = |
| 558 | filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 559 | if (absl_dependencies != []) { |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 560 | filtered_deps = |
| 561 | filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ]) |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 562 | deps = [] |
| 563 | deps = filtered_deps |
Andrey Logvin | 7864600 | 2021-01-29 10:50:19 | [diff] [blame] | 564 | deps += [ "//third_party/abseil-cpp:absl" ] |
Andrey Logvin | 7864600 | 2021-01-29 10:50:19 | [diff] [blame] | 565 | } |
| 566 | } |
| 567 | |
Jeremy Leconte | d15f3e1 | 2022-02-18 09:16:32 | [diff] [blame] | 568 | # TODO(crbug.com/webrtc/13556): Adding the .app folder in the runtime_deps |
| 569 | # shoulnd't be necessary. this code should be removed and the same solution |
| 570 | # as Chromium should be used. |
| 571 | if (is_ios) { |
| 572 | if (!defined(invoker.data)) { |
| 573 | data = [] |
| 574 | } |
| 575 | data += [ "${root_out_dir}/${target_name}.app" ] |
| 576 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 577 | } |
| 578 | } |
| 579 | |
| 580 | template("rtc_source_set") { |
| 581 | source_set(target_name) { |
| 582 | forward_variables_from(invoker, |
| 583 | "*", |
| 584 | [ |
| 585 | "configs", |
| 586 | "public_configs", |
| 587 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 588 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 589 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 590 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 591 | if (!defined(visibility)) { |
| 592 | visibility = webrtc_default_visibility |
| 593 | } |
Karl Wiberg | bb23c83 | 2018-04-22 17:55:00 | [diff] [blame] | 594 | |
| 595 | # What's your poison? |
| 596 | if (defined(testonly) && testonly) { |
| 597 | assert(!defined(poisonous)) |
| 598 | assert(!defined(allow_poison)) |
| 599 | } else { |
| 600 | if (!defined(poisonous)) { |
| 601 | poisonous = [] |
| 602 | } |
| 603 | if (!defined(allow_poison)) { |
| 604 | allow_poison = [] |
| 605 | } |
| 606 | if (!defined(assert_no_deps)) { |
| 607 | assert_no_deps = [] |
| 608 | } |
| 609 | if (!defined(deps)) { |
| 610 | deps = [] |
| 611 | } |
| 612 | foreach(p, poisonous) { |
| 613 | deps += [ webrtc_root + ":poison_" + p ] |
| 614 | } |
| 615 | foreach(poison_type, all_poison_types) { |
| 616 | allow_dep = true |
| 617 | foreach(v, visibility) { |
| 618 | if (v == "*") { |
| 619 | allow_dep = false |
| 620 | } |
| 621 | } |
| 622 | foreach(p, allow_poison + poisonous) { |
| 623 | if (p == poison_type) { |
| 624 | allow_dep = true |
| 625 | } |
| 626 | } |
| 627 | if (!allow_dep) { |
| 628 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 629 | } |
| 630 | } |
| 631 | } |
| 632 | |
Mirko Bonadei | 92dd35d | 2019-11-15 15:08:41 | [diff] [blame] | 633 | # Chromium should only depend on the WebRTC component in order to |
| 634 | # avoid to statically link WebRTC in a component build. |
| 635 | if (build_with_chromium) { |
| 636 | publicly_visible = false |
| 637 | foreach(v, visibility) { |
| 638 | if (v == "*") { |
| 639 | publicly_visible = true |
| 640 | } |
| 641 | } |
| 642 | if (publicly_visible) { |
| 643 | visibility = [] |
| 644 | visibility = webrtc_default_visibility |
| 645 | } |
| 646 | } |
| 647 | |
Mirko Bonadei | 96ede16a | 2018-09-06 11:45:44 | [diff] [blame] | 648 | if (!defined(testonly) || !testonly) { |
| 649 | configs += rtc_prod_configs |
| 650 | } |
| 651 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 652 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 11:15:54 | [diff] [blame] | 653 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 654 | configs -= rtc_remove_configs |
| 655 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 | [diff] [blame] | 656 | public_configs = [ |
| 657 | rtc_common_inherited_config, |
| 658 | absl_include_config, |
| 659 | absl_define_config, |
| 660 | ] |
Mirko Bonadei | 2ab97f6 | 2019-07-18 11:44:12 | [diff] [blame] | 661 | if (defined(testonly) && testonly) { |
| 662 | public_configs += [ absl_flags_config ] |
| 663 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 664 | if (defined(invoker.public_configs)) { |
| 665 | public_configs += invoker.public_configs |
| 666 | } |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 19:23:41 | [diff] [blame] | 667 | |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 668 | assert( |
| 669 | !defined(absl_deps), |
| 670 | "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.") |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 671 | |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 672 | # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 673 | if (build_with_chromium && defined(deps)) { |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 674 | absl_dependencies = |
| 675 | filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 676 | if (absl_dependencies != []) { |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 677 | filtered_deps = |
| 678 | filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ]) |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 679 | deps = [] |
| 680 | deps = filtered_deps |
Mirko Bonadei | 08ce986 | 2020-06-11 09:25:32 | [diff] [blame] | 681 | deps += [ "//third_party/abseil-cpp:absl" ] |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 19:23:41 | [diff] [blame] | 682 | } |
| 683 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 684 | } |
| 685 | } |
| 686 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 687 | template("rtc_static_library") { |
| 688 | static_library(target_name) { |
| 689 | forward_variables_from(invoker, |
| 690 | "*", |
| 691 | [ |
| 692 | "configs", |
| 693 | "public_configs", |
| 694 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 695 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 696 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 697 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 698 | if (!defined(visibility)) { |
| 699 | visibility = webrtc_default_visibility |
| 700 | } |
Karl Wiberg | bb23c83 | 2018-04-22 17:55:00 | [diff] [blame] | 701 | |
| 702 | # What's your poison? |
| 703 | if (defined(testonly) && testonly) { |
| 704 | assert(!defined(poisonous)) |
| 705 | assert(!defined(allow_poison)) |
| 706 | } else { |
| 707 | if (!defined(poisonous)) { |
| 708 | poisonous = [] |
| 709 | } |
| 710 | if (!defined(allow_poison)) { |
| 711 | allow_poison = [] |
| 712 | } |
| 713 | if (!defined(assert_no_deps)) { |
| 714 | assert_no_deps = [] |
| 715 | } |
| 716 | if (!defined(deps)) { |
| 717 | deps = [] |
| 718 | } |
| 719 | foreach(p, poisonous) { |
| 720 | deps += [ webrtc_root + ":poison_" + p ] |
| 721 | } |
| 722 | foreach(poison_type, all_poison_types) { |
| 723 | allow_dep = true |
| 724 | foreach(v, visibility) { |
| 725 | if (v == "*") { |
| 726 | allow_dep = false |
| 727 | } |
| 728 | } |
| 729 | foreach(p, allow_poison + poisonous) { |
| 730 | if (p == poison_type) { |
| 731 | allow_dep = true |
| 732 | } |
| 733 | } |
| 734 | if (!allow_dep) { |
| 735 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 736 | } |
| 737 | } |
| 738 | } |
| 739 | |
Mirko Bonadei | 96ede16a | 2018-09-06 11:45:44 | [diff] [blame] | 740 | if (!defined(testonly) || !testonly) { |
| 741 | configs += rtc_prod_configs |
| 742 | } |
| 743 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 744 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 11:15:54 | [diff] [blame] | 745 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 746 | configs -= rtc_remove_configs |
| 747 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 | [diff] [blame] | 748 | public_configs = [ |
| 749 | rtc_common_inherited_config, |
| 750 | absl_include_config, |
| 751 | absl_define_config, |
| 752 | ] |
Mirko Bonadei | 2ab97f6 | 2019-07-18 11:44:12 | [diff] [blame] | 753 | if (defined(testonly) && testonly) { |
| 754 | public_configs += [ absl_flags_config ] |
| 755 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 756 | if (defined(invoker.public_configs)) { |
| 757 | public_configs += invoker.public_configs |
| 758 | } |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 19:23:41 | [diff] [blame] | 759 | |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 760 | assert( |
| 761 | !defined(absl_deps), |
| 762 | "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.") |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 763 | |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 764 | # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 765 | if (build_with_chromium && defined(deps)) { |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 766 | absl_dependencies = |
| 767 | filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 768 | if (absl_dependencies != []) { |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 769 | filtered_deps = |
| 770 | filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ]) |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 771 | deps = [] |
| 772 | deps = filtered_deps |
Mirko Bonadei | 08ce986 | 2020-06-11 09:25:32 | [diff] [blame] | 773 | deps += [ "//third_party/abseil-cpp:absl" ] |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 19:23:41 | [diff] [blame] | 774 | } |
| 775 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 776 | } |
| 777 | } |
| 778 | |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 779 | # This template automatically switches the target type between source_set |
| 780 | # and static_library. |
| 781 | # |
Florent Castelli | 87b6e7b | 2022-04-26 00:22:35 | [diff] [blame] | 782 | # This should be the default target type for all the WebRTC targets. |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 783 | # |
| 784 | # How does it work: |
| 785 | # Since all files in a source_set are linked into a final binary, while files |
| 786 | # in a static library are only linked in if at least one symbol in them is |
| 787 | # referenced, in component builds source_sets are easy to deal with because |
| 788 | # all their object files are passed to the linker to create a shared library. |
| 789 | # In release builds instead, static_libraries are preferred since they allow |
| 790 | # the linker to discard dead code. |
| 791 | # For the same reason, testonly targets will always be expanded to |
| 792 | # source_set in order to be sure that tests are present in the test binary. |
| 793 | template("rtc_library") { |
Florent Castelli | 87b6e7b | 2022-04-26 00:22:35 | [diff] [blame] | 794 | header_only = true |
| 795 | if (defined(invoker.sources)) { |
| 796 | non_header_sources = filter_exclude(invoker.sources, |
| 797 | [ |
| 798 | "*.h", |
| 799 | "*.hh", |
| 800 | "*.inc", |
| 801 | ]) |
| 802 | if (non_header_sources != []) { |
| 803 | header_only = false |
| 804 | } |
| 805 | } |
| 806 | |
| 807 | # Header only libraries should use source_set as a static_library with no |
| 808 | # source files will cause issues with macOS libtool. |
| 809 | if (header_only || is_component_build || |
| 810 | (defined(invoker.testonly) && invoker.testonly)) { |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 811 | target_type = "source_set" |
| 812 | } else { |
| 813 | target_type = "static_library" |
| 814 | } |
| 815 | target(target_type, target_name) { |
| 816 | forward_variables_from(invoker, |
| 817 | "*", |
| 818 | [ |
| 819 | "configs", |
| 820 | "public_configs", |
| 821 | "suppressed_configs", |
| 822 | "visibility", |
| 823 | ]) |
| 824 | forward_variables_from(invoker, [ "visibility" ]) |
| 825 | if (!defined(visibility)) { |
| 826 | visibility = webrtc_default_visibility |
| 827 | } |
| 828 | |
| 829 | # What's your poison? |
| 830 | if (defined(testonly) && testonly) { |
| 831 | assert(!defined(poisonous)) |
| 832 | assert(!defined(allow_poison)) |
| 833 | } else { |
| 834 | if (!defined(poisonous)) { |
| 835 | poisonous = [] |
| 836 | } |
| 837 | if (!defined(allow_poison)) { |
| 838 | allow_poison = [] |
| 839 | } |
| 840 | if (!defined(assert_no_deps)) { |
| 841 | assert_no_deps = [] |
| 842 | } |
| 843 | if (!defined(deps)) { |
| 844 | deps = [] |
| 845 | } |
| 846 | foreach(p, poisonous) { |
| 847 | deps += [ webrtc_root + ":poison_" + p ] |
| 848 | } |
| 849 | foreach(poison_type, all_poison_types) { |
| 850 | allow_dep = true |
| 851 | foreach(v, visibility) { |
| 852 | if (v == "*") { |
| 853 | allow_dep = false |
| 854 | } |
| 855 | } |
| 856 | foreach(p, allow_poison + poisonous) { |
| 857 | if (p == poison_type) { |
| 858 | allow_dep = true |
| 859 | } |
| 860 | } |
| 861 | if (!allow_dep) { |
| 862 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 863 | } |
| 864 | } |
| 865 | } |
| 866 | |
Mirko Bonadei | 92dd35d | 2019-11-15 15:08:41 | [diff] [blame] | 867 | # Chromium should only depend on the WebRTC component in order to |
| 868 | # avoid to statically link WebRTC in a component build. |
| 869 | if (build_with_chromium) { |
| 870 | publicly_visible = false |
| 871 | foreach(v, visibility) { |
| 872 | if (v == "*") { |
| 873 | publicly_visible = true |
| 874 | } |
| 875 | } |
| 876 | if (publicly_visible) { |
| 877 | visibility = [] |
| 878 | visibility = webrtc_default_visibility |
| 879 | } |
| 880 | } |
| 881 | |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 882 | if (!defined(testonly) || !testonly) { |
| 883 | configs += rtc_prod_configs |
| 884 | } |
| 885 | |
| 886 | configs += invoker.configs |
| 887 | configs += rtc_library_impl_config |
| 888 | configs -= rtc_remove_configs |
| 889 | configs -= invoker.suppressed_configs |
| 890 | public_configs = [ |
| 891 | rtc_common_inherited_config, |
| 892 | absl_include_config, |
| 893 | absl_define_config, |
| 894 | ] |
| 895 | if (defined(testonly) && testonly) { |
| 896 | public_configs += [ absl_flags_config ] |
| 897 | } |
| 898 | if (defined(invoker.public_configs)) { |
| 899 | public_configs += invoker.public_configs |
| 900 | } |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 19:23:41 | [diff] [blame] | 901 | |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 902 | assert( |
| 903 | !defined(absl_deps), |
| 904 | "`absl_deps` has been deprecated, add your Abseil dependencies to the `deps` variable.") |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 905 | |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 906 | # Abseil dependencies need to be converted to //third_party/abseil-cpp:absl when build_with_chromium=true |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 907 | if (build_with_chromium && defined(deps)) { |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 908 | absl_dependencies = |
| 909 | filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 910 | if (absl_dependencies != []) { |
Florent Castelli | ae5d503 | 2024-05-27 10:19:05 | [diff] [blame] | 911 | filtered_deps = |
| 912 | filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ]) |
Florent Castelli | 3ffa0e8 | 2024-05-20 09:57:05 | [diff] [blame] | 913 | deps = [] |
| 914 | deps = filtered_deps |
Mirko Bonadei | 08ce986 | 2020-06-11 09:25:32 | [diff] [blame] | 915 | deps += [ "//third_party/abseil-cpp:absl" ] |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 19:23:41 | [diff] [blame] | 916 | } |
| 917 | } |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 918 | } |
| 919 | } |
| 920 | |
| 921 | template("rtc_executable") { |
| 922 | executable(target_name) { |
| 923 | forward_variables_from(invoker, |
| 924 | "*", |
| 925 | [ |
| 926 | "deps", |
| 927 | "configs", |
| 928 | "public_configs", |
| 929 | "suppressed_configs", |
| 930 | "visibility", |
| 931 | ]) |
| 932 | forward_variables_from(invoker, [ "visibility" ]) |
| 933 | if (!defined(visibility)) { |
| 934 | visibility = webrtc_default_visibility |
| 935 | } |
| 936 | configs += invoker.configs |
| 937 | configs -= rtc_remove_configs |
| 938 | configs -= invoker.suppressed_configs |
| 939 | deps = invoker.deps |
| 940 | |
| 941 | public_configs = [ |
| 942 | rtc_common_inherited_config, |
| 943 | absl_include_config, |
| 944 | absl_define_config, |
| 945 | ] |
| 946 | if (defined(testonly) && testonly) { |
| 947 | public_configs += [ absl_flags_config ] |
| 948 | } |
| 949 | if (defined(invoker.public_configs)) { |
| 950 | public_configs += invoker.public_configs |
| 951 | } |
| 952 | if (is_win) { |
| 953 | deps += [ |
| 954 | # Give executables the default manifest on Windows (a no-op elsewhere). |
| 955 | "//build/win:default_exe_manifest", |
| 956 | ] |
| 957 | } |
Danil Chapovalov | 366f205 | 2024-10-10 08:46:43 | [diff] [blame] | 958 | |
| 959 | # Convert abseil dependencies to //third_party/abseil-cpp:absl_full when |
| 960 | # build_with_chromium=true so that webrtc targets won't need exceptions to |
| 961 | # depend on individual absl targets. |
| 962 | # Note that //third_party/abseil-cpp:absl_full build target includes flags, |
| 963 | # but //third_party/abseil-cpp:absl target - doesn't. That allows webrtc |
| 964 | # executables, but not libraries to use absl flags. |
| 965 | if (build_with_chromium && defined(deps)) { |
| 966 | absl_dependencies = |
| 967 | filter_labels_include(deps, [ "//third_party/abseil-cpp/*" ]) |
| 968 | if (absl_dependencies != []) { |
| 969 | filtered_deps = |
| 970 | filter_labels_exclude(deps, [ "//third_party/abseil-cpp/*" ]) |
| 971 | deps = [] |
| 972 | deps = filtered_deps |
| 973 | deps += [ "//third_party/abseil-cpp:absl_full" ] |
| 974 | } |
| 975 | } |
Mirko Bonadei | 86d053c | 2019-10-17 19:32:04 | [diff] [blame] | 976 | } |
| 977 | } |
| 978 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 979 | template("rtc_shared_library") { |
| 980 | shared_library(target_name) { |
| 981 | forward_variables_from(invoker, |
| 982 | "*", |
| 983 | [ |
| 984 | "configs", |
| 985 | "public_configs", |
| 986 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 987 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 988 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 989 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 990 | if (!defined(visibility)) { |
| 991 | visibility = webrtc_default_visibility |
| 992 | } |
Karl Wiberg | bb23c83 | 2018-04-22 17:55:00 | [diff] [blame] | 993 | |
| 994 | # What's your poison? |
| 995 | if (defined(testonly) && testonly) { |
| 996 | assert(!defined(poisonous)) |
| 997 | assert(!defined(allow_poison)) |
| 998 | } else { |
| 999 | if (!defined(poisonous)) { |
| 1000 | poisonous = [] |
| 1001 | } |
| 1002 | if (!defined(allow_poison)) { |
| 1003 | allow_poison = [] |
| 1004 | } |
| 1005 | if (!defined(assert_no_deps)) { |
| 1006 | assert_no_deps = [] |
| 1007 | } |
| 1008 | if (!defined(deps)) { |
| 1009 | deps = [] |
| 1010 | } |
| 1011 | foreach(p, poisonous) { |
| 1012 | deps += [ webrtc_root + ":poison_" + p ] |
| 1013 | } |
| 1014 | foreach(poison_type, all_poison_types) { |
| 1015 | allow_dep = true |
| 1016 | foreach(v, visibility) { |
| 1017 | if (v == "*") { |
| 1018 | allow_dep = false |
| 1019 | } |
| 1020 | } |
| 1021 | foreach(p, allow_poison + poisonous) { |
| 1022 | if (p == poison_type) { |
| 1023 | allow_dep = true |
| 1024 | } |
| 1025 | } |
| 1026 | if (!allow_dep) { |
| 1027 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 1028 | } |
| 1029 | } |
| 1030 | } |
| 1031 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 1032 | configs += invoker.configs |
| 1033 | configs -= rtc_remove_configs |
| 1034 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 | [diff] [blame] | 1035 | public_configs = [ |
| 1036 | rtc_common_inherited_config, |
| 1037 | absl_include_config, |
| 1038 | absl_define_config, |
| 1039 | ] |
Mirko Bonadei | 2ab97f6 | 2019-07-18 11:44:12 | [diff] [blame] | 1040 | if (defined(testonly) && testonly) { |
| 1041 | public_configs += [ absl_flags_config ] |
| 1042 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 1043 | if (defined(invoker.public_configs)) { |
| 1044 | public_configs += invoker.public_configs |
| 1045 | } |
| 1046 | } |
| 1047 | } |
kthelgason | 4065a576 | 2017-02-14 12:58:56 | [diff] [blame] | 1048 | |
Byoungchan Lee | 26b23b8 | 2022-04-08 09:23:14 | [diff] [blame] | 1049 | if (is_mac || is_ios) { |
| 1050 | template("apple_framework_bundle_with_umbrella_header") { |
Anders Carlsson | dc6b477 | 2018-01-15 12:31:03 | [diff] [blame] | 1051 | forward_variables_from(invoker, [ "output_name" ]) |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-16 22:49:28 | [diff] [blame] | 1052 | this_target_name = target_name |
Anders Carlsson | dc6b477 | 2018-01-15 12:31:03 | [diff] [blame] | 1053 | umbrella_header_path = |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-16 22:49:28 | [diff] [blame] | 1054 | "$target_gen_dir/$output_name.framework/WebRTC/$output_name.h" |
Byoungchan Lee | 26b23b8 | 2022-04-08 09:23:14 | [diff] [blame] | 1055 | modulemap_path = "$target_gen_dir/Modules/module.modulemap" |
Byoungchan Lee | 1ce9a17 | 2024-04-30 08:14:18 | [diff] [blame] | 1056 | privacy_manifest_path = "$target_gen_dir/$target_name/PrivacyInfo.xcprivacy" |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-16 22:49:28 | [diff] [blame] | 1057 | |
| 1058 | action_foreach("create_bracket_include_headers_$target_name") { |
| 1059 | script = "//tools_webrtc/apple/copy_framework_header.py" |
| 1060 | sources = invoker.sources |
| 1061 | output_name = invoker.output_name |
| 1062 | outputs = [ |
| 1063 | "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}", |
| 1064 | ] |
| 1065 | args = [ |
| 1066 | "--input", |
| 1067 | "{{source}}", |
| 1068 | "--output", |
| 1069 | rebase_path(target_gen_dir, root_build_dir) + |
| 1070 | "/$output_name.framework/WebRTC/{{source_file_part}}", |
| 1071 | ] |
| 1072 | } |
Anders Carlsson | dc6b477 | 2018-01-15 12:31:03 | [diff] [blame] | 1073 | |
Byoungchan Lee | 26b23b8 | 2022-04-08 09:23:14 | [diff] [blame] | 1074 | if (is_mac) { |
| 1075 | mac_framework_bundle(target_name) { |
| 1076 | forward_variables_from(invoker, "*", [ "configs" ]) |
| 1077 | if (defined(invoker.configs)) { |
| 1078 | configs += invoker.configs |
| 1079 | } |
| 1080 | |
| 1081 | framework_version = "A" |
| 1082 | framework_contents = [ |
| 1083 | "Headers", |
| 1084 | "Modules", |
| 1085 | "Resources", |
| 1086 | ] |
| 1087 | |
| 1088 | ldflags = [ |
| 1089 | "-all_load", |
| 1090 | "-install_name", |
| 1091 | "@rpath/$output_name.framework/$output_name", |
| 1092 | ] |
| 1093 | |
| 1094 | deps += [ |
| 1095 | ":copy_framework_headers_$this_target_name", |
| 1096 | ":copy_modulemap_$this_target_name", |
Byoungchan Lee | 1ce9a17 | 2024-04-30 08:14:18 | [diff] [blame] | 1097 | ":copy_privacy_manifest_$this_target_name", |
Byoungchan Lee | 26b23b8 | 2022-04-08 09:23:14 | [diff] [blame] | 1098 | ":copy_umbrella_header_$this_target_name", |
| 1099 | ":create_bracket_include_headers_$this_target_name", |
| 1100 | ":modulemap_$this_target_name", |
| 1101 | ":umbrella_header_$this_target_name", |
| 1102 | ] |
| 1103 | } |
| 1104 | } |
| 1105 | if (is_ios) { |
| 1106 | ios_framework_bundle(target_name) { |
| 1107 | forward_variables_from(invoker, |
| 1108 | "*", |
| 1109 | [ |
| 1110 | "configs", |
| 1111 | "public_headers", |
| 1112 | ]) |
| 1113 | if (defined(invoker.configs)) { |
| 1114 | configs += invoker.configs |
| 1115 | } |
| 1116 | public_headers = get_target_outputs( |
| 1117 | ":create_bracket_include_headers_$this_target_name") |
| 1118 | |
| 1119 | deps += [ |
Byoungchan Lee | 1ce9a17 | 2024-04-30 08:14:18 | [diff] [blame] | 1120 | ":copy_privacy_manifest_$this_target_name", |
Byoungchan Lee | 26b23b8 | 2022-04-08 09:23:14 | [diff] [blame] | 1121 | ":copy_umbrella_header_$this_target_name", |
| 1122 | ":create_bracket_include_headers_$this_target_name", |
| 1123 | ] |
| 1124 | } |
Anders Carlsson | dc6b477 | 2018-01-15 12:31:03 | [diff] [blame] | 1125 | } |
| 1126 | |
Byoungchan Lee | 26b23b8 | 2022-04-08 09:23:14 | [diff] [blame] | 1127 | if (is_mac || target_environment == "catalyst") { |
Jordan Rose | 53d3fc9 | 2021-07-06 19:16:41 | [diff] [blame] | 1128 | # Catalyst frameworks use the same layout as regular Mac frameworks. |
| 1129 | headers_dir = "Versions/A/Headers" |
Byoungchan Lee | 1ce9a17 | 2024-04-30 08:14:18 | [diff] [blame] | 1130 | |
| 1131 | # The path to the privacy manifest file differs between Mac and iOS. |
| 1132 | # https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/adding_a_privacy_manifest_to_your_app_or_third-party_sdk |
| 1133 | privacy_manifest_out_path = "Versions/A/Resources/PrivacyInfo.xcprivacy" |
Jordan Rose | 53d3fc9 | 2021-07-06 19:16:41 | [diff] [blame] | 1134 | } else { |
| 1135 | headers_dir = "Headers" |
Byoungchan Lee | 1ce9a17 | 2024-04-30 08:14:18 | [diff] [blame] | 1136 | privacy_manifest_out_path = "PrivacyInfo.xcprivacy" |
Jordan Rose | 53d3fc9 | 2021-07-06 19:16:41 | [diff] [blame] | 1137 | } |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-16 22:49:28 | [diff] [blame] | 1138 | |
Anders Carlsson | 95c56ee | 2018-09-06 13:48:17 | [diff] [blame] | 1139 | bundle_data("copy_framework_headers_$this_target_name") { |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-16 22:49:28 | [diff] [blame] | 1140 | sources = get_target_outputs( |
| 1141 | ":create_bracket_include_headers_$this_target_name") |
Anders Carlsson | 37bbf79 | 2018-09-05 14:29:27 | [diff] [blame] | 1142 | |
Mirko Bonadei | ccbe95f | 2020-01-21 11:10:10 | [diff] [blame] | 1143 | outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ] |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-16 22:49:28 | [diff] [blame] | 1144 | deps = [ ":create_bracket_include_headers_$this_target_name" ] |
Anders Carlsson | 37bbf79 | 2018-09-05 14:29:27 | [diff] [blame] | 1145 | } |
| 1146 | |
Joel Sutherland | d2fb1bf | 2018-10-02 20:08:25 | [diff] [blame] | 1147 | action("modulemap_$this_target_name") { |
| 1148 | script = "//tools_webrtc/ios/generate_modulemap.py" |
| 1149 | args = [ |
| 1150 | "--out", |
| 1151 | rebase_path(modulemap_path, root_build_dir), |
| 1152 | "--name", |
| 1153 | output_name, |
| 1154 | ] |
Mirko Bonadei | ccbe95f | 2020-01-21 11:10:10 | [diff] [blame] | 1155 | outputs = [ modulemap_path ] |
Joel Sutherland | d2fb1bf | 2018-10-02 20:08:25 | [diff] [blame] | 1156 | } |
| 1157 | |
| 1158 | bundle_data("copy_modulemap_$this_target_name") { |
Mirko Bonadei | ccbe95f | 2020-01-21 11:10:10 | [diff] [blame] | 1159 | sources = [ modulemap_path ] |
| 1160 | outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ] |
| 1161 | deps = [ ":modulemap_$this_target_name" ] |
Joel Sutherland | d2fb1bf | 2018-10-02 20:08:25 | [diff] [blame] | 1162 | } |
| 1163 | |
Anders Carlsson | 95c56ee | 2018-09-06 13:48:17 | [diff] [blame] | 1164 | action("umbrella_header_$this_target_name") { |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-16 22:49:28 | [diff] [blame] | 1165 | sources = get_target_outputs( |
| 1166 | ":create_bracket_include_headers_$this_target_name") |
Anders Carlsson | 37bbf79 | 2018-09-05 14:29:27 | [diff] [blame] | 1167 | |
| 1168 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 1169 | |
Mirko Bonadei | ccbe95f | 2020-01-21 11:10:10 | [diff] [blame] | 1170 | outputs = [ umbrella_header_path ] |
Anders Carlsson | 37bbf79 | 2018-09-05 14:29:27 | [diff] [blame] | 1171 | args = [ |
| 1172 | "--out", |
| 1173 | rebase_path(umbrella_header_path, root_build_dir), |
| 1174 | "--sources", |
| 1175 | ] + sources |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-16 22:49:28 | [diff] [blame] | 1176 | deps = [ ":create_bracket_include_headers_$this_target_name" ] |
Anders Carlsson | 37bbf79 | 2018-09-05 14:29:27 | [diff] [blame] | 1177 | } |
| 1178 | |
Byoungchan Lee | 26b23b8 | 2022-04-08 09:23:14 | [diff] [blame] | 1179 | copy("copy_umbrella_header_$target_name") { |
Mirko Bonadei | ccbe95f | 2020-01-21 11:10:10 | [diff] [blame] | 1180 | sources = [ umbrella_header_path ] |
Byoungchan Lee | 26b23b8 | 2022-04-08 09:23:14 | [diff] [blame] | 1181 | outputs = |
| 1182 | [ "$root_out_dir/$output_name.framework/$headers_dir/$output_name.h" ] |
Anders Carlsson | 37bbf79 | 2018-09-05 14:29:27 | [diff] [blame] | 1183 | |
Byoungchan Lee | 26b23b8 | 2022-04-08 09:23:14 | [diff] [blame] | 1184 | deps = [ ":umbrella_header_$target_name" ] |
Anders Carlsson | 37bbf79 | 2018-09-05 14:29:27 | [diff] [blame] | 1185 | } |
Byoungchan Lee | 1ce9a17 | 2024-04-30 08:14:18 | [diff] [blame] | 1186 | |
| 1187 | action("create_privacy_manifest_$target_name") { |
| 1188 | script = "//tools_webrtc/apple/generate_privacy_manifest.py" |
| 1189 | |
| 1190 | args = [ |
| 1191 | "--output", |
| 1192 | rebase_path(privacy_manifest_path), |
| 1193 | ] |
| 1194 | |
| 1195 | outputs = [ privacy_manifest_path ] |
| 1196 | } |
| 1197 | |
| 1198 | copy("copy_privacy_manifest_$target_name") { |
| 1199 | sources = [ privacy_manifest_path ] |
| 1200 | outputs = |
| 1201 | [ "$root_out_dir/$output_name.framework/$privacy_manifest_out_path" ] |
| 1202 | |
| 1203 | deps = [ ":create_privacy_manifest_$target_name" ] |
| 1204 | } |
Anders Carlsson | 37bbf79 | 2018-09-05 14:29:27 | [diff] [blame] | 1205 | } |
| 1206 | } |
| 1207 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 | [diff] [blame] | 1208 | if (is_android) { |
| 1209 | template("rtc_android_library") { |
| 1210 | android_library(target_name) { |
| 1211 | forward_variables_from(invoker, |
| 1212 | "*", |
| 1213 | [ |
| 1214 | "configs", |
| 1215 | "public_configs", |
| 1216 | "suppressed_configs", |
| 1217 | "visibility", |
| 1218 | ]) |
| 1219 | |
Sami Kalliomäki | e7fac68 | 2018-03-20 15:32:49 | [diff] [blame] | 1220 | # Add any arguments defined by the invoker. |
Oleh Prypin | 05aee74 | 2018-11-23 16:29:44 | [diff] [blame] | 1221 | if (defined(invoker.errorprone_args)) { |
Andrew Grieve | 046c979 | 2025-01-20 16:29:38 | [diff] [blame] | 1222 | errorprone_args = invoker.errorprone_args |
Sami Kalliomäki | e7fac68 | 2018-03-20 15:32:49 | [diff] [blame] | 1223 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 | [diff] [blame] | 1224 | |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 19:23:41 | [diff] [blame] | 1225 | not_needed([ "android_manifest" ]) |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 | [diff] [blame] | 1226 | } |
| 1227 | } |
| 1228 | |
| 1229 | template("rtc_android_apk") { |
| 1230 | android_apk(target_name) { |
| 1231 | forward_variables_from(invoker, |
| 1232 | "*", |
| 1233 | [ |
| 1234 | "configs", |
| 1235 | "public_configs", |
| 1236 | "suppressed_configs", |
| 1237 | "visibility", |
| 1238 | ]) |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 | [diff] [blame] | 1239 | } |
| 1240 | } |
| 1241 | |
| 1242 | template("rtc_instrumentation_test_apk") { |
| 1243 | instrumentation_test_apk(target_name) { |
| 1244 | forward_variables_from(invoker, |
| 1245 | "*", |
| 1246 | [ |
| 1247 | "configs", |
| 1248 | "public_configs", |
| 1249 | "suppressed_configs", |
| 1250 | "visibility", |
| 1251 | ]) |
Mirko Bonadei | a3b2dd4 | 2025-02-13 09:22:25 | [diff] [blame] | 1252 | deps += [ "//third_party/jni_zero:jni_zero_java" ] |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 | [diff] [blame] | 1253 | } |
| 1254 | } |
| 1255 | } |