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