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 |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 190 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 191 | |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 192 | if (!build_with_mozilla) { |
| 193 | import("//testing/test.gni") |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 194 | } |
| 195 | |
| 196 | # A second declare_args block, so that declarations within it can |
| 197 | # depend on the possibly overridden variables in the first |
| 198 | # declare_args block. |
| 199 | declare_args() { |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 200 | # Enables the use of protocol buffers for debug recordings. |
| 201 | rtc_enable_protobuf = !build_with_mozilla |
| 202 | |
| 203 | # Set this to disable building with support for SCTP data channels. |
| 204 | rtc_enable_sctp = !build_with_mozilla |
| 205 | |
| 206 | # Disable these to not build components which can be externally provided. |
| 207 | rtc_build_json = !build_with_mozilla |
| 208 | rtc_build_libsrtp = !build_with_mozilla |
| 209 | rtc_build_libvpx = !build_with_mozilla |
| 210 | rtc_libvpx_build_vp9 = !build_with_mozilla |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 211 | rtc_build_opus = !build_with_mozilla |
| 212 | rtc_build_ssl = !build_with_mozilla |
| 213 | rtc_build_usrsctp = !build_with_mozilla |
| 214 | |
| 215 | # Enable libevent task queues on platforms that support it. |
Wez | 00cecb9 | 2018-02-09 10:41:00 -0800 | [diff] [blame] | 216 | if (is_win || is_mac || is_ios || is_nacl || is_fuchsia) { |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 217 | rtc_enable_libevent = false |
| 218 | rtc_build_libevent = false |
| 219 | } else { |
| 220 | rtc_enable_libevent = true |
| 221 | rtc_build_libevent = !build_with_mozilla |
| 222 | } |
| 223 | |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 224 | # Build sources requiring GTK. NOTICE: This is not present in Chrome OS |
| 225 | # build environments, even if available for Chromium builds. |
| 226 | rtc_use_gtk = !build_with_chromium && !build_with_mozilla |
| 227 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 228 | # Excluded in Chromium since its prerequisites don't require Pulse Audio. |
| 229 | rtc_include_pulse_audio = !build_with_chromium |
| 230 | |
| 231 | # Chromium uses its own IO handling, so the internal ADM is only built for |
| 232 | # standalone WebRTC. |
| 233 | rtc_include_internal_audio_device = !build_with_chromium |
| 234 | |
| 235 | # Include tests in standalone checkout. |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 236 | rtc_include_tests = !build_with_chromium && !build_with_mozilla |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | # Make it possible to provide custom locations for some libraries (move these |
| 240 | # up into declare_args should we need to actually use them for the GN build). |
| 241 | rtc_libvpx_dir = "//third_party/libvpx" |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 242 | rtc_opus_dir = "//third_party/opus" |
| 243 | |
| 244 | # Desktop capturer is supported only on Windows, OSX and Linux. |
Robin Raymond | ce1b140 | 2018-11-22 20:10:11 -0500 | [diff] [blame] | 245 | rtc_desktop_capture_supported = (is_win && current_os != "winuwp") || is_mac || |
| 246 | (is_linux && (rtc_use_x11 || rtc_use_pipewire)) |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 247 | |
| 248 | ############################################################################### |
| 249 | # Templates |
| 250 | # |
| 251 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 252 | # Points to // in webrtc stand-alone or to //third_party/webrtc/ in |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 253 | # chromium. |
| 254 | # We need absolute paths for all configs in templates as they are shared in |
| 255 | # different subdirectories. |
| 256 | webrtc_root = get_path_info(".", "abspath") |
| 257 | |
| 258 | # Global configuration that should be applied to all WebRTC targets. |
| 259 | # You normally shouldn't need to include this in your target as it's |
| 260 | # automatically included when using the rtc_* templates. |
| 261 | # It sets defines, include paths and compilation warnings accordingly, |
| 262 | # both for WebRTC stand-alone builds and for the scenario when WebRTC |
| 263 | # native code is built as part of Chromium. |
Will Harris | fc173d0 | 2018-08-29 13:56:00 -0700 | [diff] [blame] | 264 | rtc_common_configs = [ |
| 265 | webrtc_root + ":common_config", |
| 266 | "//build/config/compiler:no_size_t_to_int_warning", |
| 267 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 268 | |
kthelgason | c097710 | 2017-04-24 00:57:16 -0700 | [diff] [blame] | 269 | if (is_mac || is_ios) { |
| 270 | rtc_common_configs += [ "//build/config/compiler:enable_arc" ] |
| 271 | } |
| 272 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 273 | # Global public configuration that should be applied to all WebRTC targets. You |
| 274 | # normally shouldn't need to include this in your target as it's automatically |
| 275 | # included when using the rtc_* templates. It set the defines, include paths and |
| 276 | # compilation warnings that should be propagated to dependents of the targets |
| 277 | # depending on the target having this config. |
| 278 | rtc_common_inherited_config = webrtc_root + ":common_inherited_config" |
| 279 | |
| 280 | # Common configs to remove or add in all rtc targets. |
| 281 | rtc_remove_configs = [] |
Mirko Bonadei | fc52b91 | 2019-03-01 10:32:56 +0100 | [diff] [blame] | 282 | if (!build_with_chromium && is_clang) { |
| 283 | rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 284 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 285 | rtc_add_configs = rtc_common_configs |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 286 | rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ] |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame] | 287 | rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 288 | |
| 289 | set_defaults("rtc_test") { |
| 290 | configs = rtc_add_configs |
| 291 | suppressed_configs = [] |
| 292 | } |
| 293 | |
| 294 | set_defaults("rtc_source_set") { |
| 295 | configs = rtc_add_configs |
| 296 | suppressed_configs = [] |
| 297 | } |
| 298 | |
| 299 | set_defaults("rtc_executable") { |
| 300 | configs = rtc_add_configs |
| 301 | suppressed_configs = [] |
| 302 | } |
| 303 | |
| 304 | set_defaults("rtc_static_library") { |
| 305 | configs = rtc_add_configs |
| 306 | suppressed_configs = [] |
| 307 | } |
| 308 | |
| 309 | set_defaults("rtc_shared_library") { |
| 310 | configs = rtc_add_configs |
| 311 | suppressed_configs = [] |
| 312 | } |
| 313 | |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 314 | webrtc_default_visibility = [ webrtc_root + "/*" ] |
| 315 | if (build_with_chromium) { |
| 316 | # Allow Chromium's WebRTC overrides targets to bypass the regular |
| 317 | # visibility restrictions. |
| 318 | webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ] |
| 319 | } |
| 320 | |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 321 | # ---- Poisons ---- |
| 322 | # |
| 323 | # The general idea is that some targets declare that they contain some |
| 324 | # kind of poison, which makes it impossible for other targets to |
| 325 | # depend on them (even transitively) unless they declare themselves |
| 326 | # immune to that particular type of poison. |
| 327 | # |
| 328 | # Targets that *contain* poison of type foo should contain the line |
| 329 | # |
| 330 | # poisonous = [ "foo" ] |
| 331 | # |
| 332 | # and targets that *are immune but arent't themselves poisonous* |
| 333 | # should contain |
| 334 | # |
| 335 | # allow_poison = [ "foo" ] |
| 336 | # |
| 337 | # This useful in cases where we have some large target or set of |
| 338 | # targets and want to ensure that most other targets do not |
| 339 | # transitively depend on them. For example, almost no high-level |
| 340 | # target should depend on the audio codecs, since we want WebRTC users |
| 341 | # to be able to inject any subset of them and actually end up with a |
| 342 | # binary that doesn't include the codecs they didn't inject. |
| 343 | # |
| 344 | # Test-only targets (`testonly` set to true) and non-public targets |
| 345 | # (`visibility` not containing "*") are automatically immune to all |
| 346 | # types of poison. |
| 347 | # |
| 348 | # Here's the complete list of all types of poison. It must be kept in |
| 349 | # 1:1 correspondence with the set of //:poison_* targets. |
| 350 | # |
| 351 | all_poison_types = [ |
| 352 | # Encoders and decoders for specific audio codecs such as Opus and iSAC. |
| 353 | "audio_codecs", |
Anders Carlsson | 1f433e4 | 2018-04-24 16:39:05 +0200 | [diff] [blame] | 354 | |
| 355 | # Software video codecs (VP8 and VP9 through libvpx). |
| 356 | "software_video_codecs", |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 357 | ] |
| 358 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 359 | absl_include_config = "//third_party/abseil-cpp:absl_include_config" |
| 360 | absl_define_config = "//third_party/abseil-cpp:absl_define_config" |
| 361 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 362 | template("rtc_test") { |
| 363 | test(target_name) { |
| 364 | forward_variables_from(invoker, |
| 365 | "*", |
| 366 | [ |
| 367 | "configs", |
| 368 | "public_configs", |
| 369 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 370 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 371 | ]) |
Mirko Bonadei | dd41194 | 2017-11-21 15:35:27 +0100 | [diff] [blame] | 372 | |
| 373 | # Always override to public because when target_os is Android the `test` |
| 374 | # template can override it to [ "*" ] and we want to avoid conditional |
| 375 | # visibility. |
Mirko Bonadei | 2155881 | 2017-11-21 12:47:34 +0100 | [diff] [blame] | 376 | visibility = [ "*" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 377 | configs += invoker.configs |
| 378 | configs -= rtc_remove_configs |
| 379 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 380 | public_configs = [ |
| 381 | rtc_common_inherited_config, |
| 382 | absl_include_config, |
| 383 | absl_define_config, |
| 384 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 385 | if (defined(invoker.public_configs)) { |
| 386 | public_configs += invoker.public_configs |
| 387 | } |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 388 | if (!build_with_chromium && is_android) { |
Jianjun Zhu | 037f3e4 | 2017-08-15 21:48:37 +0800 | [diff] [blame] | 389 | android_manifest = webrtc_root + "test/android/AndroidManifest.xml" |
| 390 | deps += [ webrtc_root + "test:native_test_java" ] |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 391 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 392 | } |
| 393 | } |
| 394 | |
| 395 | template("rtc_source_set") { |
| 396 | source_set(target_name) { |
| 397 | forward_variables_from(invoker, |
| 398 | "*", |
| 399 | [ |
| 400 | "configs", |
| 401 | "public_configs", |
| 402 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 403 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 404 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 405 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 406 | if (!defined(visibility)) { |
| 407 | visibility = webrtc_default_visibility |
| 408 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 409 | |
| 410 | # What's your poison? |
| 411 | if (defined(testonly) && testonly) { |
| 412 | assert(!defined(poisonous)) |
| 413 | assert(!defined(allow_poison)) |
| 414 | } else { |
| 415 | if (!defined(poisonous)) { |
| 416 | poisonous = [] |
| 417 | } |
| 418 | if (!defined(allow_poison)) { |
| 419 | allow_poison = [] |
| 420 | } |
| 421 | if (!defined(assert_no_deps)) { |
| 422 | assert_no_deps = [] |
| 423 | } |
| 424 | if (!defined(deps)) { |
| 425 | deps = [] |
| 426 | } |
| 427 | foreach(p, poisonous) { |
| 428 | deps += [ webrtc_root + ":poison_" + p ] |
| 429 | } |
| 430 | foreach(poison_type, all_poison_types) { |
| 431 | allow_dep = true |
| 432 | foreach(v, visibility) { |
| 433 | if (v == "*") { |
| 434 | allow_dep = false |
| 435 | } |
| 436 | } |
| 437 | foreach(p, allow_poison + poisonous) { |
| 438 | if (p == poison_type) { |
| 439 | allow_dep = true |
| 440 | } |
| 441 | } |
| 442 | if (!allow_dep) { |
| 443 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 444 | } |
| 445 | } |
| 446 | } |
| 447 | |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 448 | if (!defined(testonly) || !testonly) { |
| 449 | configs += rtc_prod_configs |
| 450 | } |
| 451 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 452 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame] | 453 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 454 | configs -= rtc_remove_configs |
| 455 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 456 | public_configs = [ |
| 457 | rtc_common_inherited_config, |
| 458 | absl_include_config, |
| 459 | absl_define_config, |
| 460 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 461 | if (defined(invoker.public_configs)) { |
| 462 | public_configs += invoker.public_configs |
| 463 | } |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | template("rtc_executable") { |
| 468 | executable(target_name) { |
| 469 | forward_variables_from(invoker, |
| 470 | "*", |
| 471 | [ |
| 472 | "deps", |
| 473 | "configs", |
| 474 | "public_configs", |
| 475 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 476 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 477 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 478 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 479 | if (!defined(visibility)) { |
| 480 | visibility = webrtc_default_visibility |
| 481 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 482 | configs += invoker.configs |
| 483 | configs -= rtc_remove_configs |
| 484 | configs -= invoker.suppressed_configs |
Tom Anderson | 9614a31 | 2018-06-11 15:10:34 -0700 | [diff] [blame] | 485 | deps = invoker.deps |
perkj | 650fdae | 2017-08-25 05:00:11 -0700 | [diff] [blame] | 486 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 487 | public_configs = [ |
| 488 | rtc_common_inherited_config, |
| 489 | absl_include_config, |
| 490 | absl_define_config, |
| 491 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 492 | if (defined(invoker.public_configs)) { |
| 493 | public_configs += invoker.public_configs |
| 494 | } |
Mirko Bonadei | 9427f48 | 2018-08-28 14:39:27 +0200 | [diff] [blame] | 495 | if (is_win) { |
| 496 | deps += [ |
| 497 | # Give executables the default manifest on Windows (a no-op elsewhere). |
| 498 | "//build/win:default_exe_manifest", |
| 499 | ] |
| 500 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 501 | } |
| 502 | } |
| 503 | |
| 504 | template("rtc_static_library") { |
| 505 | static_library(target_name) { |
| 506 | forward_variables_from(invoker, |
| 507 | "*", |
| 508 | [ |
| 509 | "configs", |
| 510 | "public_configs", |
| 511 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 512 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 513 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 514 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 515 | if (!defined(visibility)) { |
| 516 | visibility = webrtc_default_visibility |
| 517 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 518 | |
| 519 | # What's your poison? |
| 520 | if (defined(testonly) && testonly) { |
| 521 | assert(!defined(poisonous)) |
| 522 | assert(!defined(allow_poison)) |
| 523 | } else { |
| 524 | if (!defined(poisonous)) { |
| 525 | poisonous = [] |
| 526 | } |
| 527 | if (!defined(allow_poison)) { |
| 528 | allow_poison = [] |
| 529 | } |
| 530 | if (!defined(assert_no_deps)) { |
| 531 | assert_no_deps = [] |
| 532 | } |
| 533 | if (!defined(deps)) { |
| 534 | deps = [] |
| 535 | } |
| 536 | foreach(p, poisonous) { |
| 537 | deps += [ webrtc_root + ":poison_" + p ] |
| 538 | } |
| 539 | foreach(poison_type, all_poison_types) { |
| 540 | allow_dep = true |
| 541 | foreach(v, visibility) { |
| 542 | if (v == "*") { |
| 543 | allow_dep = false |
| 544 | } |
| 545 | } |
| 546 | foreach(p, allow_poison + poisonous) { |
| 547 | if (p == poison_type) { |
| 548 | allow_dep = true |
| 549 | } |
| 550 | } |
| 551 | if (!allow_dep) { |
| 552 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 553 | } |
| 554 | } |
| 555 | } |
| 556 | |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 557 | if (!defined(testonly) || !testonly) { |
| 558 | configs += rtc_prod_configs |
| 559 | } |
| 560 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 561 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame] | 562 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 563 | configs -= rtc_remove_configs |
| 564 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 565 | public_configs = [ |
| 566 | rtc_common_inherited_config, |
| 567 | absl_include_config, |
| 568 | absl_define_config, |
| 569 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 570 | if (defined(invoker.public_configs)) { |
| 571 | public_configs += invoker.public_configs |
| 572 | } |
| 573 | } |
| 574 | } |
| 575 | |
| 576 | template("rtc_shared_library") { |
| 577 | shared_library(target_name) { |
| 578 | forward_variables_from(invoker, |
| 579 | "*", |
| 580 | [ |
| 581 | "configs", |
| 582 | "public_configs", |
| 583 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 584 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 585 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 586 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 587 | if (!defined(visibility)) { |
| 588 | visibility = webrtc_default_visibility |
| 589 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 590 | |
| 591 | # What's your poison? |
| 592 | if (defined(testonly) && testonly) { |
| 593 | assert(!defined(poisonous)) |
| 594 | assert(!defined(allow_poison)) |
| 595 | } else { |
| 596 | if (!defined(poisonous)) { |
| 597 | poisonous = [] |
| 598 | } |
| 599 | if (!defined(allow_poison)) { |
| 600 | allow_poison = [] |
| 601 | } |
| 602 | if (!defined(assert_no_deps)) { |
| 603 | assert_no_deps = [] |
| 604 | } |
| 605 | if (!defined(deps)) { |
| 606 | deps = [] |
| 607 | } |
| 608 | foreach(p, poisonous) { |
| 609 | deps += [ webrtc_root + ":poison_" + p ] |
| 610 | } |
| 611 | foreach(poison_type, all_poison_types) { |
| 612 | allow_dep = true |
| 613 | foreach(v, visibility) { |
| 614 | if (v == "*") { |
| 615 | allow_dep = false |
| 616 | } |
| 617 | } |
| 618 | foreach(p, allow_poison + poisonous) { |
| 619 | if (p == poison_type) { |
| 620 | allow_dep = true |
| 621 | } |
| 622 | } |
| 623 | if (!allow_dep) { |
| 624 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 625 | } |
| 626 | } |
| 627 | } |
| 628 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 629 | configs += invoker.configs |
| 630 | configs -= rtc_remove_configs |
| 631 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 632 | public_configs = [ |
| 633 | rtc_common_inherited_config, |
| 634 | absl_include_config, |
| 635 | absl_define_config, |
| 636 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 637 | if (defined(invoker.public_configs)) { |
| 638 | public_configs += invoker.public_configs |
| 639 | } |
| 640 | } |
| 641 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 642 | |
| 643 | if (is_ios) { |
| 644 | set_defaults("rtc_ios_xctest_test") { |
| 645 | configs = rtc_add_configs |
| 646 | suppressed_configs = [] |
| 647 | } |
| 648 | |
| 649 | template("rtc_ios_xctest_test") { |
| 650 | ios_xctest_test(target_name) { |
| 651 | forward_variables_from(invoker, |
| 652 | "*", |
| 653 | [ |
| 654 | "configs", |
| 655 | "public_configs", |
| 656 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 657 | "visibility", |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 658 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 659 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 660 | if (!defined(visibility)) { |
| 661 | visibility = webrtc_default_visibility |
| 662 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 663 | configs += invoker.configs |
| 664 | configs -= rtc_remove_configs |
| 665 | configs -= invoker.suppressed_configs |
| 666 | public_configs = [ rtc_common_inherited_config ] |
| 667 | if (defined(invoker.public_configs)) { |
| 668 | public_configs += invoker.public_configs |
| 669 | } |
| 670 | } |
| 671 | } |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 672 | |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 673 | # TODO: Generate module.modulemap file to enable use in Swift |
| 674 | # projects. See "mac_framework_bundle_with_umbrella_header". |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 675 | template("ios_framework_bundle_with_umbrella_header") { |
| 676 | forward_variables_from(invoker, [ "output_name" ]) |
| 677 | umbrella_header_path = |
| 678 | "$target_gen_dir/$output_name.framework/Headers/$output_name.h" |
| 679 | |
| 680 | ios_framework_bundle(target_name) { |
| 681 | forward_variables_from(invoker, "*", []) |
| 682 | |
| 683 | deps += [ ":copy_umbrella_header_$target_name" ] |
| 684 | } |
| 685 | |
| 686 | action("umbrella_header_$target_name") { |
| 687 | forward_variables_from(invoker, [ "public_headers" ]) |
| 688 | |
| 689 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 690 | |
| 691 | outputs = [ |
| 692 | umbrella_header_path, |
| 693 | ] |
| 694 | args = [ |
| 695 | "--out", |
| 696 | rebase_path(umbrella_header_path, root_build_dir), |
| 697 | "--sources", |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 698 | ] + public_headers |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 699 | } |
| 700 | |
| 701 | copy("copy_umbrella_header_$target_name") { |
| 702 | sources = [ |
| 703 | umbrella_header_path, |
| 704 | ] |
| 705 | outputs = [ |
| 706 | "$root_out_dir/$output_name.framework/Headers/$output_name.h", |
| 707 | ] |
| 708 | |
| 709 | deps = [ |
| 710 | ":umbrella_header_$target_name", |
| 711 | ] |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | set_defaults("ios_framework_bundle_with_umbrella_header") { |
| 716 | configs = default_shared_library_configs |
| 717 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 718 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 719 | |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 720 | if (is_mac) { |
| 721 | template("mac_framework_bundle_with_umbrella_header") { |
| 722 | forward_variables_from(invoker, [ "output_name" ]) |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 723 | this_target_name = target_name |
| 724 | umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h" |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 725 | modulemap_path = "$target_gen_dir/Modules/module.modulemap" |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 726 | |
| 727 | mac_framework_bundle(target_name) { |
Thomas Anderson | 6fde78c | 2019-01-23 10:40:29 -0800 | [diff] [blame] | 728 | forward_variables_from(invoker, "*", [ "configs" ]) |
| 729 | if (defined(invoker.configs)) { |
| 730 | configs += invoker.configs |
| 731 | } |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 732 | |
| 733 | framework_version = "A" |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 734 | framework_contents = [ |
| 735 | "Headers", |
| 736 | "Modules", |
| 737 | "Resources", |
| 738 | ] |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 739 | |
| 740 | ldflags = [ |
| 741 | "-all_load", |
| 742 | "-install_name", |
| 743 | "@rpath/$output_name.framework/$output_name", |
| 744 | ] |
| 745 | |
| 746 | deps += [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 747 | ":copy_framework_headers_$this_target_name", |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 748 | ":copy_modulemap_$this_target_name", |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 749 | ":copy_umbrella_header_$this_target_name", |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 750 | ":modulemap_$this_target_name", |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 751 | ":umbrella_header_$this_target_name", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 752 | ] |
| 753 | } |
| 754 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 755 | bundle_data("copy_framework_headers_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 756 | forward_variables_from(invoker, [ "sources" ]) |
| 757 | |
| 758 | outputs = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 759 | "{{bundle_contents_dir}}/Headers/{{source_file_part}}", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 760 | ] |
| 761 | } |
| 762 | |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 763 | action("modulemap_$this_target_name") { |
| 764 | script = "//tools_webrtc/ios/generate_modulemap.py" |
| 765 | args = [ |
| 766 | "--out", |
| 767 | rebase_path(modulemap_path, root_build_dir), |
| 768 | "--name", |
| 769 | output_name, |
| 770 | ] |
| 771 | outputs = [ |
| 772 | modulemap_path, |
| 773 | ] |
| 774 | } |
| 775 | |
| 776 | bundle_data("copy_modulemap_$this_target_name") { |
| 777 | sources = [ |
| 778 | modulemap_path, |
| 779 | ] |
| 780 | outputs = [ |
| 781 | "{{bundle_contents_dir}}/Modules/module.modulemap", |
| 782 | ] |
| 783 | deps = [ |
| 784 | ":modulemap_$this_target_name", |
| 785 | ] |
| 786 | } |
| 787 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 788 | action("umbrella_header_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 789 | forward_variables_from(invoker, [ "sources" ]) |
| 790 | |
| 791 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 792 | |
| 793 | outputs = [ |
| 794 | umbrella_header_path, |
| 795 | ] |
| 796 | args = [ |
| 797 | "--out", |
| 798 | rebase_path(umbrella_header_path, root_build_dir), |
| 799 | "--sources", |
| 800 | ] + sources |
| 801 | } |
| 802 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 803 | bundle_data("copy_umbrella_header_$this_target_name") { |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 804 | sources = [ |
| 805 | umbrella_header_path, |
| 806 | ] |
| 807 | outputs = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 808 | "{{bundle_contents_dir}}/Headers/$output_name.h", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 809 | ] |
| 810 | |
| 811 | deps = [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 812 | ":umbrella_header_$this_target_name", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 813 | ] |
| 814 | } |
| 815 | } |
| 816 | } |
| 817 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 818 | if (is_android) { |
| 819 | template("rtc_android_library") { |
| 820 | android_library(target_name) { |
| 821 | forward_variables_from(invoker, |
| 822 | "*", |
| 823 | [ |
| 824 | "configs", |
| 825 | "public_configs", |
| 826 | "suppressed_configs", |
| 827 | "visibility", |
| 828 | ]) |
| 829 | |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 830 | errorprone_args = [] |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 831 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 832 | # Treat warnings as errors. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 833 | errorprone_args += [ "-Werror" ] |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 834 | |
Sami Kalliomäki | 68d5860 | 2019-01-24 12:56:12 +0100 | [diff] [blame] | 835 | # WebRTC supports API level 16 while Chromium only supports 19. |
| 836 | # (the manifest defines minimum supported SDK version) |
| 837 | if (defined(invoker.android_manifest_for_lint)) { |
| 838 | # Custom manifest defined by the target, use that one. |
| 839 | android_manifest_for_lint = invoker.android_manifest_for_lint |
| 840 | } else { |
| 841 | # Default manifest for WebRTC. |
| 842 | android_manifest_for_lint = "//sdk/android/AndroidManifest.xml" |
| 843 | } |
| 844 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 845 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 846 | if (!build_with_chromium) { |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 847 | errorprone_args += [ |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 848 | "-Xep:ParameterNotNullable:ERROR", |
| 849 | "-Xep:FieldMissingNullable:ERROR", |
| 850 | "-Xep:ReturnMissingNullable:ERROR", |
| 851 | ] |
| 852 | } |
| 853 | |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 854 | # Add any arguments defined by the invoker. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 855 | if (defined(invoker.errorprone_args)) { |
| 856 | errorprone_args += invoker.errorprone_args |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 857 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 858 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 859 | if (!defined(deps)) { |
| 860 | deps = [] |
| 861 | } |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 862 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 863 | no_build_hooks = true |
| 864 | } |
| 865 | } |
| 866 | |
| 867 | template("rtc_android_apk") { |
| 868 | android_apk(target_name) { |
| 869 | forward_variables_from(invoker, |
| 870 | "*", |
| 871 | [ |
| 872 | "configs", |
| 873 | "public_configs", |
| 874 | "suppressed_configs", |
| 875 | "visibility", |
| 876 | ]) |
| 877 | |
| 878 | # Treat warnings as errors. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 879 | errorprone_args = [ "-Werror" ] |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 880 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 881 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 882 | if (!build_with_chromium) { |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 883 | errorprone_args += [ |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 884 | "-Xep:ParameterNotNullable:ERROR", |
| 885 | "-Xep:FieldMissingNullable:ERROR", |
| 886 | "-Xep:ReturnMissingNullable:ERROR", |
| 887 | ] |
| 888 | } |
| 889 | |
| 890 | if (!defined(deps)) { |
| 891 | deps = [] |
| 892 | } |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 893 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 894 | no_build_hooks = true |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | template("rtc_instrumentation_test_apk") { |
| 899 | instrumentation_test_apk(target_name) { |
| 900 | forward_variables_from(invoker, |
| 901 | "*", |
| 902 | [ |
| 903 | "configs", |
| 904 | "public_configs", |
| 905 | "suppressed_configs", |
| 906 | "visibility", |
| 907 | ]) |
| 908 | |
| 909 | # Treat warnings as errors. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 910 | errorprone_args = [ "-Werror" ] |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 911 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 912 | # TODO(crbug.com/824679): Find out why this fails in Chromium |
| 913 | if (!build_with_chromium) { |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 914 | errorprone_args += [ |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 915 | "-Xep:ParameterNotNullable:ERROR", |
| 916 | "-Xep:FieldMissingNullable:ERROR", |
| 917 | "-Xep:ReturnMissingNullable:ERROR", |
| 918 | ] |
| 919 | } |
| 920 | |
| 921 | if (!defined(deps)) { |
| 922 | deps = [] |
| 923 | } |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 924 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 925 | no_build_hooks = true |
| 926 | } |
| 927 | } |
| 928 | } |