mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 1 | # Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
| 2 | # |
| 3 | # Use of this source code is governed by a BSD-style license |
| 4 | # that can be found in the LICENSE file in the root of the source |
| 5 | # tree. An additional intellectual property rights grant can be found |
| 6 | # in the file PATENTS. All contributing project authors may |
| 7 | # be found in the AUTHORS file in the root of the source tree. |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 8 | import("//build/config/arm.gni") |
| 9 | import("//build/config/features.gni") |
| 10 | import("//build/config/mips.gni") |
| 11 | import("//build/config/sanitizers/sanitizers.gni") |
Tomas Popela | 318da51 | 2018-11-13 06:32:23 +0100 | [diff] [blame] | 12 | import("//build/config/sysroot.gni") |
ehmaldonado | 0d729b3 | 2017-02-10 01:38:23 -0800 | [diff] [blame] | 13 | import("//build/config/ui.gni") |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 14 | import("//build_overrides/build.gni") |
mbonadei | 9660627 | 2017-03-03 19:41:59 -0800 | [diff] [blame] | 15 | |
| 16 | if (!build_with_chromium && is_component_build) { |
| 17 | print("The Gn argument `is_component_build` is currently " + |
| 18 | "ignored for WebRTC builds.") |
| 19 | print("Component builds are supported by Chromium and the argument " + |
| 20 | "`is_component_build` makes it possible to create shared libraries " + |
| 21 | "instead of static libraries.") |
| 22 | print("If an app depends on WebRTC it makes sense to just depend on the " + |
| 23 | "WebRTC static library, so there is no difference between " + |
| 24 | "`is_component_build=true` and `is_component_build=false`.") |
| 25 | print( |
| 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 | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 30 | if (is_ios) { |
| 31 | import("//build/config/ios/rules.gni") |
| 32 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 33 | |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 34 | if (is_mac) { |
| 35 | import("//build/config/mac/rules.gni") |
| 36 | } |
| 37 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 38 | declare_args() { |
Mirko Bonadei | 028248c | 2018-10-10 12:19:02 +0200 | [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 10:37:11 +0200 | [diff] [blame] | 43 | # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which |
Mirko Bonadei | 7040090 | 2018-08-21 15:44:28 +0200 | [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 10:37:11 +0200 | [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 15:44:28 +0200 | [diff] [blame] | 55 | |
Mirko Bonadei | 906add4 | 2018-09-05 16:03:16 +0200 | [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 13:12:25 -0700 | [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 15:08:12 +0100 | [diff] [blame] | 67 | # Include the iLBC audio codec? |
| 68 | rtc_include_ilbc = true |
| 69 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 70 | # Disable this to avoid building the Opus audio codec. |
| 71 | rtc_include_opus = true |
| 72 | |
minyue | 2e03c66 | 2017-02-01 17:31:11 -0800 | [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 17:45:49 +0200 | [diff] [blame] | 75 | rtc_opus_support_120ms_ptime = true |
minyue | 2e03c66 | 2017-02-01 17:31:11 -0800 | [diff] [blame] | 76 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [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 06:58:22 -0800 | [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 | |
| 88 | # Selects fixed-point code where possible. |
| 89 | rtc_prefer_fixed_point = false |
| 90 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 91 | # Enable when an external authentication mechanism is used for performing |
| 92 | # packet authentication for RTP packets instead of libsrtp. |
| 93 | rtc_enable_external_auth = build_with_chromium |
| 94 | |
| 95 | # Selects whether debug dumps for the audio processing module |
| 96 | # should be generated. |
| 97 | apm_debug_dump = false |
| 98 | |
| 99 | # Set this to true to enable BWE test logging. |
| 100 | rtc_enable_bwe_test_logging = false |
| 101 | |
Joachim Bauch | 93e9134 | 2017-12-07 01:25:53 +0100 | [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 21:25:47 +0100 | [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 06:32:23 +0100 | [diff] [blame] | 111 | # Set this to use PipeWire on the Wayland display server. |
Tomas Popela | 762543f | 2018-12-12 14:37:51 +0100 | [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. |
| 115 | rtc_use_pipewire = is_desktop_linux && use_sysroot |
| 116 | |
| 117 | # Set this to link PipeWire directly instead of using the dlopen. |
| 118 | rtc_link_pipewire = false |
Tomas Popela | 318da51 | 2018-11-13 06:32:23 +0100 | [diff] [blame] | 119 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 120 | # Enable to use the Mozilla internal settings. |
| 121 | build_with_mozilla = false |
| 122 | |
henrika | 883d00f | 2018-03-16 10:09:49 +0100 | [diff] [blame] | 123 | # Enable use of Android AAudio which requires Android SDK 26 or above and |
| 124 | # NDK r16 or above. |
| 125 | rtc_enable_android_aaudio = false |
| 126 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 127 | # Link-Time Optimizations. |
| 128 | # Executes code generation at link-time instead of compile-time. |
| 129 | # https://gcc.gnu.org/wiki/LinkTimeOptimization |
| 130 | rtc_use_lto = false |
| 131 | |
| 132 | # Set to "func", "block", "edge" for coverage generation. |
| 133 | # At unit test runtime set UBSAN_OPTIONS="coverage=1". |
| 134 | # It is recommend to set include_examples=0. |
| 135 | # Use llvm's sancov -html-report for human readable reports. |
| 136 | # See http://clang.llvm.org/docs/SanitizerCoverage.html . |
| 137 | rtc_sanitize_coverage = "" |
| 138 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 139 | if (current_cpu == "arm" || current_cpu == "arm64") { |
| 140 | rtc_prefer_fixed_point = true |
| 141 | } |
| 142 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 143 | # Determines whether NEON code will be built. |
| 144 | rtc_build_with_neon = |
| 145 | (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64" |
| 146 | |
| 147 | # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on |
| 148 | # all platforms except Android and iOS. Because FFmpeg can be built |
| 149 | # with/without H.264 support, |ffmpeg_branding| has to separately be set to a |
| 150 | # value that includes H.264, for example "Chrome". If FFmpeg is built without |
Sergey Silkin | fe288eb | 2018-06-25 16:22:38 +0200 | [diff] [blame] | 151 | # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 152 | # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. |
| 153 | # http://www.openh264.org, https://www.ffmpeg.org/ |
Mirko Bonadei | ee0a85c | 2019-01-15 10:47:18 +0100 | [diff] [blame] | 154 | # |
| 155 | # Enabling H264 when building with MSVC is currently not supported, see |
| 156 | # bugs.webrtc.org/9213#c13 for more info. |
| 157 | rtc_use_h264 = |
| 158 | proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang) |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 159 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 160 | # By default, use normal platform audio support or dummy audio, but don't |
| 161 | # use file-based audio playout and record. |
| 162 | rtc_use_dummy_audio_file_devices = false |
| 163 | |
henrika | 7be7883 | 2017-06-13 17:34:16 +0200 | [diff] [blame] | 164 | # When set to true, replace the audio output with a sinus tone at 440Hz. |
| 165 | # The ADM will ask for audio data from WebRTC but instead of reading real |
| 166 | # audio samples from NetEQ, a sinus tone will be generated and replace the |
| 167 | # real audio samples. |
| 168 | rtc_audio_device_plays_sinus_tone = false |
| 169 | |
Anders Carlsson | 358f2e0 | 2018-06-04 10:24:37 +0200 | [diff] [blame] | 170 | if (is_ios) { |
| 171 | # Build broadcast extension in AppRTCMobile for iOS. This results in the |
| 172 | # binary only running on iOS 11+, which is why it is disabled by default. |
| 173 | rtc_apprtcmobile_broadcast_extension = false |
| 174 | } |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 175 | |
| 176 | # Determines whether Metal is available on iOS/macOS. |
| 177 | rtc_use_metal_rendering = is_mac || (is_ios && current_cpu == "arm64") |
Jiawei Ou | 0874530 | 2019-02-12 11:36:13 -0800 | [diff] [blame] | 178 | |
| 179 | # When set to false, builtin audio encoder/decoder factories and all the |
| 180 | # audio codecs they depend on will not be included in libwebrtc.{a|lib} |
| 181 | # (they will still be included in libjingle_peerconnection_so.so and |
| 182 | # WebRTC.framework) |
| 183 | rtc_include_builtin_audio_codecs = true |
| 184 | |
| 185 | # When set to false, builtin video encoder/decoder factories and all the |
| 186 | # video codecs they depends on will not be included in libwebrtc.{a|lib} |
| 187 | # (they will still be included in libjingle_peerconnection_so.so and |
| 188 | # WebRTC.framework) |
| 189 | rtc_include_builtin_video_codecs = true |
Mirko Bonadei | 20574f4 | 2019-03-28 07:50:07 +0100 | [diff] [blame] | 190 | |
| 191 | # When set to true and in a standalone build, it will undefine UNICODE and |
| 192 | # _UNICODE (which are always defined globally by the Chromium Windows |
| 193 | # toolchain). |
| 194 | # This is only needed for testing purposes, WebRTC wants to be sure it |
| 195 | # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses |
| 196 | # wide character functions. |
| 197 | rtc_win_undef_unicode = false |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 198 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 199 | |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 200 | if (!build_with_mozilla) { |
| 201 | import("//testing/test.gni") |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 202 | } |
| 203 | |
| 204 | # A second declare_args block, so that declarations within it can |
| 205 | # depend on the possibly overridden variables in the first |
| 206 | # declare_args block. |
| 207 | declare_args() { |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 208 | # Enables the use of protocol buffers for debug recordings. |
| 209 | rtc_enable_protobuf = !build_with_mozilla |
| 210 | |
| 211 | # Set this to disable building with support for SCTP data channels. |
| 212 | rtc_enable_sctp = !build_with_mozilla |
| 213 | |
| 214 | # Disable these to not build components which can be externally provided. |
| 215 | rtc_build_json = !build_with_mozilla |
| 216 | rtc_build_libsrtp = !build_with_mozilla |
| 217 | rtc_build_libvpx = !build_with_mozilla |
| 218 | rtc_libvpx_build_vp9 = !build_with_mozilla |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 219 | rtc_build_opus = !build_with_mozilla |
| 220 | rtc_build_ssl = !build_with_mozilla |
| 221 | rtc_build_usrsctp = !build_with_mozilla |
| 222 | |
| 223 | # Enable libevent task queues on platforms that support it. |
Wez | 00cecb9 | 2018-02-09 10:41:00 -0800 | [diff] [blame] | 224 | if (is_win || is_mac || is_ios || is_nacl || is_fuchsia) { |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 225 | rtc_enable_libevent = false |
| 226 | rtc_build_libevent = false |
| 227 | } else { |
| 228 | rtc_enable_libevent = true |
| 229 | rtc_build_libevent = !build_with_mozilla |
| 230 | } |
| 231 | |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 232 | # Build sources requiring GTK. NOTICE: This is not present in Chrome OS |
| 233 | # build environments, even if available for Chromium builds. |
| 234 | rtc_use_gtk = !build_with_chromium && !build_with_mozilla |
| 235 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 236 | # Excluded in Chromium since its prerequisites don't require Pulse Audio. |
| 237 | rtc_include_pulse_audio = !build_with_chromium |
| 238 | |
| 239 | # Chromium uses its own IO handling, so the internal ADM is only built for |
| 240 | # standalone WebRTC. |
| 241 | rtc_include_internal_audio_device = !build_with_chromium |
| 242 | |
| 243 | # Include tests in standalone checkout. |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 244 | rtc_include_tests = !build_with_chromium && !build_with_mozilla |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | # Make it possible to provide custom locations for some libraries (move these |
| 248 | # up into declare_args should we need to actually use them for the GN build). |
| 249 | rtc_libvpx_dir = "//third_party/libvpx" |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 250 | rtc_opus_dir = "//third_party/opus" |
| 251 | |
| 252 | # Desktop capturer is supported only on Windows, OSX and Linux. |
Robin Raymond | ce1b140 | 2018-11-22 20:10:11 -0500 | [diff] [blame] | 253 | rtc_desktop_capture_supported = (is_win && current_os != "winuwp") || is_mac || |
| 254 | (is_linux && (rtc_use_x11 || rtc_use_pipewire)) |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 255 | |
| 256 | ############################################################################### |
| 257 | # Templates |
| 258 | # |
| 259 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 260 | # Points to // in webrtc stand-alone or to //third_party/webrtc/ in |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 261 | # chromium. |
| 262 | # We need absolute paths for all configs in templates as they are shared in |
| 263 | # different subdirectories. |
| 264 | webrtc_root = get_path_info(".", "abspath") |
| 265 | |
| 266 | # Global configuration that should be applied to all WebRTC targets. |
| 267 | # You normally shouldn't need to include this in your target as it's |
| 268 | # automatically included when using the rtc_* templates. |
| 269 | # It sets defines, include paths and compilation warnings accordingly, |
| 270 | # both for WebRTC stand-alone builds and for the scenario when WebRTC |
| 271 | # native code is built as part of Chromium. |
Will Harris | fc173d0 | 2018-08-29 13:56:00 -0700 | [diff] [blame] | 272 | rtc_common_configs = [ |
| 273 | webrtc_root + ":common_config", |
| 274 | "//build/config/compiler:no_size_t_to_int_warning", |
| 275 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 276 | |
kthelgason | c097710 | 2017-04-24 00:57:16 -0700 | [diff] [blame] | 277 | if (is_mac || is_ios) { |
| 278 | rtc_common_configs += [ "//build/config/compiler:enable_arc" ] |
| 279 | } |
| 280 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 281 | # Global public configuration that should be applied to all WebRTC targets. You |
| 282 | # normally shouldn't need to include this in your target as it's automatically |
| 283 | # included when using the rtc_* templates. It set the defines, include paths and |
| 284 | # compilation warnings that should be propagated to dependents of the targets |
| 285 | # depending on the target having this config. |
| 286 | rtc_common_inherited_config = webrtc_root + ":common_inherited_config" |
| 287 | |
| 288 | # Common configs to remove or add in all rtc targets. |
| 289 | rtc_remove_configs = [] |
Mirko Bonadei | fc52b91 | 2019-03-01 10:32:56 +0100 | [diff] [blame] | 290 | if (!build_with_chromium && is_clang) { |
| 291 | rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 292 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 293 | rtc_add_configs = rtc_common_configs |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 294 | rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ] |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame] | 295 | rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 296 | |
| 297 | set_defaults("rtc_test") { |
| 298 | configs = rtc_add_configs |
| 299 | suppressed_configs = [] |
| 300 | } |
| 301 | |
| 302 | set_defaults("rtc_source_set") { |
| 303 | configs = rtc_add_configs |
| 304 | suppressed_configs = [] |
| 305 | } |
| 306 | |
| 307 | set_defaults("rtc_executable") { |
| 308 | configs = rtc_add_configs |
| 309 | suppressed_configs = [] |
| 310 | } |
| 311 | |
| 312 | set_defaults("rtc_static_library") { |
| 313 | configs = rtc_add_configs |
| 314 | suppressed_configs = [] |
| 315 | } |
| 316 | |
| 317 | set_defaults("rtc_shared_library") { |
| 318 | configs = rtc_add_configs |
| 319 | suppressed_configs = [] |
| 320 | } |
| 321 | |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 322 | webrtc_default_visibility = [ webrtc_root + "/*" ] |
| 323 | if (build_with_chromium) { |
| 324 | # Allow Chromium's WebRTC overrides targets to bypass the regular |
| 325 | # visibility restrictions. |
| 326 | webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ] |
| 327 | } |
| 328 | |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 329 | # ---- Poisons ---- |
| 330 | # |
| 331 | # The general idea is that some targets declare that they contain some |
| 332 | # kind of poison, which makes it impossible for other targets to |
| 333 | # depend on them (even transitively) unless they declare themselves |
| 334 | # immune to that particular type of poison. |
| 335 | # |
| 336 | # Targets that *contain* poison of type foo should contain the line |
| 337 | # |
| 338 | # poisonous = [ "foo" ] |
| 339 | # |
| 340 | # and targets that *are immune but arent't themselves poisonous* |
| 341 | # should contain |
| 342 | # |
| 343 | # allow_poison = [ "foo" ] |
| 344 | # |
| 345 | # This useful in cases where we have some large target or set of |
| 346 | # targets and want to ensure that most other targets do not |
| 347 | # transitively depend on them. For example, almost no high-level |
| 348 | # target should depend on the audio codecs, since we want WebRTC users |
| 349 | # to be able to inject any subset of them and actually end up with a |
| 350 | # binary that doesn't include the codecs they didn't inject. |
| 351 | # |
| 352 | # Test-only targets (`testonly` set to true) and non-public targets |
| 353 | # (`visibility` not containing "*") are automatically immune to all |
| 354 | # types of poison. |
| 355 | # |
| 356 | # Here's the complete list of all types of poison. It must be kept in |
| 357 | # 1:1 correspondence with the set of //:poison_* targets. |
| 358 | # |
| 359 | all_poison_types = [ |
| 360 | # Encoders and decoders for specific audio codecs such as Opus and iSAC. |
| 361 | "audio_codecs", |
Anders Carlsson | 1f433e4 | 2018-04-24 16:39:05 +0200 | [diff] [blame] | 362 | |
| 363 | # Software video codecs (VP8 and VP9 through libvpx). |
| 364 | "software_video_codecs", |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 365 | ] |
| 366 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 367 | absl_include_config = "//third_party/abseil-cpp:absl_include_config" |
| 368 | absl_define_config = "//third_party/abseil-cpp:absl_define_config" |
| 369 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 370 | template("rtc_test") { |
| 371 | test(target_name) { |
| 372 | forward_variables_from(invoker, |
| 373 | "*", |
| 374 | [ |
| 375 | "configs", |
| 376 | "public_configs", |
| 377 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 378 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 379 | ]) |
Mirko Bonadei | dd41194 | 2017-11-21 15:35:27 +0100 | [diff] [blame] | 380 | |
| 381 | # Always override to public because when target_os is Android the `test` |
| 382 | # template can override it to [ "*" ] and we want to avoid conditional |
| 383 | # visibility. |
Mirko Bonadei | 2155881 | 2017-11-21 12:47:34 +0100 | [diff] [blame] | 384 | visibility = [ "*" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 385 | configs += invoker.configs |
| 386 | configs -= rtc_remove_configs |
| 387 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 388 | public_configs = [ |
| 389 | rtc_common_inherited_config, |
| 390 | absl_include_config, |
| 391 | absl_define_config, |
| 392 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 393 | if (defined(invoker.public_configs)) { |
| 394 | public_configs += invoker.public_configs |
| 395 | } |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 396 | if (!build_with_chromium && is_android) { |
Jianjun Zhu | 037f3e4 | 2017-08-15 21:48:37 +0800 | [diff] [blame] | 397 | android_manifest = webrtc_root + "test/android/AndroidManifest.xml" |
| 398 | deps += [ webrtc_root + "test:native_test_java" ] |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 399 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 400 | } |
| 401 | } |
| 402 | |
| 403 | template("rtc_source_set") { |
| 404 | source_set(target_name) { |
| 405 | forward_variables_from(invoker, |
| 406 | "*", |
| 407 | [ |
| 408 | "configs", |
| 409 | "public_configs", |
| 410 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 411 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 412 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 413 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 414 | if (!defined(visibility)) { |
| 415 | visibility = webrtc_default_visibility |
| 416 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 417 | |
| 418 | # What's your poison? |
| 419 | if (defined(testonly) && testonly) { |
| 420 | assert(!defined(poisonous)) |
| 421 | assert(!defined(allow_poison)) |
| 422 | } else { |
| 423 | if (!defined(poisonous)) { |
| 424 | poisonous = [] |
| 425 | } |
| 426 | if (!defined(allow_poison)) { |
| 427 | allow_poison = [] |
| 428 | } |
| 429 | if (!defined(assert_no_deps)) { |
| 430 | assert_no_deps = [] |
| 431 | } |
| 432 | if (!defined(deps)) { |
| 433 | deps = [] |
| 434 | } |
| 435 | foreach(p, poisonous) { |
| 436 | deps += [ webrtc_root + ":poison_" + p ] |
| 437 | } |
| 438 | foreach(poison_type, all_poison_types) { |
| 439 | allow_dep = true |
| 440 | foreach(v, visibility) { |
| 441 | if (v == "*") { |
| 442 | allow_dep = false |
| 443 | } |
| 444 | } |
| 445 | foreach(p, allow_poison + poisonous) { |
| 446 | if (p == poison_type) { |
| 447 | allow_dep = true |
| 448 | } |
| 449 | } |
| 450 | if (!allow_dep) { |
| 451 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 452 | } |
| 453 | } |
| 454 | } |
| 455 | |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 456 | if (!defined(testonly) || !testonly) { |
| 457 | configs += rtc_prod_configs |
| 458 | } |
| 459 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 460 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame] | 461 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 462 | configs -= rtc_remove_configs |
| 463 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 464 | public_configs = [ |
| 465 | rtc_common_inherited_config, |
| 466 | absl_include_config, |
| 467 | absl_define_config, |
| 468 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 469 | if (defined(invoker.public_configs)) { |
| 470 | public_configs += invoker.public_configs |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | |
| 475 | template("rtc_executable") { |
| 476 | executable(target_name) { |
| 477 | forward_variables_from(invoker, |
| 478 | "*", |
| 479 | [ |
| 480 | "deps", |
| 481 | "configs", |
| 482 | "public_configs", |
| 483 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 484 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 485 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 486 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 487 | if (!defined(visibility)) { |
| 488 | visibility = webrtc_default_visibility |
| 489 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 490 | configs += invoker.configs |
| 491 | configs -= rtc_remove_configs |
| 492 | configs -= invoker.suppressed_configs |
Tom Anderson | 9614a31 | 2018-06-11 15:10:34 -0700 | [diff] [blame] | 493 | deps = invoker.deps |
perkj | 650fdae | 2017-08-25 05:00:11 -0700 | [diff] [blame] | 494 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 495 | public_configs = [ |
| 496 | rtc_common_inherited_config, |
| 497 | absl_include_config, |
| 498 | absl_define_config, |
| 499 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 500 | if (defined(invoker.public_configs)) { |
| 501 | public_configs += invoker.public_configs |
| 502 | } |
Mirko Bonadei | 9427f48 | 2018-08-28 14:39:27 +0200 | [diff] [blame] | 503 | if (is_win) { |
| 504 | deps += [ |
| 505 | # Give executables the default manifest on Windows (a no-op elsewhere). |
| 506 | "//build/win:default_exe_manifest", |
| 507 | ] |
| 508 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 509 | } |
| 510 | } |
| 511 | |
| 512 | template("rtc_static_library") { |
| 513 | static_library(target_name) { |
| 514 | forward_variables_from(invoker, |
| 515 | "*", |
| 516 | [ |
| 517 | "configs", |
| 518 | "public_configs", |
| 519 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 520 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 521 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 522 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 523 | if (!defined(visibility)) { |
| 524 | visibility = webrtc_default_visibility |
| 525 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [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 | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 565 | if (!defined(testonly) || !testonly) { |
| 566 | configs += rtc_prod_configs |
| 567 | } |
| 568 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 569 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame] | 570 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 571 | configs -= rtc_remove_configs |
| 572 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 573 | public_configs = [ |
| 574 | rtc_common_inherited_config, |
| 575 | absl_include_config, |
| 576 | absl_define_config, |
| 577 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 578 | if (defined(invoker.public_configs)) { |
| 579 | public_configs += invoker.public_configs |
| 580 | } |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | template("rtc_shared_library") { |
| 585 | shared_library(target_name) { |
| 586 | forward_variables_from(invoker, |
| 587 | "*", |
| 588 | [ |
| 589 | "configs", |
| 590 | "public_configs", |
| 591 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 592 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 593 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 594 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 595 | if (!defined(visibility)) { |
| 596 | visibility = webrtc_default_visibility |
| 597 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 598 | |
| 599 | # What's your poison? |
| 600 | if (defined(testonly) && testonly) { |
| 601 | assert(!defined(poisonous)) |
| 602 | assert(!defined(allow_poison)) |
| 603 | } else { |
| 604 | if (!defined(poisonous)) { |
| 605 | poisonous = [] |
| 606 | } |
| 607 | if (!defined(allow_poison)) { |
| 608 | allow_poison = [] |
| 609 | } |
| 610 | if (!defined(assert_no_deps)) { |
| 611 | assert_no_deps = [] |
| 612 | } |
| 613 | if (!defined(deps)) { |
| 614 | deps = [] |
| 615 | } |
| 616 | foreach(p, poisonous) { |
| 617 | deps += [ webrtc_root + ":poison_" + p ] |
| 618 | } |
| 619 | foreach(poison_type, all_poison_types) { |
| 620 | allow_dep = true |
| 621 | foreach(v, visibility) { |
| 622 | if (v == "*") { |
| 623 | allow_dep = false |
| 624 | } |
| 625 | } |
| 626 | foreach(p, allow_poison + poisonous) { |
| 627 | if (p == poison_type) { |
| 628 | allow_dep = true |
| 629 | } |
| 630 | } |
| 631 | if (!allow_dep) { |
| 632 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 633 | } |
| 634 | } |
| 635 | } |
| 636 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 637 | configs += invoker.configs |
| 638 | configs -= rtc_remove_configs |
| 639 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 640 | public_configs = [ |
| 641 | rtc_common_inherited_config, |
| 642 | absl_include_config, |
| 643 | absl_define_config, |
| 644 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 645 | if (defined(invoker.public_configs)) { |
| 646 | public_configs += invoker.public_configs |
| 647 | } |
| 648 | } |
| 649 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 650 | |
| 651 | if (is_ios) { |
| 652 | set_defaults("rtc_ios_xctest_test") { |
| 653 | configs = rtc_add_configs |
| 654 | suppressed_configs = [] |
| 655 | } |
| 656 | |
| 657 | template("rtc_ios_xctest_test") { |
| 658 | ios_xctest_test(target_name) { |
| 659 | forward_variables_from(invoker, |
| 660 | "*", |
| 661 | [ |
| 662 | "configs", |
| 663 | "public_configs", |
| 664 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 665 | "visibility", |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 666 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 667 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 668 | if (!defined(visibility)) { |
| 669 | visibility = webrtc_default_visibility |
| 670 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 671 | configs += invoker.configs |
| 672 | configs -= rtc_remove_configs |
| 673 | configs -= invoker.suppressed_configs |
| 674 | public_configs = [ rtc_common_inherited_config ] |
| 675 | if (defined(invoker.public_configs)) { |
| 676 | public_configs += invoker.public_configs |
| 677 | } |
| 678 | } |
| 679 | } |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 680 | |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 681 | # TODO: Generate module.modulemap file to enable use in Swift |
| 682 | # projects. See "mac_framework_bundle_with_umbrella_header". |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 683 | template("ios_framework_bundle_with_umbrella_header") { |
| 684 | forward_variables_from(invoker, [ "output_name" ]) |
| 685 | umbrella_header_path = |
| 686 | "$target_gen_dir/$output_name.framework/Headers/$output_name.h" |
| 687 | |
| 688 | ios_framework_bundle(target_name) { |
| 689 | forward_variables_from(invoker, "*", []) |
| 690 | |
| 691 | deps += [ ":copy_umbrella_header_$target_name" ] |
| 692 | } |
| 693 | |
| 694 | action("umbrella_header_$target_name") { |
| 695 | forward_variables_from(invoker, [ "public_headers" ]) |
| 696 | |
| 697 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 698 | |
| 699 | outputs = [ |
| 700 | umbrella_header_path, |
| 701 | ] |
| 702 | args = [ |
| 703 | "--out", |
| 704 | rebase_path(umbrella_header_path, root_build_dir), |
| 705 | "--sources", |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 706 | ] + public_headers |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 707 | } |
| 708 | |
| 709 | copy("copy_umbrella_header_$target_name") { |
| 710 | sources = [ |
| 711 | umbrella_header_path, |
| 712 | ] |
| 713 | outputs = [ |
| 714 | "$root_out_dir/$output_name.framework/Headers/$output_name.h", |
| 715 | ] |
| 716 | |
| 717 | deps = [ |
| 718 | ":umbrella_header_$target_name", |
| 719 | ] |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | set_defaults("ios_framework_bundle_with_umbrella_header") { |
| 724 | configs = default_shared_library_configs |
| 725 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 726 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 727 | |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 728 | if (is_mac) { |
| 729 | template("mac_framework_bundle_with_umbrella_header") { |
| 730 | forward_variables_from(invoker, [ "output_name" ]) |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 731 | this_target_name = target_name |
| 732 | umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h" |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 733 | modulemap_path = "$target_gen_dir/Modules/module.modulemap" |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 734 | |
| 735 | mac_framework_bundle(target_name) { |
Thomas Anderson | 6fde78c | 2019-01-23 10:40:29 -0800 | [diff] [blame] | 736 | forward_variables_from(invoker, "*", [ "configs" ]) |
| 737 | if (defined(invoker.configs)) { |
| 738 | configs += invoker.configs |
| 739 | } |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 740 | |
| 741 | framework_version = "A" |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 742 | framework_contents = [ |
| 743 | "Headers", |
| 744 | "Modules", |
| 745 | "Resources", |
| 746 | ] |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 747 | |
| 748 | ldflags = [ |
| 749 | "-all_load", |
| 750 | "-install_name", |
| 751 | "@rpath/$output_name.framework/$output_name", |
| 752 | ] |
| 753 | |
| 754 | deps += [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 755 | ":copy_framework_headers_$this_target_name", |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 756 | ":copy_modulemap_$this_target_name", |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 757 | ":copy_umbrella_header_$this_target_name", |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 758 | ":modulemap_$this_target_name", |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 759 | ":umbrella_header_$this_target_name", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 760 | ] |
| 761 | } |
| 762 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 763 | bundle_data("copy_framework_headers_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 764 | forward_variables_from(invoker, [ "sources" ]) |
| 765 | |
| 766 | outputs = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 767 | "{{bundle_contents_dir}}/Headers/{{source_file_part}}", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 768 | ] |
| 769 | } |
| 770 | |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 771 | action("modulemap_$this_target_name") { |
| 772 | script = "//tools_webrtc/ios/generate_modulemap.py" |
| 773 | args = [ |
| 774 | "--out", |
| 775 | rebase_path(modulemap_path, root_build_dir), |
| 776 | "--name", |
| 777 | output_name, |
| 778 | ] |
| 779 | outputs = [ |
| 780 | modulemap_path, |
| 781 | ] |
| 782 | } |
| 783 | |
| 784 | bundle_data("copy_modulemap_$this_target_name") { |
| 785 | sources = [ |
| 786 | modulemap_path, |
| 787 | ] |
| 788 | outputs = [ |
| 789 | "{{bundle_contents_dir}}/Modules/module.modulemap", |
| 790 | ] |
| 791 | deps = [ |
| 792 | ":modulemap_$this_target_name", |
| 793 | ] |
| 794 | } |
| 795 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 796 | action("umbrella_header_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 797 | forward_variables_from(invoker, [ "sources" ]) |
| 798 | |
| 799 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 800 | |
| 801 | outputs = [ |
| 802 | umbrella_header_path, |
| 803 | ] |
| 804 | args = [ |
| 805 | "--out", |
| 806 | rebase_path(umbrella_header_path, root_build_dir), |
| 807 | "--sources", |
| 808 | ] + sources |
| 809 | } |
| 810 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 811 | bundle_data("copy_umbrella_header_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 812 | sources = [ |
| 813 | umbrella_header_path, |
| 814 | ] |
| 815 | outputs = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 816 | "{{bundle_contents_dir}}/Headers/$output_name.h", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 817 | ] |
| 818 | |
| 819 | deps = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 820 | ":umbrella_header_$this_target_name", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 821 | ] |
| 822 | } |
| 823 | } |
| 824 | } |
| 825 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 826 | if (is_android) { |
| 827 | template("rtc_android_library") { |
| 828 | android_library(target_name) { |
| 829 | forward_variables_from(invoker, |
| 830 | "*", |
| 831 | [ |
| 832 | "configs", |
| 833 | "public_configs", |
| 834 | "suppressed_configs", |
| 835 | "visibility", |
| 836 | ]) |
| 837 | |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 838 | errorprone_args = [] |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 839 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 840 | # Treat warnings as errors. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 841 | errorprone_args += [ "-Werror" ] |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 842 | |
Sami Kalliomäki | 68d5860 | 2019-01-24 12:56:12 +0100 | [diff] [blame] | 843 | # WebRTC supports API level 16 while Chromium only supports 19. |
| 844 | # (the manifest defines minimum supported SDK version) |
| 845 | if (defined(invoker.android_manifest_for_lint)) { |
| 846 | # Custom manifest defined by the target, use that one. |
| 847 | android_manifest_for_lint = invoker.android_manifest_for_lint |
| 848 | } else { |
| 849 | # Default manifest for WebRTC. |
| 850 | android_manifest_for_lint = "//sdk/android/AndroidManifest.xml" |
| 851 | } |
| 852 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 853 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 854 | if (!build_with_chromium) { |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 855 | errorprone_args += [ |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 856 | "-Xep:ParameterNotNullable:ERROR", |
| 857 | "-Xep:FieldMissingNullable:ERROR", |
| 858 | "-Xep:ReturnMissingNullable:ERROR", |
| 859 | ] |
| 860 | } |
| 861 | |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 862 | # Add any arguments defined by the invoker. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 863 | if (defined(invoker.errorprone_args)) { |
| 864 | errorprone_args += invoker.errorprone_args |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 865 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 866 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 867 | if (!defined(deps)) { |
| 868 | deps = [] |
| 869 | } |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 870 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 871 | no_build_hooks = true |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | template("rtc_android_apk") { |
| 876 | android_apk(target_name) { |
| 877 | forward_variables_from(invoker, |
| 878 | "*", |
| 879 | [ |
| 880 | "configs", |
| 881 | "public_configs", |
| 882 | "suppressed_configs", |
| 883 | "visibility", |
| 884 | ]) |
| 885 | |
| 886 | # Treat warnings as errors. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 887 | errorprone_args = [ "-Werror" ] |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 888 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 889 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 890 | if (!build_with_chromium) { |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 891 | errorprone_args += [ |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 892 | "-Xep:ParameterNotNullable:ERROR", |
| 893 | "-Xep:FieldMissingNullable:ERROR", |
| 894 | "-Xep:ReturnMissingNullable:ERROR", |
| 895 | ] |
| 896 | } |
| 897 | |
| 898 | if (!defined(deps)) { |
| 899 | deps = [] |
| 900 | } |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 901 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 902 | no_build_hooks = true |
| 903 | } |
| 904 | } |
| 905 | |
| 906 | template("rtc_instrumentation_test_apk") { |
| 907 | instrumentation_test_apk(target_name) { |
| 908 | forward_variables_from(invoker, |
| 909 | "*", |
| 910 | [ |
| 911 | "configs", |
| 912 | "public_configs", |
| 913 | "suppressed_configs", |
| 914 | "visibility", |
| 915 | ]) |
| 916 | |
| 917 | # Treat warnings as errors. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 918 | errorprone_args = [ "-Werror" ] |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 919 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 920 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 921 | if (!build_with_chromium) { |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 922 | errorprone_args += [ |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 923 | "-Xep:ParameterNotNullable:ERROR", |
| 924 | "-Xep:FieldMissingNullable:ERROR", |
| 925 | "-Xep:ReturnMissingNullable:ERROR", |
| 926 | ] |
| 927 | } |
| 928 | |
| 929 | if (!defined(deps)) { |
| 930 | deps = [] |
| 931 | } |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 932 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 933 | no_build_hooks = true |
| 934 | } |
| 935 | } |
| 936 | } |