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