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