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