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