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