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