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