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") |
Mirko Bonadei | 8c185fc | 2021-07-21 13:12:38 +0200 | [diff] [blame] | 9 | import("//build/config/dcheck_always_on.gni") |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 10 | import("//build/config/features.gni") |
| 11 | import("//build/config/mips.gni") |
| 12 | import("//build/config/sanitizers/sanitizers.gni") |
Tomas Popela | 318da51 | 2018-11-13 06:32:23 +0100 | [diff] [blame] | 13 | import("//build/config/sysroot.gni") |
ehmaldonado | 0d729b3 | 2017-02-10 01:38:23 -0800 | [diff] [blame] | 14 | import("//build/config/ui.gni") |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 15 | import("//build_overrides/build.gni") |
mbonadei | 9660627 | 2017-03-03 19:41:59 -0800 | [diff] [blame] | 16 | |
| 17 | if (!build_with_chromium && is_component_build) { |
| 18 | print("The Gn argument `is_component_build` is currently " + |
| 19 | "ignored for WebRTC builds.") |
| 20 | print("Component builds are supported by Chromium and the argument " + |
| 21 | "`is_component_build` makes it possible to create shared libraries " + |
| 22 | "instead of static libraries.") |
| 23 | print("If an app depends on WebRTC it makes sense to just depend on the " + |
| 24 | "WebRTC static library, so there is no difference between " + |
| 25 | "`is_component_build=true` and `is_component_build=false`.") |
| 26 | print( |
Fanny Linderborg | 0d2dc1f | 2021-07-14 14:02:11 +0000 | [diff] [blame] | 27 | "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/main/docs/component_build.md") |
mbonadei | 9660627 | 2017-03-03 19:41:59 -0800 | [diff] [blame] | 28 | assert(!is_component_build, "Component builds are not supported in WebRTC.") |
| 29 | } |
| 30 | |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 31 | if (is_ios) { |
| 32 | import("//build/config/ios/rules.gni") |
| 33 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 34 | |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 35 | if (is_mac) { |
| 36 | import("//build/config/mac/rules.gni") |
| 37 | } |
| 38 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 39 | declare_args() { |
Mirko Bonadei | 8c185fc | 2021-07-21 13:12:38 +0200 | [diff] [blame] | 40 | # Separate control for dchecks in WebRTC. Defaults to Chromium's behavior if |
| 41 | # built with Chromium. |
| 42 | # When set to true, it will enable RTC_DCHECK() also in Release builds. |
| 43 | rtc_dcheck_always_on = build_with_chromium && dcheck_always_on |
| 44 | |
Mirko Bonadei | 028248c | 2018-10-10 12:19:02 +0200 | [diff] [blame] | 45 | # Setting this to true will make RTC_EXPORT (see rtc_base/system/rtc_export.h) |
| 46 | # expand to code that will manage symbols visibility. |
| 47 | rtc_enable_symbol_export = false |
| 48 | |
Mirko Bonadei | 31b0b45 | 2018-08-22 10:37:11 +0200 | [diff] [blame] | 49 | # Setting this to true will define WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT which |
Mirko Bonadei | 7040090 | 2018-08-21 15:44:28 +0200 | [diff] [blame] | 50 | # will tell the pre-processor to remove the default definition of symbols |
| 51 | # needed to use field_trial. In that case a new implementation needs to be |
| 52 | # provided. |
Mirko Bonadei | 31b0b45 | 2018-08-22 10:37:11 +0200 | [diff] [blame] | 53 | if (build_with_chromium) { |
| 54 | # When WebRTC is built as part of Chromium it should exclude the default |
| 55 | # implementation of field_trial unless it is building for NACL or |
| 56 | # Chromecast. |
| 57 | rtc_exclude_field_trial_default = !is_nacl && !is_chromecast |
| 58 | } else { |
| 59 | rtc_exclude_field_trial_default = false |
| 60 | } |
Mirko Bonadei | 7040090 | 2018-08-21 15:44:28 +0200 | [diff] [blame] | 61 | |
Mirko Bonadei | 906add4 | 2018-09-05 16:03:16 +0200 | [diff] [blame] | 62 | # Setting this to true will define WEBRTC_EXCLUDE_METRICS_DEFAULT which |
| 63 | # will tell the pre-processor to remove the default definition of symbols |
| 64 | # needed to use metrics. In that case a new implementation needs to be |
| 65 | # provided. |
| 66 | rtc_exclude_metrics_default = build_with_chromium |
| 67 | |
Johannes Kron | da20c73 | 2021-02-19 16:39:41 +0100 | [diff] [blame] | 68 | # Setting this to true will define WEBRTC_EXCLUDE_SYSTEM_TIME which |
| 69 | # will tell the pre-processor to remove the default definition of the |
| 70 | # SystemTimeNanos() which is defined in rtc_base/system_time.cc. In |
| 71 | # that case a new implementation needs to be provided. |
Johannes Kron | bb52bdf | 2021-02-25 10:10:08 +0100 | [diff] [blame] | 72 | rtc_exclude_system_time = build_with_chromium |
Johannes Kron | da20c73 | 2021-02-19 16:39:41 +0100 | [diff] [blame] | 73 | |
Benjamin Wright | d6f86e8 | 2018-05-08 13:12:25 -0700 | [diff] [blame] | 74 | # Setting this to false will require the API user to pass in their own |
| 75 | # SSLCertificateVerifier to verify the certificates presented from a |
| 76 | # TLS-TURN server. In return disabling this saves around 100kb in the binary. |
| 77 | rtc_builtin_ssl_root_certificates = true |
| 78 | |
Karl Wiberg | eb254b4 | 2017-11-01 15:08:12 +0100 | [diff] [blame] | 79 | # Include the iLBC audio codec? |
Olga Sharonova | 5fbd758 | 2020-07-09 09:50:42 +0000 | [diff] [blame] | 80 | rtc_include_ilbc = true |
Karl Wiberg | eb254b4 | 2017-11-01 15:08:12 +0100 | [diff] [blame] | 81 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 82 | # Disable this to avoid building the Opus audio codec. |
| 83 | rtc_include_opus = true |
| 84 | |
minyue | 2e03c66 | 2017-02-01 17:31:11 -0800 | [diff] [blame] | 85 | # Enable this if the Opus version upon which WebRTC is built supports direct |
| 86 | # encoding of 120 ms packets. |
minyue-webrtc | 516711c | 2017-07-27 17:45:49 +0200 | [diff] [blame] | 87 | rtc_opus_support_120ms_ptime = true |
minyue | 2e03c66 | 2017-02-01 17:31:11 -0800 | [diff] [blame] | 88 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 89 | # Enable this to let the Opus audio codec change complexity on the fly. |
| 90 | rtc_opus_variable_complexity = false |
| 91 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 92 | # Used to specify an external Jsoncpp include path when not compiling the |
| 93 | # library that comes with WebRTC (i.e. rtc_build_json == 0). |
| 94 | rtc_jsoncpp_root = "//third_party/jsoncpp/source/include" |
| 95 | |
| 96 | # Used to specify an external OpenSSL include path when not compiling the |
| 97 | # library that comes with WebRTC (i.e. rtc_build_ssl == 0). |
| 98 | rtc_ssl_root = "" |
| 99 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 100 | # Enable when an external authentication mechanism is used for performing |
| 101 | # packet authentication for RTP packets instead of libsrtp. |
| 102 | rtc_enable_external_auth = build_with_chromium |
| 103 | |
| 104 | # Selects whether debug dumps for the audio processing module |
| 105 | # should be generated. |
| 106 | apm_debug_dump = false |
| 107 | |
Per Åhgren | cc73ed3 | 2020-04-26 23:56:17 +0200 | [diff] [blame] | 108 | # Selects whether the audio processing module should be excluded. |
| 109 | rtc_exclude_audio_processing_module = false |
| 110 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 111 | # Set this to true to enable BWE test logging. |
| 112 | rtc_enable_bwe_test_logging = false |
| 113 | |
Joachim Bauch | 93e9134 | 2017-12-07 01:25:53 +0100 | [diff] [blame] | 114 | # Set this to false to skip building examples. |
| 115 | rtc_build_examples = true |
| 116 | |
| 117 | # Set this to false to skip building tools. |
| 118 | rtc_build_tools = true |
| 119 | |
Joachim Bauch | 75f18fc | 2017-12-20 21:25:47 +0100 | [diff] [blame] | 120 | # Set this to false to skip building code that requires X11. |
| 121 | rtc_use_x11 = use_x11 |
| 122 | |
Tomas Popela | 318da51 | 2018-11-13 06:32:23 +0100 | [diff] [blame] | 123 | # Set this to use PipeWire on the Wayland display server. |
Tomas Popela | 762543f | 2018-12-12 14:37:51 +0100 | [diff] [blame] | 124 | # By default it's only enabled on desktop Linux (excludes ChromeOS) and |
| 125 | # only when using the sysroot as PipeWire is not available in older and |
| 126 | # supported Ubuntu and Debian distributions. |
Xiaohan Wang | 9f32f3b | 2020-10-01 14:46:54 -0700 | [diff] [blame] | 127 | rtc_use_pipewire = is_linux && use_sysroot |
Tomas Popela | 762543f | 2018-12-12 14:37:51 +0100 | [diff] [blame] | 128 | |
| 129 | # Set this to link PipeWire directly instead of using the dlopen. |
| 130 | rtc_link_pipewire = false |
Tomas Popela | 318da51 | 2018-11-13 06:32:23 +0100 | [diff] [blame] | 131 | |
Jan Grulich | c3c8129 | 2020-12-02 09:03:34 +0100 | [diff] [blame] | 132 | # Set this to use certain PipeWire version |
Jan Grulich | 14b036d | 2021-02-04 09:53:20 +0100 | [diff] [blame] | 133 | # Currently WebRTC supports PipeWire 0.2 and PipeWire 0.3 (default) |
| 134 | rtc_pipewire_version = "0.3" |
Jan Grulich | c3c8129 | 2020-12-02 09:03:34 +0100 | [diff] [blame] | 135 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 136 | # Enable to use the Mozilla internal settings. |
| 137 | build_with_mozilla = false |
| 138 | |
Philipp Hancke | e95ebda | 2020-09-17 16:13:20 +0200 | [diff] [blame] | 139 | # Experimental: enable use of Android AAudio which requires Android SDK 26 or above |
| 140 | # and NDK r16 or above. |
henrika | 883d00f | 2018-03-16 10:09:49 +0100 | [diff] [blame] | 141 | rtc_enable_android_aaudio = false |
| 142 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 143 | # Set to "func", "block", "edge" for coverage generation. |
| 144 | # At unit test runtime set UBSAN_OPTIONS="coverage=1". |
| 145 | # It is recommend to set include_examples=0. |
| 146 | # Use llvm's sancov -html-report for human readable reports. |
| 147 | # See http://clang.llvm.org/docs/SanitizerCoverage.html . |
| 148 | rtc_sanitize_coverage = "" |
| 149 | |
Philipp Hancke | aeac9f8 | 2020-09-11 11:58:18 +0200 | [diff] [blame] | 150 | # Selects fixed-point code where possible. |
| 151 | rtc_prefer_fixed_point = false |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 152 | if (current_cpu == "arm" || current_cpu == "arm64") { |
| 153 | rtc_prefer_fixed_point = true |
| 154 | } |
| 155 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 156 | # Determines whether NEON code will be built. |
| 157 | rtc_build_with_neon = |
| 158 | (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64" |
| 159 | |
| 160 | # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on |
| 161 | # all platforms except Android and iOS. Because FFmpeg can be built |
Artem Titov | 22a6b2d | 2021-07-27 16:25:56 +0200 | [diff] [blame] | 162 | # with/without H.264 support, `ffmpeg_branding` has to separately be set to a |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 163 | # value that includes H.264, for example "Chrome". If FFmpeg is built without |
Artem Titov | 22a6b2d | 2021-07-27 16:25:56 +0200 | [diff] [blame] | 164 | # H.264, compilation succeeds but `H264DecoderImpl` fails to initialize. |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 165 | # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. |
| 166 | # http://www.openh264.org, https://www.ffmpeg.org/ |
Mirko Bonadei | ee0a85c | 2019-01-15 10:47:18 +0100 | [diff] [blame] | 167 | # |
| 168 | # Enabling H264 when building with MSVC is currently not supported, see |
| 169 | # bugs.webrtc.org/9213#c13 for more info. |
| 170 | rtc_use_h264 = |
| 171 | proprietary_codecs && !is_android && !is_ios && !(is_win && !is_clang) |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 172 | |
Markus Handell | 8e75bd4 | 2020-06-05 11:47:40 +0200 | [diff] [blame] | 173 | # Enable this flag to make webrtc::Mutex be implemented by absl::Mutex. |
| 174 | rtc_use_absl_mutex = false |
| 175 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 176 | # By default, use normal platform audio support or dummy audio, but don't |
| 177 | # use file-based audio playout and record. |
| 178 | rtc_use_dummy_audio_file_devices = false |
| 179 | |
henrika | 7be7883 | 2017-06-13 17:34:16 +0200 | [diff] [blame] | 180 | # When set to true, replace the audio output with a sinus tone at 440Hz. |
| 181 | # The ADM will ask for audio data from WebRTC but instead of reading real |
| 182 | # audio samples from NetEQ, a sinus tone will be generated and replace the |
| 183 | # real audio samples. |
| 184 | rtc_audio_device_plays_sinus_tone = false |
| 185 | |
Anders Carlsson | 358f2e0 | 2018-06-04 10:24:37 +0200 | [diff] [blame] | 186 | if (is_ios) { |
| 187 | # Build broadcast extension in AppRTCMobile for iOS. This results in the |
| 188 | # binary only running on iOS 11+, which is why it is disabled by default. |
| 189 | rtc_apprtcmobile_broadcast_extension = false |
| 190 | } |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 191 | |
Jordan Rose | 53d3fc9 | 2021-07-06 12:16:41 -0700 | [diff] [blame] | 192 | # Determines whether OpenGL is available on iOS/macOS. |
| 193 | rtc_ios_macos_use_opengl_rendering = |
| 194 | !(is_ios && target_environment == "catalyst") |
| 195 | |
Jiawei Ou | 0874530 | 2019-02-12 11:36:13 -0800 | [diff] [blame] | 196 | # When set to false, builtin audio encoder/decoder factories and all the |
| 197 | # audio codecs they depend on will not be included in libwebrtc.{a|lib} |
| 198 | # (they will still be included in libjingle_peerconnection_so.so and |
| 199 | # WebRTC.framework) |
| 200 | rtc_include_builtin_audio_codecs = true |
| 201 | |
| 202 | # When set to false, builtin video encoder/decoder factories and all the |
| 203 | # video codecs they depends on will not be included in libwebrtc.{a|lib} |
| 204 | # (they will still be included in libjingle_peerconnection_so.so and |
| 205 | # WebRTC.framework) |
| 206 | rtc_include_builtin_video_codecs = true |
Mirko Bonadei | 20574f4 | 2019-03-28 07:50:07 +0100 | [diff] [blame] | 207 | |
| 208 | # When set to true and in a standalone build, it will undefine UNICODE and |
| 209 | # _UNICODE (which are always defined globally by the Chromium Windows |
| 210 | # toolchain). |
| 211 | # This is only needed for testing purposes, WebRTC wants to be sure it |
| 212 | # doesn't assume /DUNICODE and /D_UNICODE but that it explicitly uses |
| 213 | # wide character functions. |
| 214 | rtc_win_undef_unicode = false |
Austin Orion | 25b0dee | 2020-10-01 13:47:54 -0700 | [diff] [blame] | 215 | |
| 216 | # When set to true, a capturer implementation that uses the |
Austin Orion | 66241e4 | 2021-04-22 13:22:25 -0700 | [diff] [blame] | 217 | # Windows.Graphics.Capture APIs will be available for use. This introduces a |
| 218 | # dependency on the Win 10 SDK v10.0.17763.0. |
Austin Orion | 78f04d8 | 2021-04-23 12:37:26 -0700 | [diff] [blame] | 219 | rtc_enable_win_wgc = is_win |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 220 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 221 | |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 222 | if (!build_with_mozilla) { |
| 223 | import("//testing/test.gni") |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | # A second declare_args block, so that declarations within it can |
| 227 | # depend on the possibly overridden variables in the first |
| 228 | # declare_args block. |
| 229 | declare_args() { |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 230 | # Enables the use of protocol buffers for debug recordings. |
| 231 | rtc_enable_protobuf = !build_with_mozilla |
| 232 | |
| 233 | # Set this to disable building with support for SCTP data channels. |
| 234 | rtc_enable_sctp = !build_with_mozilla |
| 235 | |
| 236 | # Disable these to not build components which can be externally provided. |
| 237 | rtc_build_json = !build_with_mozilla |
| 238 | rtc_build_libsrtp = !build_with_mozilla |
| 239 | rtc_build_libvpx = !build_with_mozilla |
| 240 | rtc_libvpx_build_vp9 = !build_with_mozilla |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 241 | rtc_build_opus = !build_with_mozilla |
| 242 | rtc_build_ssl = !build_with_mozilla |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 243 | |
| 244 | # Enable libevent task queues on platforms that support it. |
Mirko Bonadei | 775c02e | 2019-06-19 19:05:00 +0200 | [diff] [blame] | 245 | if (is_win || is_mac || is_ios || is_nacl || is_fuchsia || |
| 246 | target_cpu == "wasm") { |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 247 | rtc_enable_libevent = false |
| 248 | rtc_build_libevent = false |
| 249 | } else { |
| 250 | rtc_enable_libevent = true |
| 251 | rtc_build_libevent = !build_with_mozilla |
| 252 | } |
| 253 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 254 | # Excluded in Chromium since its prerequisites don't require Pulse Audio. |
| 255 | rtc_include_pulse_audio = !build_with_chromium |
| 256 | |
| 257 | # Chromium uses its own IO handling, so the internal ADM is only built for |
| 258 | # standalone WebRTC. |
| 259 | rtc_include_internal_audio_device = !build_with_chromium |
| 260 | |
Zhaoliang Ma | 72e4321 | 2020-08-17 17:13:41 +0800 | [diff] [blame] | 261 | # Set this to true to enable the avx2 support in webrtc. |
Per Åhgren | a43178c | 2020-09-25 12:02:32 +0200 | [diff] [blame] | 262 | # TODO: Make sure that AVX2 works also for non-clang compilers. |
| 263 | if (is_clang == true) { |
| 264 | rtc_enable_avx2 = true |
| 265 | } else { |
| 266 | rtc_enable_avx2 = false |
| 267 | } |
Zhaoliang Ma | 72e4321 | 2020-08-17 17:13:41 +0800 | [diff] [blame] | 268 | |
Philipp Hancke | 1a89bc8 | 2021-03-02 21:23:24 +0100 | [diff] [blame] | 269 | # Set this to true to build the unit tests. |
| 270 | # Disabled when building with Chromium or Mozilla. |
Dan Minor | 9c68613 | 2018-01-15 10:20:00 -0500 | [diff] [blame] | 271 | rtc_include_tests = !build_with_chromium && !build_with_mozilla |
Oleh Prypin | 240b893 | 2019-06-07 13:27:07 +0200 | [diff] [blame] | 272 | |
| 273 | # Set this to false to skip building code that also requires X11 extensions |
| 274 | # such as Xdamage, Xfixes. |
| 275 | rtc_use_x11_extensions = rtc_use_x11 |
Artem Titov | 6a4a146 | 2019-11-26 16:24:46 +0100 | [diff] [blame] | 276 | |
| 277 | # Set this to true to fully remove logging from WebRTC. |
| 278 | rtc_disable_logging = false |
Doudou Kisabaka | 2dec496 | 2019-11-28 14:24:31 +0100 | [diff] [blame] | 279 | |
| 280 | # Set this to true to disable trace events. |
| 281 | rtc_disable_trace_events = false |
Artem Titov | 9dc209a | 2019-11-28 17:09:30 +0100 | [diff] [blame] | 282 | |
| 283 | # Set this to true to disable detailed error message and logging for |
| 284 | # RTC_CHECKs. |
| 285 | rtc_disable_check_msg = false |
Ying Wang | ef3998f | 2019-12-09 13:06:53 +0100 | [diff] [blame] | 286 | |
| 287 | # Set this to true to disable webrtc metrics. |
Mirko Bonadei | 3c4fda2 | 2019-12-10 15:02:53 +0100 | [diff] [blame] | 288 | rtc_disable_metrics = false |
saza | aa42ecd | 2020-04-01 15:24:40 +0200 | [diff] [blame] | 289 | |
| 290 | # Set this to true to exclude the transient suppressor in the audio processing |
| 291 | # module from the build. |
| 292 | rtc_exclude_transient_suppressor = false |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 293 | } |
| 294 | |
Florent Castelli | a80c3e5 | 2021-04-15 15:02:56 +0200 | [diff] [blame] | 295 | declare_args() { |
Florent Castelli | a6983c6 | 2021-05-06 10:50:07 +0200 | [diff] [blame] | 296 | # Enable the dcsctp backend for DataChannels and related unittests |
| 297 | rtc_build_dcsctp = !build_with_mozilla && rtc_enable_sctp |
| 298 | |
Florent Castelli | a80c3e5 | 2021-04-15 15:02:56 +0200 | [diff] [blame] | 299 | # Enable the usrsctp backend for DataChannels and related unittests |
| 300 | rtc_build_usrsctp = !build_with_mozilla && rtc_enable_sctp |
| 301 | } |
| 302 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 303 | # Make it possible to provide custom locations for some libraries (move these |
| 304 | # up into declare_args should we need to actually use them for the GN build). |
| 305 | rtc_libvpx_dir = "//third_party/libvpx" |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 306 | rtc_opus_dir = "//third_party/opus" |
| 307 | |
| 308 | # Desktop capturer is supported only on Windows, OSX and Linux. |
Oleh Prypin | 240b893 | 2019-06-07 13:27:07 +0200 | [diff] [blame] | 309 | rtc_desktop_capture_supported = |
| 310 | (is_win && current_os != "winuwp") || is_mac || |
Hidehiko Abe | f264e70 | 2020-09-10 18:10:11 +0900 | [diff] [blame] | 311 | ((is_linux || is_chromeos) && (rtc_use_x11_extensions || rtc_use_pipewire)) |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 312 | |
| 313 | ############################################################################### |
| 314 | # Templates |
| 315 | # |
| 316 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 317 | # Points to // in webrtc stand-alone or to //third_party/webrtc/ in |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 318 | # chromium. |
| 319 | # We need absolute paths for all configs in templates as they are shared in |
| 320 | # different subdirectories. |
| 321 | webrtc_root = get_path_info(".", "abspath") |
| 322 | |
| 323 | # Global configuration that should be applied to all WebRTC targets. |
| 324 | # You normally shouldn't need to include this in your target as it's |
| 325 | # automatically included when using the rtc_* templates. |
| 326 | # It sets defines, include paths and compilation warnings accordingly, |
| 327 | # both for WebRTC stand-alone builds and for the scenario when WebRTC |
| 328 | # native code is built as part of Chromium. |
Will Harris | fc173d0 | 2018-08-29 13:56:00 -0700 | [diff] [blame] | 329 | rtc_common_configs = [ |
| 330 | webrtc_root + ":common_config", |
| 331 | "//build/config/compiler:no_size_t_to_int_warning", |
| 332 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 333 | |
kthelgason | c097710 | 2017-04-24 00:57:16 -0700 | [diff] [blame] | 334 | if (is_mac || is_ios) { |
| 335 | rtc_common_configs += [ "//build/config/compiler:enable_arc" ] |
| 336 | } |
| 337 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 338 | # Global public configuration that should be applied to all WebRTC targets. You |
| 339 | # normally shouldn't need to include this in your target as it's automatically |
| 340 | # included when using the rtc_* templates. It set the defines, include paths and |
| 341 | # compilation warnings that should be propagated to dependents of the targets |
| 342 | # depending on the target having this config. |
| 343 | rtc_common_inherited_config = webrtc_root + ":common_inherited_config" |
| 344 | |
| 345 | # Common configs to remove or add in all rtc targets. |
| 346 | rtc_remove_configs = [] |
Mirko Bonadei | fc52b91 | 2019-03-01 10:32:56 +0100 | [diff] [blame] | 347 | if (!build_with_chromium && is_clang) { |
| 348 | rtc_remove_configs += [ "//build/config/clang:find_bad_constructs" ] |
| 349 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 350 | rtc_add_configs = rtc_common_configs |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 351 | rtc_prod_configs = [ webrtc_root + ":rtc_prod_config" ] |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame] | 352 | rtc_library_impl_config = [ webrtc_root + ":library_impl_config" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 353 | |
| 354 | set_defaults("rtc_test") { |
| 355 | configs = rtc_add_configs |
| 356 | suppressed_configs = [] |
| 357 | } |
| 358 | |
Mirko Bonadei | 86d053c | 2019-10-17 21:32:04 +0200 | [diff] [blame] | 359 | set_defaults("rtc_library") { |
| 360 | configs = rtc_add_configs |
| 361 | suppressed_configs = [] |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 362 | absl_deps = [] |
Mirko Bonadei | 86d053c | 2019-10-17 21:32:04 +0200 | [diff] [blame] | 363 | } |
| 364 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 365 | set_defaults("rtc_source_set") { |
| 366 | configs = rtc_add_configs |
| 367 | suppressed_configs = [] |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 368 | absl_deps = [] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 369 | } |
| 370 | |
Mirko Bonadei | 86d053c | 2019-10-17 21:32:04 +0200 | [diff] [blame] | 371 | set_defaults("rtc_static_library") { |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 372 | configs = rtc_add_configs |
| 373 | suppressed_configs = [] |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 374 | absl_deps = [] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 375 | } |
| 376 | |
Mirko Bonadei | 86d053c | 2019-10-17 21:32:04 +0200 | [diff] [blame] | 377 | set_defaults("rtc_executable") { |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 378 | configs = rtc_add_configs |
| 379 | suppressed_configs = [] |
| 380 | } |
| 381 | |
| 382 | set_defaults("rtc_shared_library") { |
| 383 | configs = rtc_add_configs |
| 384 | suppressed_configs = [] |
| 385 | } |
| 386 | |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 387 | webrtc_default_visibility = [ webrtc_root + "/*" ] |
| 388 | if (build_with_chromium) { |
| 389 | # Allow Chromium's WebRTC overrides targets to bypass the regular |
| 390 | # visibility restrictions. |
| 391 | webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ] |
| 392 | } |
| 393 | |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 394 | # ---- Poisons ---- |
| 395 | # |
| 396 | # The general idea is that some targets declare that they contain some |
| 397 | # kind of poison, which makes it impossible for other targets to |
| 398 | # depend on them (even transitively) unless they declare themselves |
| 399 | # immune to that particular type of poison. |
| 400 | # |
| 401 | # Targets that *contain* poison of type foo should contain the line |
| 402 | # |
| 403 | # poisonous = [ "foo" ] |
| 404 | # |
| 405 | # and targets that *are immune but arent't themselves poisonous* |
| 406 | # should contain |
| 407 | # |
| 408 | # allow_poison = [ "foo" ] |
| 409 | # |
| 410 | # This useful in cases where we have some large target or set of |
| 411 | # targets and want to ensure that most other targets do not |
| 412 | # transitively depend on them. For example, almost no high-level |
| 413 | # target should depend on the audio codecs, since we want WebRTC users |
| 414 | # to be able to inject any subset of them and actually end up with a |
| 415 | # binary that doesn't include the codecs they didn't inject. |
| 416 | # |
| 417 | # Test-only targets (`testonly` set to true) and non-public targets |
| 418 | # (`visibility` not containing "*") are automatically immune to all |
| 419 | # types of poison. |
| 420 | # |
| 421 | # Here's the complete list of all types of poison. It must be kept in |
| 422 | # 1:1 correspondence with the set of //:poison_* targets. |
| 423 | # |
| 424 | all_poison_types = [ |
| 425 | # Encoders and decoders for specific audio codecs such as Opus and iSAC. |
| 426 | "audio_codecs", |
Anders Carlsson | 1f433e4 | 2018-04-24 16:39:05 +0200 | [diff] [blame] | 427 | |
Danil Chapovalov | 41300af | 2019-07-10 12:44:43 +0200 | [diff] [blame] | 428 | # Default task queue implementation. |
| 429 | "default_task_queue", |
Sam Zackrisson | 492fdf4 | 2019-10-25 10:45:58 +0200 | [diff] [blame] | 430 | |
| 431 | # JSON parsing should not be needed in the "slim and modular" WebRTC. |
| 432 | "rtc_json", |
| 433 | |
| 434 | # Software video codecs (VP8 and VP9 through libvpx). |
| 435 | "software_video_codecs", |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 436 | ] |
| 437 | |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 438 | absl_include_config = "//third_party/abseil-cpp:absl_include_config" |
| 439 | absl_define_config = "//third_party/abseil-cpp:absl_define_config" |
| 440 | |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 441 | # Abseil Flags are testonly, so this config will only be applied to WebRTC targets |
| 442 | # that are testonly. |
| 443 | absl_flags_config = webrtc_root + ":absl_flags_configs" |
| 444 | |
Mirko Bonadei | e99b6cc | 2020-11-25 16:41:37 +0100 | [diff] [blame] | 445 | # WebRTC wrapper of Chromium's test() template. This template just adds some |
| 446 | # WebRTC only configuration in order to avoid to duplicate it for every WebRTC |
| 447 | # target. |
| 448 | # The parameter `is_xctest` is different from the one in the Chromium's test() |
| 449 | # template (and it is not forwarded to it). In rtc_test(), the argument |
| 450 | # `is_xctest` is used to avoid to take dependencies that are not needed |
| 451 | # in case the test is a real XCTest (using the XCTest framework). |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 452 | template("rtc_test") { |
| 453 | test(target_name) { |
| 454 | forward_variables_from(invoker, |
| 455 | "*", |
| 456 | [ |
| 457 | "configs", |
Mirko Bonadei | e99b6cc | 2020-11-25 16:41:37 +0100 | [diff] [blame] | 458 | "is_xctest", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 459 | "public_configs", |
| 460 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 461 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 462 | ]) |
Mirko Bonadei | dd41194 | 2017-11-21 15:35:27 +0100 | [diff] [blame] | 463 | |
| 464 | # Always override to public because when target_os is Android the `test` |
| 465 | # template can override it to [ "*" ] and we want to avoid conditional |
| 466 | # visibility. |
Mirko Bonadei | 2155881 | 2017-11-21 12:47:34 +0100 | [diff] [blame] | 467 | visibility = [ "*" ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 468 | configs += invoker.configs |
| 469 | configs -= rtc_remove_configs |
| 470 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 471 | public_configs = [ |
| 472 | rtc_common_inherited_config, |
| 473 | absl_include_config, |
| 474 | absl_define_config, |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 475 | absl_flags_config, |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 476 | ] |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 477 | if (defined(invoker.public_configs)) { |
| 478 | public_configs += invoker.public_configs |
| 479 | } |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 480 | if (!build_with_chromium && is_android) { |
Jianjun Zhu | 037f3e4 | 2017-08-15 21:48:37 +0800 | [diff] [blame] | 481 | android_manifest = webrtc_root + "test/android/AndroidManifest.xml" |
Peter Kotwicz | 3ceb16e | 2021-04-14 18:53:11 -0400 | [diff] [blame] | 482 | use_raw_android_executable = false |
Jeremy Leconte | b19cfee | 2020-06-25 22:57:49 +0200 | [diff] [blame] | 483 | min_sdk_version = 21 |
Mirko Bonadei | bd393b2 | 2020-07-10 23:00:41 +0200 | [diff] [blame] | 484 | target_sdk_version = 23 |
Mirko Bonadei | 8093935 | 2021-04-12 19:03:37 +0200 | [diff] [blame] | 485 | deps += [ |
| 486 | "//build/android/gtest_apk:native_test_instrumentation_test_runner_java", |
| 487 | webrtc_root + "test:native_test_java", |
| 488 | ] |
sakal | d7fdb80 | 2017-05-26 01:51:53 -0700 | [diff] [blame] | 489 | } |
Mirko Bonadei | e99b6cc | 2020-11-25 16:41:37 +0100 | [diff] [blame] | 490 | |
| 491 | # When not targeting a simulator, building //base/test:google_test_runner |
| 492 | # fails, so it is added only when the test is not a real XCTest and when |
| 493 | # targeting a simulator. |
Mirko Bonadei | 58678a0 | 2020-12-01 10:54:40 +0100 | [diff] [blame] | 494 | if (is_ios && target_cpu == "x64" && rtc_include_tests) { |
Mirko Bonadei | e99b6cc | 2020-11-25 16:41:37 +0100 | [diff] [blame] | 495 | if (!defined(invoker.is_xctest) || !invoker.is_xctest) { |
| 496 | xctest_module_target = "//base/test:google_test_runner" |
| 497 | } |
| 498 | } |
Andrey Logvin | 7864600 | 2021-01-29 10:50:19 +0000 | [diff] [blame] | 499 | |
| 500 | # If absl_deps is [], no action is needed. If not [], then it needs to be |
| 501 | # converted to //third_party/abseil-cpp:absl when build_with_chromium=true |
| 502 | # otherwise it just needs to be added to deps. |
| 503 | if (defined(absl_deps) && absl_deps != []) { |
| 504 | if (!defined(deps)) { |
| 505 | deps = [] |
| 506 | } |
| 507 | if (build_with_chromium) { |
| 508 | deps += [ "//third_party/abseil-cpp:absl" ] |
| 509 | } else { |
| 510 | deps += absl_deps |
| 511 | } |
| 512 | } |
| 513 | |
Mirko Bonadei | 1d77c3e | 2021-01-26 17:10:04 +0100 | [diff] [blame] | 514 | if (using_sanitizer) { |
| 515 | if (is_linux) { |
| 516 | if (!defined(invoker.data)) { |
| 517 | data = [] |
| 518 | } |
| 519 | data += |
| 520 | [ "//third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6" ] |
| 521 | } |
| 522 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 523 | } |
| 524 | } |
| 525 | |
| 526 | template("rtc_source_set") { |
| 527 | source_set(target_name) { |
| 528 | forward_variables_from(invoker, |
| 529 | "*", |
| 530 | [ |
| 531 | "configs", |
| 532 | "public_configs", |
| 533 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 534 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 535 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 536 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 537 | if (!defined(visibility)) { |
| 538 | visibility = webrtc_default_visibility |
| 539 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 540 | |
| 541 | # What's your poison? |
| 542 | if (defined(testonly) && testonly) { |
| 543 | assert(!defined(poisonous)) |
| 544 | assert(!defined(allow_poison)) |
| 545 | } else { |
| 546 | if (!defined(poisonous)) { |
| 547 | poisonous = [] |
| 548 | } |
| 549 | if (!defined(allow_poison)) { |
| 550 | allow_poison = [] |
| 551 | } |
| 552 | if (!defined(assert_no_deps)) { |
| 553 | assert_no_deps = [] |
| 554 | } |
| 555 | if (!defined(deps)) { |
| 556 | deps = [] |
| 557 | } |
| 558 | foreach(p, poisonous) { |
| 559 | deps += [ webrtc_root + ":poison_" + p ] |
| 560 | } |
| 561 | foreach(poison_type, all_poison_types) { |
| 562 | allow_dep = true |
| 563 | foreach(v, visibility) { |
| 564 | if (v == "*") { |
| 565 | allow_dep = false |
| 566 | } |
| 567 | } |
| 568 | foreach(p, allow_poison + poisonous) { |
| 569 | if (p == poison_type) { |
| 570 | allow_dep = true |
| 571 | } |
| 572 | } |
| 573 | if (!allow_dep) { |
| 574 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 575 | } |
| 576 | } |
| 577 | } |
| 578 | |
Mirko Bonadei | 92dd35d | 2019-11-15 16:08:41 +0100 | [diff] [blame] | 579 | # Chromium should only depend on the WebRTC component in order to |
| 580 | # avoid to statically link WebRTC in a component build. |
| 581 | if (build_with_chromium) { |
| 582 | publicly_visible = false |
| 583 | foreach(v, visibility) { |
| 584 | if (v == "*") { |
| 585 | publicly_visible = true |
| 586 | } |
| 587 | } |
| 588 | if (publicly_visible) { |
| 589 | visibility = [] |
| 590 | visibility = webrtc_default_visibility |
| 591 | } |
| 592 | } |
| 593 | |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 594 | if (!defined(testonly) || !testonly) { |
| 595 | configs += rtc_prod_configs |
| 596 | } |
| 597 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 598 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame] | 599 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 600 | configs -= rtc_remove_configs |
| 601 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 602 | public_configs = [ |
| 603 | rtc_common_inherited_config, |
| 604 | absl_include_config, |
| 605 | absl_define_config, |
| 606 | ] |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 607 | if (defined(testonly) && testonly) { |
| 608 | public_configs += [ absl_flags_config ] |
| 609 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 610 | if (defined(invoker.public_configs)) { |
| 611 | public_configs += invoker.public_configs |
| 612 | } |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 613 | |
Mirko Bonadei | 96115cf | 2020-06-23 23:39:56 +0200 | [diff] [blame] | 614 | # If absl_deps is [], no action is needed. If not [], then it needs to be |
| 615 | # converted to //third_party/abseil-cpp:absl when build_with_chromium=true |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 616 | # otherwise it just needs to be added to deps. |
| 617 | if (absl_deps != []) { |
Mirko Bonadei | 2dcf348 | 2020-06-05 14:30:41 +0200 | [diff] [blame] | 618 | if (!defined(deps)) { |
| 619 | deps = [] |
| 620 | } |
Mirko Bonadei | 08ce986 | 2020-06-11 11:25:32 +0200 | [diff] [blame] | 621 | if (build_with_chromium) { |
| 622 | deps += [ "//third_party/abseil-cpp:absl" ] |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 623 | } else { |
| 624 | deps += absl_deps |
| 625 | } |
| 626 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 627 | } |
| 628 | } |
| 629 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 630 | template("rtc_static_library") { |
| 631 | static_library(target_name) { |
| 632 | forward_variables_from(invoker, |
| 633 | "*", |
| 634 | [ |
| 635 | "configs", |
| 636 | "public_configs", |
| 637 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 638 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 639 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 640 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 641 | if (!defined(visibility)) { |
| 642 | visibility = webrtc_default_visibility |
| 643 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 644 | |
| 645 | # What's your poison? |
| 646 | if (defined(testonly) && testonly) { |
| 647 | assert(!defined(poisonous)) |
| 648 | assert(!defined(allow_poison)) |
| 649 | } else { |
| 650 | if (!defined(poisonous)) { |
| 651 | poisonous = [] |
| 652 | } |
| 653 | if (!defined(allow_poison)) { |
| 654 | allow_poison = [] |
| 655 | } |
| 656 | if (!defined(assert_no_deps)) { |
| 657 | assert_no_deps = [] |
| 658 | } |
| 659 | if (!defined(deps)) { |
| 660 | deps = [] |
| 661 | } |
| 662 | foreach(p, poisonous) { |
| 663 | deps += [ webrtc_root + ":poison_" + p ] |
| 664 | } |
| 665 | foreach(poison_type, all_poison_types) { |
| 666 | allow_dep = true |
| 667 | foreach(v, visibility) { |
| 668 | if (v == "*") { |
| 669 | allow_dep = false |
| 670 | } |
| 671 | } |
| 672 | foreach(p, allow_poison + poisonous) { |
| 673 | if (p == poison_type) { |
| 674 | allow_dep = true |
| 675 | } |
| 676 | } |
| 677 | if (!allow_dep) { |
| 678 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 679 | } |
| 680 | } |
| 681 | } |
| 682 | |
Mirko Bonadei | 96ede16 | 2018-09-06 13:45:44 +0200 | [diff] [blame] | 683 | if (!defined(testonly) || !testonly) { |
| 684 | configs += rtc_prod_configs |
| 685 | } |
| 686 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 687 | configs += invoker.configs |
Mirko Bonadei | 32ce18c | 2018-09-18 13:15:54 +0200 | [diff] [blame] | 688 | configs += rtc_library_impl_config |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 689 | configs -= rtc_remove_configs |
| 690 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 691 | public_configs = [ |
| 692 | rtc_common_inherited_config, |
| 693 | absl_include_config, |
| 694 | absl_define_config, |
| 695 | ] |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 696 | if (defined(testonly) && testonly) { |
| 697 | public_configs += [ absl_flags_config ] |
| 698 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 699 | if (defined(invoker.public_configs)) { |
| 700 | public_configs += invoker.public_configs |
| 701 | } |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 702 | |
Mirko Bonadei | 96115cf | 2020-06-23 23:39:56 +0200 | [diff] [blame] | 703 | # If absl_deps is [], no action is needed. If not [], then it needs to be |
| 704 | # converted to //third_party/abseil-cpp:absl when build_with_chromium=true |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 705 | # otherwise it just needs to be added to deps. |
| 706 | if (absl_deps != []) { |
Mirko Bonadei | 2dcf348 | 2020-06-05 14:30:41 +0200 | [diff] [blame] | 707 | if (!defined(deps)) { |
| 708 | deps = [] |
| 709 | } |
Mirko Bonadei | 08ce986 | 2020-06-11 11:25:32 +0200 | [diff] [blame] | 710 | if (build_with_chromium) { |
| 711 | deps += [ "//third_party/abseil-cpp:absl" ] |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 712 | } else { |
| 713 | deps += absl_deps |
| 714 | } |
| 715 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 716 | } |
| 717 | } |
| 718 | |
Mirko Bonadei | 86d053c | 2019-10-17 21:32:04 +0200 | [diff] [blame] | 719 | # This template automatically switches the target type between source_set |
| 720 | # and static_library. |
| 721 | # |
| 722 | # This should be the default target type for all the WebRTC targets with |
| 723 | # one exception. Do not use this template for header only targets, in that case |
| 724 | # rtc_source_set must be used in order to avoid build errors (e.g. libtool |
| 725 | # complains if the output .a file is empty). |
| 726 | # |
| 727 | # How does it work: |
| 728 | # Since all files in a source_set are linked into a final binary, while files |
| 729 | # in a static library are only linked in if at least one symbol in them is |
| 730 | # referenced, in component builds source_sets are easy to deal with because |
| 731 | # all their object files are passed to the linker to create a shared library. |
| 732 | # In release builds instead, static_libraries are preferred since they allow |
| 733 | # the linker to discard dead code. |
| 734 | # For the same reason, testonly targets will always be expanded to |
| 735 | # source_set in order to be sure that tests are present in the test binary. |
| 736 | template("rtc_library") { |
| 737 | if (is_component_build || (defined(invoker.testonly) && invoker.testonly)) { |
| 738 | target_type = "source_set" |
| 739 | } else { |
| 740 | target_type = "static_library" |
| 741 | } |
| 742 | target(target_type, target_name) { |
| 743 | forward_variables_from(invoker, |
| 744 | "*", |
| 745 | [ |
| 746 | "configs", |
| 747 | "public_configs", |
| 748 | "suppressed_configs", |
| 749 | "visibility", |
| 750 | ]) |
| 751 | forward_variables_from(invoker, [ "visibility" ]) |
| 752 | if (!defined(visibility)) { |
| 753 | visibility = webrtc_default_visibility |
| 754 | } |
| 755 | |
| 756 | # What's your poison? |
| 757 | if (defined(testonly) && testonly) { |
| 758 | assert(!defined(poisonous)) |
| 759 | assert(!defined(allow_poison)) |
| 760 | } else { |
| 761 | if (!defined(poisonous)) { |
| 762 | poisonous = [] |
| 763 | } |
| 764 | if (!defined(allow_poison)) { |
| 765 | allow_poison = [] |
| 766 | } |
| 767 | if (!defined(assert_no_deps)) { |
| 768 | assert_no_deps = [] |
| 769 | } |
| 770 | if (!defined(deps)) { |
| 771 | deps = [] |
| 772 | } |
| 773 | foreach(p, poisonous) { |
| 774 | deps += [ webrtc_root + ":poison_" + p ] |
| 775 | } |
| 776 | foreach(poison_type, all_poison_types) { |
| 777 | allow_dep = true |
| 778 | foreach(v, visibility) { |
| 779 | if (v == "*") { |
| 780 | allow_dep = false |
| 781 | } |
| 782 | } |
| 783 | foreach(p, allow_poison + poisonous) { |
| 784 | if (p == poison_type) { |
| 785 | allow_dep = true |
| 786 | } |
| 787 | } |
| 788 | if (!allow_dep) { |
| 789 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 790 | } |
| 791 | } |
| 792 | } |
| 793 | |
Mirko Bonadei | 92dd35d | 2019-11-15 16:08:41 +0100 | [diff] [blame] | 794 | # Chromium should only depend on the WebRTC component in order to |
| 795 | # avoid to statically link WebRTC in a component build. |
| 796 | if (build_with_chromium) { |
| 797 | publicly_visible = false |
| 798 | foreach(v, visibility) { |
| 799 | if (v == "*") { |
| 800 | publicly_visible = true |
| 801 | } |
| 802 | } |
| 803 | if (publicly_visible) { |
| 804 | visibility = [] |
| 805 | visibility = webrtc_default_visibility |
| 806 | } |
| 807 | } |
| 808 | |
Mirko Bonadei | 86d053c | 2019-10-17 21:32:04 +0200 | [diff] [blame] | 809 | if (!defined(testonly) || !testonly) { |
| 810 | configs += rtc_prod_configs |
| 811 | } |
| 812 | |
| 813 | configs += invoker.configs |
| 814 | configs += rtc_library_impl_config |
| 815 | configs -= rtc_remove_configs |
| 816 | configs -= invoker.suppressed_configs |
| 817 | public_configs = [ |
| 818 | rtc_common_inherited_config, |
| 819 | absl_include_config, |
| 820 | absl_define_config, |
| 821 | ] |
| 822 | if (defined(testonly) && testonly) { |
| 823 | public_configs += [ absl_flags_config ] |
| 824 | } |
| 825 | if (defined(invoker.public_configs)) { |
| 826 | public_configs += invoker.public_configs |
| 827 | } |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 828 | |
Mirko Bonadei | 96115cf | 2020-06-23 23:39:56 +0200 | [diff] [blame] | 829 | # If absl_deps is [], no action is needed. If not [], then it needs to be |
| 830 | # converted to //third_party/abseil-cpp:absl when build_with_chromium=true |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 831 | # otherwise it just needs to be added to deps. |
| 832 | if (absl_deps != []) { |
Mirko Bonadei | 2dcf348 | 2020-06-05 14:30:41 +0200 | [diff] [blame] | 833 | if (!defined(deps)) { |
| 834 | deps = [] |
| 835 | } |
Mirko Bonadei | 08ce986 | 2020-06-11 11:25:32 +0200 | [diff] [blame] | 836 | if (build_with_chromium) { |
| 837 | deps += [ "//third_party/abseil-cpp:absl" ] |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 838 | } else { |
| 839 | deps += absl_deps |
| 840 | } |
| 841 | } |
Mirko Bonadei | 86d053c | 2019-10-17 21:32:04 +0200 | [diff] [blame] | 842 | } |
| 843 | } |
| 844 | |
| 845 | template("rtc_executable") { |
| 846 | executable(target_name) { |
| 847 | forward_variables_from(invoker, |
| 848 | "*", |
| 849 | [ |
| 850 | "deps", |
| 851 | "configs", |
| 852 | "public_configs", |
| 853 | "suppressed_configs", |
| 854 | "visibility", |
| 855 | ]) |
| 856 | forward_variables_from(invoker, [ "visibility" ]) |
| 857 | if (!defined(visibility)) { |
| 858 | visibility = webrtc_default_visibility |
| 859 | } |
| 860 | configs += invoker.configs |
| 861 | configs -= rtc_remove_configs |
| 862 | configs -= invoker.suppressed_configs |
| 863 | deps = invoker.deps |
| 864 | |
| 865 | public_configs = [ |
| 866 | rtc_common_inherited_config, |
| 867 | absl_include_config, |
| 868 | absl_define_config, |
| 869 | ] |
| 870 | if (defined(testonly) && testonly) { |
| 871 | public_configs += [ absl_flags_config ] |
| 872 | } |
| 873 | if (defined(invoker.public_configs)) { |
| 874 | public_configs += invoker.public_configs |
| 875 | } |
| 876 | if (is_win) { |
| 877 | deps += [ |
| 878 | # Give executables the default manifest on Windows (a no-op elsewhere). |
| 879 | "//build/win:default_exe_manifest", |
| 880 | ] |
| 881 | } |
| 882 | } |
| 883 | } |
| 884 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 885 | template("rtc_shared_library") { |
| 886 | shared_library(target_name) { |
| 887 | forward_variables_from(invoker, |
| 888 | "*", |
| 889 | [ |
| 890 | "configs", |
| 891 | "public_configs", |
| 892 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 893 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 894 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 11:16:19 +0200 | [diff] [blame] | 895 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 +0000 | [diff] [blame] | 896 | if (!defined(visibility)) { |
| 897 | visibility = webrtc_default_visibility |
| 898 | } |
Karl Wiberg | bb23c83 | 2018-04-22 19:55:00 +0200 | [diff] [blame] | 899 | |
| 900 | # What's your poison? |
| 901 | if (defined(testonly) && testonly) { |
| 902 | assert(!defined(poisonous)) |
| 903 | assert(!defined(allow_poison)) |
| 904 | } else { |
| 905 | if (!defined(poisonous)) { |
| 906 | poisonous = [] |
| 907 | } |
| 908 | if (!defined(allow_poison)) { |
| 909 | allow_poison = [] |
| 910 | } |
| 911 | if (!defined(assert_no_deps)) { |
| 912 | assert_no_deps = [] |
| 913 | } |
| 914 | if (!defined(deps)) { |
| 915 | deps = [] |
| 916 | } |
| 917 | foreach(p, poisonous) { |
| 918 | deps += [ webrtc_root + ":poison_" + p ] |
| 919 | } |
| 920 | foreach(poison_type, all_poison_types) { |
| 921 | allow_dep = true |
| 922 | foreach(v, visibility) { |
| 923 | if (v == "*") { |
| 924 | allow_dep = false |
| 925 | } |
| 926 | } |
| 927 | foreach(p, allow_poison + poisonous) { |
| 928 | if (p == poison_type) { |
| 929 | allow_dep = true |
| 930 | } |
| 931 | } |
| 932 | if (!allow_dep) { |
| 933 | assert_no_deps += [ webrtc_root + ":poison_" + poison_type ] |
| 934 | } |
| 935 | } |
| 936 | } |
| 937 | |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 938 | configs += invoker.configs |
| 939 | configs -= rtc_remove_configs |
| 940 | configs -= invoker.suppressed_configs |
Mirko Bonadei | 9a89a49 | 2018-05-29 14:22:32 +0000 | [diff] [blame] | 941 | public_configs = [ |
| 942 | rtc_common_inherited_config, |
| 943 | absl_include_config, |
| 944 | absl_define_config, |
| 945 | ] |
Mirko Bonadei | 2ab97f6 | 2019-07-18 13:44:12 +0200 | [diff] [blame] | 946 | if (defined(testonly) && testonly) { |
| 947 | public_configs += [ absl_flags_config ] |
| 948 | } |
mbonadei | 9aa3f0a | 2017-01-24 06:58:22 -0800 | [diff] [blame] | 949 | if (defined(invoker.public_configs)) { |
| 950 | public_configs += invoker.public_configs |
| 951 | } |
| 952 | } |
| 953 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 954 | |
| 955 | if (is_ios) { |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 956 | # TODO: Generate module.modulemap file to enable use in Swift |
| 957 | # projects. See "mac_framework_bundle_with_umbrella_header". |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 958 | template("ios_framework_bundle_with_umbrella_header") { |
| 959 | forward_variables_from(invoker, [ "output_name" ]) |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 960 | this_target_name = target_name |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 961 | umbrella_header_path = |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 962 | "$target_gen_dir/$output_name.framework/WebRTC/$output_name.h" |
| 963 | |
| 964 | action_foreach("create_bracket_include_headers_$target_name") { |
| 965 | script = "//tools_webrtc/apple/copy_framework_header.py" |
| 966 | sources = invoker.sources |
| 967 | output_name = invoker.output_name |
| 968 | outputs = [ |
| 969 | "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}", |
| 970 | ] |
| 971 | args = [ |
| 972 | "--input", |
| 973 | "{{source}}", |
| 974 | "--output", |
| 975 | rebase_path(target_gen_dir, root_build_dir) + |
| 976 | "/$output_name.framework/WebRTC/{{source_file_part}}", |
| 977 | ] |
| 978 | } |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 979 | |
| 980 | ios_framework_bundle(target_name) { |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 981 | forward_variables_from(invoker, "*", [ "public_headers" ]) |
| 982 | public_headers = get_target_outputs( |
| 983 | ":create_bracket_include_headers_$this_target_name") |
| 984 | deps += [ |
| 985 | ":copy_umbrella_header_$target_name", |
| 986 | ":create_bracket_include_headers_$target_name", |
| 987 | ] |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 988 | } |
| 989 | |
| 990 | action("umbrella_header_$target_name") { |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 991 | public_headers = get_target_outputs( |
| 992 | ":create_bracket_include_headers_$this_target_name") |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 993 | |
| 994 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 995 | |
Mirko Bonadei | ccbe95f | 2020-01-21 12:10:10 +0100 | [diff] [blame] | 996 | outputs = [ umbrella_header_path ] |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 997 | args = [ |
| 998 | "--out", |
| 999 | rebase_path(umbrella_header_path, root_build_dir), |
| 1000 | "--sources", |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 1001 | ] + public_headers |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 1002 | deps = [ ":create_bracket_include_headers_$this_target_name" ] |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 1003 | } |
| 1004 | |
Jordan Rose | 53d3fc9 | 2021-07-06 12:16:41 -0700 | [diff] [blame] | 1005 | if (target_environment == "catalyst") { |
| 1006 | # Catalyst frameworks use the same layout as regular Mac frameworks. |
| 1007 | headers_dir = "Versions/A/Headers" |
| 1008 | } else { |
| 1009 | headers_dir = "Headers" |
| 1010 | } |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 1011 | copy("copy_umbrella_header_$target_name") { |
Mirko Bonadei | ccbe95f | 2020-01-21 12:10:10 +0100 | [diff] [blame] | 1012 | sources = [ umbrella_header_path ] |
| 1013 | outputs = |
Jordan Rose | 53d3fc9 | 2021-07-06 12:16:41 -0700 | [diff] [blame] | 1014 | [ "$root_out_dir/$output_name.framework/$headers_dir/$output_name.h" ] |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 1015 | |
Mirko Bonadei | ccbe95f | 2020-01-21 12:10:10 +0100 | [diff] [blame] | 1016 | deps = [ ":umbrella_header_$target_name" ] |
Anders Carlsson | dc6b477 | 2018-01-15 13:31:03 +0100 | [diff] [blame] | 1017 | } |
| 1018 | } |
| 1019 | |
| 1020 | set_defaults("ios_framework_bundle_with_umbrella_header") { |
| 1021 | configs = default_shared_library_configs |
| 1022 | } |
kthelgason | 4065a57 | 2017-02-14 04:58:56 -0800 | [diff] [blame] | 1023 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 1024 | |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1025 | if (is_mac) { |
| 1026 | template("mac_framework_bundle_with_umbrella_header") { |
| 1027 | forward_variables_from(invoker, [ "output_name" ]) |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 1028 | this_target_name = target_name |
| 1029 | umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h" |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 1030 | modulemap_path = "$target_gen_dir/Modules/module.modulemap" |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1031 | |
| 1032 | mac_framework_bundle(target_name) { |
Thomas Anderson | 6fde78c | 2019-01-23 10:40:29 -0800 | [diff] [blame] | 1033 | forward_variables_from(invoker, "*", [ "configs" ]) |
| 1034 | if (defined(invoker.configs)) { |
| 1035 | configs += invoker.configs |
| 1036 | } |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1037 | |
| 1038 | framework_version = "A" |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 1039 | framework_contents = [ |
| 1040 | "Headers", |
| 1041 | "Modules", |
| 1042 | "Resources", |
| 1043 | ] |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1044 | |
| 1045 | ldflags = [ |
| 1046 | "-all_load", |
| 1047 | "-install_name", |
| 1048 | "@rpath/$output_name.framework/$output_name", |
| 1049 | ] |
| 1050 | |
| 1051 | deps += [ |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 1052 | ":copy_framework_headers_$this_target_name", |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 1053 | ":copy_modulemap_$this_target_name", |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 1054 | ":copy_umbrella_header_$this_target_name", |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 1055 | ":create_bracket_include_headers_$this_target_name", |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 1056 | ":modulemap_$this_target_name", |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 1057 | ":umbrella_header_$this_target_name", |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1058 | ] |
| 1059 | } |
| 1060 | |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 1061 | action_foreach("create_bracket_include_headers_$this_target_name") { |
| 1062 | script = "//tools_webrtc/apple/copy_framework_header.py" |
| 1063 | sources = invoker.sources |
| 1064 | output_name = invoker.output_name |
| 1065 | outputs = [ |
| 1066 | "$target_gen_dir/$output_name.framework/WebRTC/{{source_file_part}}", |
| 1067 | ] |
| 1068 | args = [ |
| 1069 | "--input", |
| 1070 | "{{source}}", |
| 1071 | "--output", |
| 1072 | rebase_path(target_gen_dir, root_build_dir) + |
| 1073 | "/$output_name.framework/WebRTC/{{source_file_part}}", |
| 1074 | ] |
| 1075 | } |
| 1076 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 1077 | bundle_data("copy_framework_headers_$this_target_name") { |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 1078 | sources = get_target_outputs( |
| 1079 | ":create_bracket_include_headers_$this_target_name") |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1080 | |
Mirko Bonadei | ccbe95f | 2020-01-21 12:10:10 +0100 | [diff] [blame] | 1081 | outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ] |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 1082 | deps = [ ":create_bracket_include_headers_$this_target_name" ] |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1083 | } |
| 1084 | |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 1085 | action("modulemap_$this_target_name") { |
| 1086 | script = "//tools_webrtc/ios/generate_modulemap.py" |
| 1087 | args = [ |
| 1088 | "--out", |
| 1089 | rebase_path(modulemap_path, root_build_dir), |
| 1090 | "--name", |
| 1091 | output_name, |
| 1092 | ] |
Mirko Bonadei | ccbe95f | 2020-01-21 12:10:10 +0100 | [diff] [blame] | 1093 | outputs = [ modulemap_path ] |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 1094 | } |
| 1095 | |
| 1096 | bundle_data("copy_modulemap_$this_target_name") { |
Mirko Bonadei | ccbe95f | 2020-01-21 12:10:10 +0100 | [diff] [blame] | 1097 | sources = [ modulemap_path ] |
| 1098 | outputs = [ "{{bundle_contents_dir}}/Modules/module.modulemap" ] |
| 1099 | deps = [ ":modulemap_$this_target_name" ] |
Joel Sutherland | d2fb1bf | 2018-10-02 16:08:25 -0400 | [diff] [blame] | 1100 | } |
| 1101 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 1102 | action("umbrella_header_$this_target_name") { |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 1103 | sources = get_target_outputs( |
| 1104 | ":create_bracket_include_headers_$this_target_name") |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1105 | |
| 1106 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 1107 | |
Mirko Bonadei | ccbe95f | 2020-01-21 12:10:10 +0100 | [diff] [blame] | 1108 | outputs = [ umbrella_header_path ] |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1109 | args = [ |
| 1110 | "--out", |
| 1111 | rebase_path(umbrella_header_path, root_build_dir), |
| 1112 | "--sources", |
| 1113 | ] + sources |
Daniel.L (Byoungchan Lee) | 32026ed | 2020-10-17 07:49:28 +0900 | [diff] [blame] | 1114 | deps = [ ":create_bracket_include_headers_$this_target_name" ] |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1115 | } |
| 1116 | |
Anders Carlsson | 95c56ee | 2018-09-06 15:48:17 +0200 | [diff] [blame] | 1117 | bundle_data("copy_umbrella_header_$this_target_name") { |
Mirko Bonadei | ccbe95f | 2020-01-21 12:10:10 +0100 | [diff] [blame] | 1118 | sources = [ umbrella_header_path ] |
| 1119 | outputs = [ "{{bundle_contents_dir}}/Headers/$output_name.h" ] |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1120 | |
Mirko Bonadei | ccbe95f | 2020-01-21 12:10:10 +0100 | [diff] [blame] | 1121 | deps = [ ":umbrella_header_$this_target_name" ] |
Anders Carlsson | 37bbf79 | 2018-09-05 16:29:27 +0200 | [diff] [blame] | 1122 | } |
| 1123 | } |
| 1124 | } |
| 1125 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 1126 | if (is_android) { |
| 1127 | template("rtc_android_library") { |
| 1128 | android_library(target_name) { |
| 1129 | forward_variables_from(invoker, |
| 1130 | "*", |
| 1131 | [ |
| 1132 | "configs", |
| 1133 | "public_configs", |
| 1134 | "suppressed_configs", |
| 1135 | "visibility", |
| 1136 | ]) |
| 1137 | |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 1138 | errorprone_args = [] |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 1139 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 1140 | # Treat warnings as errors. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 1141 | errorprone_args += [ "-Werror" ] |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 1142 | |
| 1143 | # Add any arguments defined by the invoker. |
Oleh Prypin | 05aee74 | 2018-11-23 17:29:44 +0100 | [diff] [blame] | 1144 | if (defined(invoker.errorprone_args)) { |
| 1145 | errorprone_args += invoker.errorprone_args |
Sami Kalliomäki | e7fac68 | 2018-03-20 16:32:49 +0100 | [diff] [blame] | 1146 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 1147 | |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 1148 | if (!defined(deps)) { |
| 1149 | deps = [] |
| 1150 | } |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 1151 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 1152 | no_build_hooks = true |
Mirko Bonadei | 8b7cfa1 | 2020-06-03 21:23:41 +0200 | [diff] [blame] | 1153 | not_needed([ "android_manifest" ]) |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 1154 | } |
| 1155 | } |
| 1156 | |
| 1157 | template("rtc_android_apk") { |
| 1158 | android_apk(target_name) { |
| 1159 | forward_variables_from(invoker, |
| 1160 | "*", |
| 1161 | [ |
| 1162 | "configs", |
| 1163 | "public_configs", |
| 1164 | "suppressed_configs", |
| 1165 | "visibility", |
| 1166 | ]) |
| 1167 | |
| 1168 | # Treat warnings as errors. |
Yves Gerey | 2f385d2 | 2019-11-20 12:10:08 +0100 | [diff] [blame] | 1169 | errorprone_args = [] |
| 1170 | errorprone_args += [ "-Werror" ] |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 1171 | |
| 1172 | if (!defined(deps)) { |
| 1173 | deps = [] |
| 1174 | } |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 1175 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 1176 | no_build_hooks = true |
| 1177 | } |
| 1178 | } |
| 1179 | |
| 1180 | template("rtc_instrumentation_test_apk") { |
| 1181 | instrumentation_test_apk(target_name) { |
| 1182 | forward_variables_from(invoker, |
| 1183 | "*", |
| 1184 | [ |
| 1185 | "configs", |
| 1186 | "public_configs", |
| 1187 | "suppressed_configs", |
| 1188 | "visibility", |
| 1189 | ]) |
| 1190 | |
| 1191 | # Treat warnings as errors. |
Yves Gerey | 2f385d2 | 2019-11-20 12:10:08 +0100 | [diff] [blame] | 1192 | errorprone_args = [] |
| 1193 | errorprone_args += [ "-Werror" ] |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 1194 | |
| 1195 | if (!defined(deps)) { |
| 1196 | deps = [] |
| 1197 | } |
Sami Kalliomäki | dc52651 | 2018-03-27 17:07:27 +0200 | [diff] [blame] | 1198 | |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 +0000 | [diff] [blame] | 1199 | no_build_hooks = true |
| 1200 | } |
| 1201 | } |
| 1202 | } |