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