mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [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 14:58:22 | [diff] [blame] | 8 | import("//build/config/arm.gni") |
| 9 | import("//build/config/features.gni") |
| 10 | import("//build/config/mips.gni") |
| 11 | import("//build/config/sanitizers/sanitizers.gni") |
ehmaldonado | 0d729b3 | 2017-02-10 09:38:23 | [diff] [blame] | 12 | import("//build/config/ui.gni") |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 13 | import("//build_overrides/build.gni") |
mbonadei | 9660627 | 2017-03-04 03:41:59 | [diff] [blame] | 14 | |
| 15 | if (!build_with_chromium && is_component_build) { |
| 16 | print("The Gn argument `is_component_build` is currently " + |
| 17 | "ignored for WebRTC builds.") |
| 18 | print("Component builds are supported by Chromium and the argument " + |
| 19 | "`is_component_build` makes it possible to create shared libraries " + |
| 20 | "instead of static libraries.") |
| 21 | print("If an app depends on WebRTC it makes sense to just depend on the " + |
| 22 | "WebRTC static library, so there is no difference between " + |
| 23 | "`is_component_build=true` and `is_component_build=false`.") |
| 24 | print( |
| 25 | "More info about component builds at: " + "https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md") |
| 26 | assert(!is_component_build, "Component builds are not supported in WebRTC.") |
| 27 | } |
| 28 | |
kthelgason | 4065a576 | 2017-02-14 12:58:56 | [diff] [blame] | 29 | if (is_ios) { |
| 30 | import("//build/config/ios/rules.gni") |
| 31 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 32 | |
| 33 | declare_args() { |
Karl Wiberg | eb254b4 | 2017-11-01 14:08:12 | [diff] [blame] | 34 | # Include the iLBC audio codec? |
| 35 | rtc_include_ilbc = true |
| 36 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 37 | # Disable this to avoid building the Opus audio codec. |
| 38 | rtc_include_opus = true |
| 39 | |
minyue | 2e03c66 | 2017-02-02 01:31:11 | [diff] [blame] | 40 | # Enable this if the Opus version upon which WebRTC is built supports direct |
| 41 | # encoding of 120 ms packets. |
minyue-webrtc | 516711c | 2017-07-27 15:45:49 | [diff] [blame] | 42 | rtc_opus_support_120ms_ptime = true |
minyue | 2e03c66 | 2017-02-02 01:31:11 | [diff] [blame] | 43 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 44 | # Enable this to let the Opus audio codec change complexity on the fly. |
| 45 | rtc_opus_variable_complexity = false |
| 46 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 47 | # Used to specify an external Jsoncpp include path when not compiling the |
| 48 | # library that comes with WebRTC (i.e. rtc_build_json == 0). |
| 49 | rtc_jsoncpp_root = "//third_party/jsoncpp/source/include" |
| 50 | |
| 51 | # Used to specify an external OpenSSL include path when not compiling the |
| 52 | # library that comes with WebRTC (i.e. rtc_build_ssl == 0). |
| 53 | rtc_ssl_root = "" |
| 54 | |
| 55 | # Selects fixed-point code where possible. |
| 56 | rtc_prefer_fixed_point = false |
| 57 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 58 | # Disable the code for the intelligibility enhancer by default. |
| 59 | rtc_enable_intelligibility_enhancer = false |
| 60 | |
| 61 | # Enable when an external authentication mechanism is used for performing |
| 62 | # packet authentication for RTP packets instead of libsrtp. |
| 63 | rtc_enable_external_auth = build_with_chromium |
| 64 | |
| 65 | # Selects whether debug dumps for the audio processing module |
| 66 | # should be generated. |
| 67 | apm_debug_dump = false |
| 68 | |
| 69 | # Set this to true to enable BWE test logging. |
| 70 | rtc_enable_bwe_test_logging = false |
| 71 | |
Joachim Bauch | 93e9134 | 2017-12-07 00:25:53 | [diff] [blame] | 72 | # Set this to false to skip building examples. |
| 73 | rtc_build_examples = true |
| 74 | |
| 75 | # Set this to false to skip building tools. |
| 76 | rtc_build_tools = true |
| 77 | |
Joachim Bauch | 75f18fc | 2017-12-20 20:25:47 | [diff] [blame] | 78 | # Set this to false to skip building code that requires X11. |
| 79 | rtc_use_x11 = use_x11 |
| 80 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 81 | # Enable to use the Mozilla internal settings. |
| 82 | build_with_mozilla = false |
| 83 | |
| 84 | rtc_enable_android_opensl = false |
| 85 | |
| 86 | # Link-Time Optimizations. |
| 87 | # Executes code generation at link-time instead of compile-time. |
| 88 | # https://gcc.gnu.org/wiki/LinkTimeOptimization |
| 89 | rtc_use_lto = false |
| 90 | |
| 91 | # Set to "func", "block", "edge" for coverage generation. |
| 92 | # At unit test runtime set UBSAN_OPTIONS="coverage=1". |
| 93 | # It is recommend to set include_examples=0. |
| 94 | # Use llvm's sancov -html-report for human readable reports. |
| 95 | # See http://clang.llvm.org/docs/SanitizerCoverage.html . |
| 96 | rtc_sanitize_coverage = "" |
| 97 | |
perkj | 650fdae | 2017-08-25 12:00:11 | [diff] [blame] | 98 | # Links a default implementation of task queues to targets |
| 99 | # that depend on the target rtc_task_queue. Set to false to |
| 100 | # use an external implementation. |
| 101 | rtc_link_task_queue_impl = true |
| 102 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 103 | if (current_cpu == "arm" || current_cpu == "arm64") { |
| 104 | rtc_prefer_fixed_point = true |
| 105 | } |
| 106 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 107 | # Determines whether NEON code will be built. |
| 108 | rtc_build_with_neon = |
| 109 | (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64" |
| 110 | |
| 111 | # Enable this to build OpenH264 encoder/FFmpeg decoder. This is supported on |
| 112 | # all platforms except Android and iOS. Because FFmpeg can be built |
| 113 | # with/without H.264 support, |ffmpeg_branding| has to separately be set to a |
| 114 | # value that includes H.264, for example "Chrome". If FFmpeg is built without |
| 115 | # H.264, compilation succeeds but |H264DecoderImpl| fails to initialize. See |
| 116 | # also: |rtc_initialize_ffmpeg|. |
| 117 | # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. |
| 118 | # http://www.openh264.org, https://www.ffmpeg.org/ |
Oleh Prypin | d3070f4 | 2017-12-27 10:07:19 | [diff] [blame] | 119 | rtc_use_h264 = |
| 120 | is_chrome_branded && proprietary_codecs && !is_android && !is_ios |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 121 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 122 | # By default, use normal platform audio support or dummy audio, but don't |
| 123 | # use file-based audio playout and record. |
| 124 | rtc_use_dummy_audio_file_devices = false |
| 125 | |
henrika | 7be7883 | 2017-06-13 15:34:16 | [diff] [blame] | 126 | # When set to true, replace the audio output with a sinus tone at 440Hz. |
| 127 | # The ADM will ask for audio data from WebRTC but instead of reading real |
| 128 | # audio samples from NetEQ, a sinus tone will be generated and replace the |
| 129 | # real audio samples. |
| 130 | rtc_audio_device_plays_sinus_tone = false |
| 131 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 132 | # When set to true, test targets will declare the files needed to run memcheck |
| 133 | # as data dependencies. This is to enable memcheck execution on swarming bots. |
| 134 | rtc_use_memcheck = false |
| 135 | |
| 136 | # FFmpeg must be initialized for |H264DecoderImpl| to work. This can be done |
| 137 | # by WebRTC during |H264DecoderImpl::InitDecode| or externally. FFmpeg must |
| 138 | # only be initialized once. Projects that initialize FFmpeg externally, such |
| 139 | # as Chromium, must turn this flag off so that WebRTC does not also |
| 140 | # initialize. |
| 141 | rtc_initialize_ffmpeg = !build_with_chromium |
Anders Carlsson | dd8c165 | 2018-01-30 09:32:13 | [diff] [blame] | 142 | |
| 143 | # Disable this to build without support for built-in software codecs. |
| 144 | rtc_use_builtin_sw_codecs = true |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 145 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 146 | |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 147 | if (!build_with_mozilla) { |
| 148 | import("//testing/test.gni") |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | # A second declare_args block, so that declarations within it can |
| 152 | # depend on the possibly overridden variables in the first |
| 153 | # declare_args block. |
| 154 | declare_args() { |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 155 | # Enables the use of protocol buffers for debug recordings. |
| 156 | rtc_enable_protobuf = !build_with_mozilla |
| 157 | |
| 158 | # Set this to disable building with support for SCTP data channels. |
| 159 | rtc_enable_sctp = !build_with_mozilla |
| 160 | |
| 161 | # Disable these to not build components which can be externally provided. |
| 162 | rtc_build_json = !build_with_mozilla |
| 163 | rtc_build_libsrtp = !build_with_mozilla |
| 164 | rtc_build_libvpx = !build_with_mozilla |
| 165 | rtc_libvpx_build_vp9 = !build_with_mozilla |
| 166 | rtc_build_openmax_dl = !build_with_mozilla |
| 167 | rtc_build_opus = !build_with_mozilla |
| 168 | rtc_build_ssl = !build_with_mozilla |
| 169 | rtc_build_usrsctp = !build_with_mozilla |
| 170 | |
| 171 | # Enable libevent task queues on platforms that support it. |
| 172 | # rtc_link_task_queue_impl must be set to true for this to |
| 173 | # have an effect. |
Wez | 00cecb9 | 2018-02-09 18:41:00 | [diff] [blame] | 174 | if (is_win || is_mac || is_ios || is_nacl || is_fuchsia) { |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 175 | rtc_enable_libevent = false |
| 176 | rtc_build_libevent = false |
| 177 | } else { |
| 178 | rtc_enable_libevent = true |
| 179 | rtc_build_libevent = !build_with_mozilla |
| 180 | } |
| 181 | |
| 182 | if (!is_ios && (current_cpu != "arm" || arm_version >= 7) && |
| 183 | current_cpu != "mips64el" && !build_with_mozilla) { |
| 184 | rtc_use_openmax_dl = true |
| 185 | } else { |
| 186 | rtc_use_openmax_dl = false |
| 187 | } |
| 188 | |
| 189 | # Build sources requiring GTK. NOTICE: This is not present in Chrome OS |
| 190 | # build environments, even if available for Chromium builds. |
| 191 | rtc_use_gtk = !build_with_chromium && !build_with_mozilla |
| 192 | |
| 193 | rtc_restrict_logging = build_with_chromium || build_with_mozilla |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 194 | |
| 195 | # Excluded in Chromium since its prerequisites don't require Pulse Audio. |
| 196 | rtc_include_pulse_audio = !build_with_chromium |
| 197 | |
| 198 | # Chromium uses its own IO handling, so the internal ADM is only built for |
| 199 | # standalone WebRTC. |
| 200 | rtc_include_internal_audio_device = !build_with_chromium |
| 201 | |
| 202 | # Include tests in standalone checkout. |
Dan Minor | 9c68613 | 2018-01-15 15:20:00 | [diff] [blame] | 203 | rtc_include_tests = !build_with_chromium && !build_with_mozilla |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | # Make it possible to provide custom locations for some libraries (move these |
| 207 | # up into declare_args should we need to actually use them for the GN build). |
| 208 | rtc_libvpx_dir = "//third_party/libvpx" |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 209 | rtc_opus_dir = "//third_party/opus" |
| 210 | |
| 211 | # Desktop capturer is supported only on Windows, OSX and Linux. |
Joachim Bauch | 75f18fc | 2017-12-20 20:25:47 | [diff] [blame] | 212 | rtc_desktop_capture_supported = is_win || is_mac || (is_linux && rtc_use_x11) |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 213 | |
| 214 | ############################################################################### |
| 215 | # Templates |
| 216 | # |
| 217 | |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 218 | # Points to // in webrtc stand-alone or to //third_party/webrtc/ in |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 219 | # chromium. |
| 220 | # We need absolute paths for all configs in templates as they are shared in |
| 221 | # different subdirectories. |
| 222 | webrtc_root = get_path_info(".", "abspath") |
| 223 | |
| 224 | # Global configuration that should be applied to all WebRTC targets. |
| 225 | # You normally shouldn't need to include this in your target as it's |
| 226 | # automatically included when using the rtc_* templates. |
| 227 | # It sets defines, include paths and compilation warnings accordingly, |
| 228 | # both for WebRTC stand-alone builds and for the scenario when WebRTC |
| 229 | # native code is built as part of Chromium. |
| 230 | rtc_common_configs = [ webrtc_root + ":common_config" ] |
| 231 | |
kthelgason | c097710 | 2017-04-24 07:57:16 | [diff] [blame] | 232 | if (is_mac || is_ios) { |
| 233 | rtc_common_configs += [ "//build/config/compiler:enable_arc" ] |
| 234 | } |
| 235 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 236 | # Global public configuration that should be applied to all WebRTC targets. You |
| 237 | # normally shouldn't need to include this in your target as it's automatically |
| 238 | # included when using the rtc_* templates. It set the defines, include paths and |
| 239 | # compilation warnings that should be propagated to dependents of the targets |
| 240 | # depending on the target having this config. |
| 241 | rtc_common_inherited_config = webrtc_root + ":common_inherited_config" |
| 242 | |
| 243 | # Common configs to remove or add in all rtc targets. |
| 244 | rtc_remove_configs = [] |
| 245 | rtc_add_configs = rtc_common_configs |
| 246 | |
| 247 | set_defaults("rtc_test") { |
| 248 | configs = rtc_add_configs |
| 249 | suppressed_configs = [] |
| 250 | } |
| 251 | |
| 252 | set_defaults("rtc_source_set") { |
| 253 | configs = rtc_add_configs |
| 254 | suppressed_configs = [] |
| 255 | } |
| 256 | |
| 257 | set_defaults("rtc_executable") { |
| 258 | configs = rtc_add_configs |
| 259 | suppressed_configs = [] |
| 260 | } |
| 261 | |
| 262 | set_defaults("rtc_static_library") { |
| 263 | configs = rtc_add_configs |
| 264 | suppressed_configs = [] |
| 265 | } |
| 266 | |
| 267 | set_defaults("rtc_shared_library") { |
| 268 | configs = rtc_add_configs |
| 269 | suppressed_configs = [] |
| 270 | } |
| 271 | |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 272 | webrtc_default_visibility = [ webrtc_root + "/*" ] |
| 273 | if (build_with_chromium) { |
| 274 | # Allow Chromium's WebRTC overrides targets to bypass the regular |
| 275 | # visibility restrictions. |
| 276 | webrtc_default_visibility += [ webrtc_root + "/../webrtc_overrides/*" ] |
| 277 | } |
| 278 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 279 | template("rtc_test") { |
| 280 | test(target_name) { |
| 281 | forward_variables_from(invoker, |
| 282 | "*", |
| 283 | [ |
| 284 | "configs", |
| 285 | "public_configs", |
| 286 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 287 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 288 | ]) |
Mirko Bonadei | dd41194 | 2017-11-21 14:35:27 | [diff] [blame] | 289 | |
| 290 | # Always override to public because when target_os is Android the `test` |
| 291 | # template can override it to [ "*" ] and we want to avoid conditional |
| 292 | # visibility. |
Mirko Bonadei | 2155881 | 2017-11-21 11:47:34 | [diff] [blame] | 293 | visibility = [ "*" ] |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 294 | configs += invoker.configs |
| 295 | configs -= rtc_remove_configs |
| 296 | configs -= invoker.suppressed_configs |
| 297 | public_configs = [ rtc_common_inherited_config ] |
| 298 | if (defined(invoker.public_configs)) { |
| 299 | public_configs += invoker.public_configs |
| 300 | } |
sakal | d7fdb80 | 2017-05-26 08:51:53 | [diff] [blame] | 301 | if (!build_with_chromium && is_android) { |
Jianjun Zhu | 037f3e4 | 2017-08-15 13:48:37 | [diff] [blame] | 302 | android_manifest = webrtc_root + "test/android/AndroidManifest.xml" |
| 303 | deps += [ webrtc_root + "test:native_test_java" ] |
sakal | d7fdb80 | 2017-05-26 08:51:53 | [diff] [blame] | 304 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 305 | } |
| 306 | } |
| 307 | |
| 308 | template("rtc_source_set") { |
| 309 | source_set(target_name) { |
| 310 | forward_variables_from(invoker, |
| 311 | "*", |
| 312 | [ |
| 313 | "configs", |
| 314 | "public_configs", |
| 315 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 316 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 317 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 318 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 319 | if (!defined(visibility)) { |
| 320 | visibility = webrtc_default_visibility |
| 321 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 322 | configs += invoker.configs |
| 323 | configs -= rtc_remove_configs |
| 324 | configs -= invoker.suppressed_configs |
| 325 | public_configs = [ rtc_common_inherited_config ] |
| 326 | if (defined(invoker.public_configs)) { |
| 327 | public_configs += invoker.public_configs |
| 328 | } |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | template("rtc_executable") { |
| 333 | executable(target_name) { |
| 334 | forward_variables_from(invoker, |
| 335 | "*", |
| 336 | [ |
| 337 | "deps", |
| 338 | "configs", |
| 339 | "public_configs", |
| 340 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 341 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 342 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 343 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 344 | if (!defined(visibility)) { |
| 345 | visibility = webrtc_default_visibility |
| 346 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 347 | configs += invoker.configs |
| 348 | configs -= rtc_remove_configs |
| 349 | configs -= invoker.suppressed_configs |
| 350 | deps = [ |
thomasanderson | 7f52f08 | 2017-05-19 06:51:46 | [diff] [blame] | 351 | "//build/config:exe_and_shlib_deps", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 352 | ] |
| 353 | deps += invoker.deps |
perkj | 650fdae | 2017-08-25 12:00:11 | [diff] [blame] | 354 | |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 355 | public_configs = [ rtc_common_inherited_config ] |
| 356 | if (defined(invoker.public_configs)) { |
| 357 | public_configs += invoker.public_configs |
| 358 | } |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | template("rtc_static_library") { |
| 363 | static_library(target_name) { |
| 364 | forward_variables_from(invoker, |
| 365 | "*", |
| 366 | [ |
| 367 | "configs", |
| 368 | "public_configs", |
| 369 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 370 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 371 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 372 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 373 | if (!defined(visibility)) { |
| 374 | visibility = webrtc_default_visibility |
| 375 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 376 | configs += invoker.configs |
| 377 | configs -= rtc_remove_configs |
| 378 | configs -= invoker.suppressed_configs |
| 379 | public_configs = [ rtc_common_inherited_config ] |
| 380 | if (defined(invoker.public_configs)) { |
| 381 | public_configs += invoker.public_configs |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | template("rtc_shared_library") { |
| 387 | shared_library(target_name) { |
| 388 | forward_variables_from(invoker, |
| 389 | "*", |
| 390 | [ |
| 391 | "configs", |
| 392 | "public_configs", |
| 393 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 394 | "visibility", |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 395 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 396 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 397 | if (!defined(visibility)) { |
| 398 | visibility = webrtc_default_visibility |
| 399 | } |
mbonadei | 9aa3f0a | 2017-01-24 14:58:22 | [diff] [blame] | 400 | configs += invoker.configs |
| 401 | configs -= rtc_remove_configs |
| 402 | configs -= invoker.suppressed_configs |
| 403 | public_configs = [ rtc_common_inherited_config ] |
| 404 | if (defined(invoker.public_configs)) { |
| 405 | public_configs += invoker.public_configs |
| 406 | } |
| 407 | } |
| 408 | } |
kthelgason | 4065a576 | 2017-02-14 12:58:56 | [diff] [blame] | 409 | |
| 410 | if (is_ios) { |
| 411 | set_defaults("rtc_ios_xctest_test") { |
| 412 | configs = rtc_add_configs |
| 413 | suppressed_configs = [] |
| 414 | } |
| 415 | |
| 416 | template("rtc_ios_xctest_test") { |
| 417 | ios_xctest_test(target_name) { |
| 418 | forward_variables_from(invoker, |
| 419 | "*", |
| 420 | [ |
| 421 | "configs", |
| 422 | "public_configs", |
| 423 | "suppressed_configs", |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 424 | "visibility", |
kthelgason | 4065a576 | 2017-02-14 12:58:56 | [diff] [blame] | 425 | ]) |
Karl Wiberg | 138d4ac | 2017-10-16 09:16:19 | [diff] [blame] | 426 | forward_variables_from(invoker, [ "visibility" ]) |
Per Kjellander | a7f2d84 | 2018-01-10 15:54:53 | [diff] [blame] | 427 | if (!defined(visibility)) { |
| 428 | visibility = webrtc_default_visibility |
| 429 | } |
kthelgason | 4065a576 | 2017-02-14 12:58:56 | [diff] [blame] | 430 | configs += invoker.configs |
| 431 | configs -= rtc_remove_configs |
| 432 | configs -= invoker.suppressed_configs |
| 433 | public_configs = [ rtc_common_inherited_config ] |
| 434 | if (defined(invoker.public_configs)) { |
| 435 | public_configs += invoker.public_configs |
| 436 | } |
| 437 | } |
| 438 | } |
Anders Carlsson | dc6b477 | 2018-01-15 12:31:03 | [diff] [blame] | 439 | |
| 440 | template("ios_framework_bundle_with_umbrella_header") { |
| 441 | forward_variables_from(invoker, [ "output_name" ]) |
| 442 | umbrella_header_path = |
| 443 | "$target_gen_dir/$output_name.framework/Headers/$output_name.h" |
| 444 | |
| 445 | ios_framework_bundle(target_name) { |
| 446 | forward_variables_from(invoker, "*", []) |
| 447 | |
| 448 | deps += [ ":copy_umbrella_header_$target_name" ] |
| 449 | } |
| 450 | |
| 451 | action("umbrella_header_$target_name") { |
| 452 | forward_variables_from(invoker, [ "public_headers" ]) |
| 453 | |
| 454 | script = "//tools_webrtc/ios/generate_umbrella_header.py" |
| 455 | |
| 456 | outputs = [ |
| 457 | umbrella_header_path, |
| 458 | ] |
| 459 | args = [ |
| 460 | "--out", |
| 461 | rebase_path(umbrella_header_path, root_build_dir), |
| 462 | "--sources", |
| 463 | ] + rebase_path(public_headers, "objc/Framework/Headers/") |
| 464 | } |
| 465 | |
| 466 | copy("copy_umbrella_header_$target_name") { |
| 467 | sources = [ |
| 468 | umbrella_header_path, |
| 469 | ] |
| 470 | outputs = [ |
| 471 | "$root_out_dir/$output_name.framework/Headers/$output_name.h", |
| 472 | ] |
| 473 | |
| 474 | deps = [ |
| 475 | ":umbrella_header_$target_name", |
| 476 | ] |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | set_defaults("ios_framework_bundle_with_umbrella_header") { |
| 481 | configs = default_shared_library_configs |
| 482 | } |
kthelgason | 4065a576 | 2017-02-14 12:58:56 | [diff] [blame] | 483 | } |
Mirko Bonadei | fbb3b7d | 2017-11-07 15:36:33 | [diff] [blame] | 484 | |
| 485 | if (is_android) { |
| 486 | template("rtc_android_library") { |
| 487 | android_library(target_name) { |
| 488 | forward_variables_from(invoker, |
| 489 | "*", |
| 490 | [ |
| 491 | "configs", |
| 492 | "public_configs", |
| 493 | "suppressed_configs", |
| 494 | "visibility", |
| 495 | ]) |
| 496 | |
| 497 | # Treat warnings as errors. |
| 498 | javac_args = [ "-Werror" ] |
| 499 | |
| 500 | # TODO(sakal): Fix build hooks crbug.com/webrtc/8168 |
| 501 | no_build_hooks = true |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | template("rtc_android_apk") { |
| 506 | android_apk(target_name) { |
| 507 | forward_variables_from(invoker, |
| 508 | "*", |
| 509 | [ |
| 510 | "configs", |
| 511 | "public_configs", |
| 512 | "suppressed_configs", |
| 513 | "visibility", |
| 514 | ]) |
| 515 | |
| 516 | # Treat warnings as errors. |
| 517 | javac_args = [ "-Werror" ] |
| 518 | |
| 519 | # TODO(sakal): Fix build hooks crbug.com/webrtc/8168 |
| 520 | no_build_hooks = true |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | template("rtc_instrumentation_test_apk") { |
| 525 | instrumentation_test_apk(target_name) { |
| 526 | forward_variables_from(invoker, |
| 527 | "*", |
| 528 | [ |
| 529 | "configs", |
| 530 | "public_configs", |
| 531 | "suppressed_configs", |
| 532 | "visibility", |
| 533 | ]) |
| 534 | |
| 535 | # Treat warnings as errors. |
| 536 | javac_args = [ "-Werror" ] |
| 537 | |
| 538 | # TODO(sakal): Fix build hooks crbug.com/webrtc/8168 |
| 539 | no_build_hooks = true |
| 540 | } |
| 541 | } |
| 542 | } |