1 # Copyright (c) 2012 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. 8 9 # This file contains common settings for building WebRTC components. 10 11 { 12 # Nesting is required in order to use variables for setting other variables. 13 'variables': { 14 'variables': { 15 'variables': { 16 'variables': { 17 # This will already be set to zero by supplement.gypi 18 'build_with_chromium%': 1, 19 }, 20 'build_with_chromium%': '<(build_with_chromium)', 21 22 'conditions': [ 23 ['build_with_chromium==1', { 24 'webrtc_root%': '<(DEPTH)/third_party/webrtc', 25 'apk_tests_path%': '<(DEPTH)/third_party/webrtc/build/apk_tests_noop.gyp', 26 'modules_java_gyp_path%': '<(DEPTH)/third_party/webrtc/modules/modules_java_chromium.gyp', 27 }, { 28 'webrtc_root%': '<(DEPTH)/webrtc', 29 'apk_tests_path%': '<(DEPTH)/webrtc/build/apk_tests.gyp', 30 'modules_java_gyp_path%': '<(DEPTH)/webrtc/modules/modules_java.gyp', 31 }], 32 ], 33 }, 34 'build_with_chromium%': '<(build_with_chromium)', 35 'webrtc_root%': '<(webrtc_root)', 36 'apk_tests_path%': '<(apk_tests_path)', 37 'modules_java_gyp_path%': '<(modules_java_gyp_path)', 38 'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8', 39 'webrtc_vp9_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp9', 40 'include_opus%': 1, 41 'opus_dir%': '<(DEPTH)/third_party/opus', 42 43 # Enable to use the Mozilla internal settings. 44 'build_with_mozilla%': 0, 45 }, 46 'build_with_chromium%': '<(build_with_chromium)', 47 'build_with_mozilla%': '<(build_with_mozilla)', 48 'webrtc_root%': '<(webrtc_root)', 49 'apk_tests_path%': '<(apk_tests_path)', 50 'modules_java_gyp_path%': '<(modules_java_gyp_path)', 51 'webrtc_vp8_dir%': '<(webrtc_vp8_dir)', 52 'webrtc_vp9_dir%': '<(webrtc_vp9_dir)', 53 'include_opus%': '<(include_opus)', 54 'rtc_relative_path%': 1, 55 'external_libraries%': '0', 56 'json_root%': '<(DEPTH)/third_party/jsoncpp/source/include/', 57 # openssl needs to be defined or gyp will complain. Is is only used when 58 # when providing external libraries so just use current directory as a 59 # placeholder. 60 'ssl_root%': '.', 61 62 # The Chromium common.gypi we use treats all gyp files without 63 # chromium_code==1 as third party code. This disables many of the 64 # preferred warning settings. 65 # 66 # We can set this here to have WebRTC code treated as Chromium code. Our 67 # third party code will still have the reduced warning settings. 68 'chromium_code': 1, 69 70 # Set to 1 to enable code coverage on Linux using the gcov library. 71 'coverage%': 0, 72 73 # Remote bitrate estimator logging/plotting. 74 'enable_bwe_test_logging%': 0, 75 76 # Selects fixed-point code where possible. 77 'prefer_fixed_point%': 0, 78 79 # Enable data logging. Produces text files with data logged within engines 80 # which can be easily parsed for offline processing. 81 'enable_data_logging%': 0, 82 83 # Enables the use of protocol buffers for debug recordings. 84 'enable_protobuf%': 1, 85 86 # Disable these to not build components which can be externally provided. 87 'build_expat%': 1, 88 'build_json%': 1, 89 'build_libjpeg%': 1, 90 'build_libvpx%': 1, 91 'build_libyuv%': 1, 92 'build_openmax_dl%': 1, 93 'build_opus%': 1, 94 'build_protobuf%': 1, 95 'build_ssl%': 1, 96 97 # Disable by default 98 'have_dbus_glib%': 0, 99 100 # Make it possible to provide custom locations for some libraries. 101 'libvpx_dir%': '<(DEPTH)/third_party/libvpx_new', 102 'libyuv_dir%': '<(DEPTH)/third_party/libyuv', 103 'opus_dir%': '<(opus_dir)', 104 105 # Use Java based audio layer as default for Android. 106 # Change this setting to 1 to use Open SL audio instead. 107 # TODO(henrika): add support for Open SL ES. 108 'enable_android_opensl%': 0, 109 110 # Link-Time Optimizations 111 # Executes code generation at link-time instead of compile-time 112 # https://gcc.gnu.org/wiki/LinkTimeOptimization 113 'use_lto%': 0, 114 115 # Defer ssl perference to that specified through sslconfig.h instead of 116 # choosing openssl or nss directly. In practice, this can be used to 117 # enable schannel on windows. 118 'use_legacy_ssl_defaults%': 0, 119 120 # Determines whether NEON code will be built. 121 'build_with_neon%': 0, 122 123 # Enable this to use HW H.264 encoder/decoder on iOS/Mac PeerConnections. 124 # Enabling this may break interop with Android clients that support H264. 125 'use_objc_h264%': 0, 126 127 # Enable this to build H.264 encoder/decoder using third party libraries. 128 # Encoding uses OpenH264 and decoding uses FFmpeg. Because of this, OpenH264 129 # and FFmpeg have to be correctly enabled separately. 130 # - use_openh264=1 is required for OpenH264 targets to be defined. 131 # - ffmpeg_branding=Chrome is one way to support H.264 decoding in FFmpeg. 132 # FFmpeg can be built with/without H.264 support, see 'ffmpeg_branding'. 133 # Without it, it compiles but H264DecoderImpl fails to initialize. 134 # CHECK THE OPENH264, FFMPEG AND H.264 LICENSES/PATENTS BEFORE BUILDING. 135 # http://www.openh264.org, https://www.ffmpeg.org/ 136 'use_third_party_h264%': 0, # TODO(hbos): To be used in follow-up CL(s). 137 138 'conditions': [ 139 ['build_with_chromium==1', { 140 # Exclude pulse audio on Chromium since its prerequisites don't require 141 # pulse audio. 142 'include_pulse_audio%': 0, 143 144 # Exclude internal ADM since Chromium uses its own IO handling. 145 'include_internal_audio_device%': 0, 146 147 # Remove tests for Chromium to avoid slowing down GYP generation. 148 'include_tests%': 0, 149 'restrict_webrtc_logging%': 1, 150 }, { # Settings for the standalone (not-in-Chromium) build. 151 # TODO(andrew): For now, disable the Chrome plugins, which causes a 152 # flood of chromium-style warnings. Investigate enabling them: 153 # http://code.google.com/p/webrtc/issues/detail?id=163 154 'clang_use_chrome_plugins%': 0, 155 156 'include_pulse_audio%': 1, 157 'include_internal_audio_device%': 1, 158 'include_tests%': 1, 159 'restrict_webrtc_logging%': 0, 160 }], 161 ['OS=="ios"', { 162 'build_libjpeg%': 0, 163 }], 164 ['target_arch=="arm" or target_arch=="arm64"', { 165 'prefer_fixed_point%': 1, 166 }], 167 ['(target_arch=="arm" and (arm_neon==1 or arm_neon_optional==1)) or target_arch=="arm64"', { 168 'build_with_neon%': 1, 169 }], 170 ['OS!="ios" and (target_arch!="arm" or arm_version>=7) and target_arch!="mips64el"', { 171 'rtc_use_openmax_dl%': 1, 172 }, { 173 'rtc_use_openmax_dl%': 0, 174 }], 175 ], # conditions 176 }, 177 'target_defaults': { 178 'conditions': [ 179 ['restrict_webrtc_logging==1', { 180 'defines': ['WEBRTC_RESTRICT_LOGGING',], 181 }], 182 ['build_with_mozilla==1', { 183 'defines': [ 184 # Changes settings for Mozilla build. 185 'WEBRTC_MOZILLA_BUILD', 186 ], 187 }], 188 ['have_dbus_glib==1', { 189 'defines': [ 190 'HAVE_DBUS_GLIB', 191 ], 192 'cflags': [ 193 '<!@(pkg-config --cflags dbus-glib-1)', 194 ], 195 }], 196 ['rtc_relative_path==1', { 197 'defines': ['EXPAT_RELATIVE_PATH',], 198 }], 199 ['os_posix==1', { 200 'configurations': { 201 'Debug_Base': { 202 'defines': [ 203 # Chromium's build/common.gypi defines _DEBUG for all posix 204 # _except_ for ios & mac. The size of data types such as 205 # pthread_mutex_t varies between release and debug builds 206 # and is controlled via this flag. Since we now share code 207 # between base/base.gyp and build/common.gypi (this file), 208 # both gyp(i) files, must consistently set this flag uniformly 209 # or else we'll run in to hard-to-figure-out problems where 210 # one compilation unit uses code from another but expects 211 # differently laid out types. 212 # For WebRTC, we want it there as well, because ASSERT and 213 # friends trigger off of it. 214 '_DEBUG', 215 ], 216 }, 217 }, 218 }], 219 ['build_with_chromium==1', { 220 'defines': [ 221 # Changes settings for Chromium build. 222 'WEBRTC_CHROMIUM_BUILD', 223 'LOGGING_INSIDE_WEBRTC', 224 ], 225 'include_dirs': [ 226 # Include the top-level directory when building in Chrome, so we can 227 # use full paths (e.g. headers inside testing/ or third_party/). 228 '<(DEPTH)', 229 # The overrides must be included before the WebRTC root as that's the 230 # mechanism for selecting the override headers in Chromium. 231 '../../webrtc_overrides', 232 # The WebRTC root is needed to allow includes in the WebRTC code base 233 # to be prefixed with webrtc/. 234 '../..', 235 ], 236 }, { 237 # Include the top-level dir so the WebRTC code can use full paths. 238 'include_dirs': [ 239 '../..', 240 ], 241 'conditions': [ 242 ['os_posix==1', { 243 'conditions': [ 244 # -Wextra is currently disabled in Chromium's common.gypi. Enable 245 # for targets that can handle it. For Android/arm64 right now 246 # there will be an 'enumeral and non-enumeral type in conditional 247 # expression' warning in android_tools/ndk_experimental's version 248 # of stlport. 249 # See: https://code.google.com/p/chromium/issues/detail?id=379699 250 ['target_arch!="arm64" or OS!="android"', { 251 'cflags': [ 252 '-Wextra', 253 # We need to repeat some flags from Chromium's common.gypi 254 # here that get overridden by -Wextra. 255 '-Wno-unused-parameter', 256 '-Wno-missing-field-initializers', 257 '-Wno-strict-overflow', 258 ], 259 }], 260 ], 261 'cflags_cc': [ 262 '-Wnon-virtual-dtor', 263 # This is enabled for clang; enable for gcc as well. 264 '-Woverloaded-virtual', 265 ], 266 }], 267 ['clang==1', { 268 'cflags': [ 269 '-Wimplicit-fallthrough', 270 '-Wthread-safety', 271 ], 272 }], 273 ], 274 }], 275 ['target_arch=="arm64"', { 276 'defines': [ 277 'WEBRTC_ARCH_ARM64', 278 'WEBRTC_HAS_NEON', 279 ], 280 }], 281 ['target_arch=="arm"', { 282 'defines': [ 283 'WEBRTC_ARCH_ARM', 284 ], 285 'conditions': [ 286 ['arm_version>=7', { 287 'defines': ['WEBRTC_ARCH_ARM_V7',], 288 'conditions': [ 289 ['arm_neon==1', { 290 'defines': ['WEBRTC_HAS_NEON',], 291 }], 292 ['arm_neon==0 and arm_neon_optional==1', { 293 'defines': ['WEBRTC_DETECT_NEON',], 294 }], 295 ], 296 }], 297 ], 298 }], 299 ['target_arch=="mipsel" and mips_arch_variant!="r6"', { 300 'defines': [ 301 'MIPS32_LE', 302 ], 303 'conditions': [ 304 ['mips_float_abi=="hard"', { 305 'defines': [ 306 'MIPS_FPU_LE', 307 ], 308 }], 309 ['mips_arch_variant=="r2"', { 310 'defines': [ 311 'MIPS32_R2_LE', 312 ], 313 }], 314 ['mips_dsp_rev==1', { 315 'defines': [ 316 'MIPS_DSP_R1_LE', 317 ], 318 }], 319 ['mips_dsp_rev==2', { 320 'defines': [ 321 'MIPS_DSP_R1_LE', 322 'MIPS_DSP_R2_LE', 323 ], 324 }], 325 ], 326 }], 327 ['coverage==1 and OS=="linux"', { 328 'cflags': [ '-ftest-coverage', 329 '-fprofile-arcs' ], 330 'link_settings': { 'libraries': [ '-lgcov' ] }, 331 }], 332 ['os_posix==1', { 333 # For access to standard POSIXish features, use WEBRTC_POSIX instead of 334 # a more specific macro. 335 'defines': [ 336 'WEBRTC_POSIX', 337 ], 338 }], 339 ['OS=="ios"', { 340 'defines': [ 341 'WEBRTC_MAC', 342 'WEBRTC_IOS', 343 ], 344 }], 345 ['OS=="ios" and use_objc_h264==1', { 346 'defines': [ 347 'WEBRTC_OBJC_H264', 348 ], 349 }], 350 ['OS=="linux"', { 351 'defines': [ 352 'WEBRTC_LINUX', 353 ], 354 }], 355 ['OS=="mac"', { 356 'defines': [ 357 'WEBRTC_MAC', 358 ], 359 }], 360 ['OS=="win"', { 361 'defines': [ 362 'WEBRTC_WIN', 363 ], 364 # TODO(andrew): enable all warnings when possible. 365 # TODO(phoglund): get rid of 4373 supression when 366 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved. 367 'msvs_disabled_warnings': [ 368 4373, # legacy warning for ignoring const / volatile in signatures. 369 4389, # Signed/unsigned mismatch. 370 ], 371 # Re-enable some warnings that Chromium disables. 372 'msvs_disabled_warnings!': [4189,], 373 }], 374 ['OS=="android"', { 375 'defines': [ 376 'WEBRTC_LINUX', 377 'WEBRTC_ANDROID', 378 ], 379 'conditions': [ 380 ['clang==0', { 381 # The Android NDK doesn't provide optimized versions of these 382 # functions. Ensure they are disabled for all compilers. 383 'cflags': [ 384 '-fno-builtin-cos', 385 '-fno-builtin-sin', 386 '-fno-builtin-cosf', 387 '-fno-builtin-sinf', 388 ], 389 }], 390 ], 391 }], 392 ['include_internal_audio_device==1', { 393 'defines': [ 394 'WEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE', 395 ], 396 }], 397 ], # conditions 398 'direct_dependent_settings': { 399 'conditions': [ 400 ['build_with_mozilla==1', { 401 'defines': [ 402 # Changes settings for Mozilla build. 403 'WEBRTC_MOZILLA_BUILD', 404 ], 405 }], 406 ['build_with_chromium==1', { 407 'defines': [ 408 # Changes settings for Chromium build. 409 'WEBRTC_CHROMIUM_BUILD', 410 ], 411 'include_dirs': [ 412 # The overrides must be included first as that is the mechanism for 413 # selecting the override headers in Chromium. 414 '../../webrtc_overrides', 415 '../..', 416 ], 417 }, { 418 'include_dirs': [ 419 '../..', 420 ], 421 }], 422 ['OS=="mac"', { 423 'defines': [ 424 'WEBRTC_MAC', 425 ], 426 }], 427 ['OS=="ios"', { 428 'defines': [ 429 'WEBRTC_MAC', 430 'WEBRTC_IOS', 431 ], 432 }], 433 ['OS=="win"', { 434 'defines': [ 435 'WEBRTC_WIN', 436 ], 437 }], 438 ['OS=="linux"', { 439 'defines': [ 440 'WEBRTC_LINUX', 441 ], 442 }], 443 ['OS=="android"', { 444 'defines': [ 445 'WEBRTC_LINUX', 446 'WEBRTC_ANDROID', 447 ], 448 }], 449 ['os_posix==1', { 450 # For access to standard POSIXish features, use WEBRTC_POSIX instead 451 # of a more specific macro. 452 'defines': [ 453 'WEBRTC_POSIX', 454 ], 455 }], 456 ], 457 }, 458 }, # target_defaults 459 } 460 461