Home | History | Annotate | Download | only in build
      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             'build_with_libjingle': 1,
     25             'webrtc_root%': '<(DEPTH)/third_party/webrtc',
     26             'apk_tests_path%': '<(DEPTH)/third_party/webrtc/build/apk_tests_noop.gyp',
     27             'modules_java_gyp_path%': '<(DEPTH)/third_party/webrtc/modules/modules_java_chromium.gyp',
     28             'gen_core_neon_offsets_gyp%': '<(DEPTH)/third_party/webrtc/modules/audio_processing/gen_core_neon_offsets_chromium.gyp',
     29           }, {
     30             'build_with_libjingle%': 0,
     31             'webrtc_root%': '<(DEPTH)/webrtc',
     32             'apk_tests_path%': '<(DEPTH)/webrtc/build/apk_tests.gyp',
     33             'modules_java_gyp_path%': '<(DEPTH)/webrtc/modules/modules_java.gyp',
     34             'gen_core_neon_offsets_gyp%':'<(DEPTH)/webrtc/modules/audio_processing/gen_core_neon_offsets.gyp',
     35           }],
     36         ],
     37       },
     38       'build_with_chromium%': '<(build_with_chromium)',
     39       'build_with_libjingle%': '<(build_with_libjingle)',
     40       'webrtc_root%': '<(webrtc_root)',
     41       'apk_tests_path%': '<(apk_tests_path)',
     42       'modules_java_gyp_path%': '<(modules_java_gyp_path)',
     43       'gen_core_neon_offsets_gyp%': '<(gen_core_neon_offsets_gyp)',
     44       'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
     45       'rbe_components_path%': '<(webrtc_root)/modules/remote_bitrate_estimator',
     46       'include_opus%': 1,
     47     },
     48     'build_with_chromium%': '<(build_with_chromium)',
     49     'build_with_libjingle%': '<(build_with_libjingle)',
     50     'webrtc_root%': '<(webrtc_root)',
     51     'apk_tests_path%': '<(apk_tests_path)',
     52     'modules_java_gyp_path%': '<(modules_java_gyp_path)',
     53     'gen_core_neon_offsets_gyp%': '<(gen_core_neon_offsets_gyp)',
     54     'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
     55     'include_opus%': '<(include_opus)',
     56     'rtc_relative_path%': 1,
     57     'rbe_components_path%': '<(rbe_components_path)',
     58     'external_libraries%': '0',
     59     'json_root%': '<(DEPTH)/third_party/jsoncpp/source/include/',
     60     # openssl needs to be defined or gyp will complain. Is is only used when
     61     # when providing external libraries so just use current directory as a
     62     # placeholder.
     63     'ssl_root%': '.',
     64 
     65     # The Chromium common.gypi we use treats all gyp files without
     66     # chromium_code==1 as third party code. This disables many of the
     67     # preferred warning settings.
     68     #
     69     # We can set this here to have WebRTC code treated as Chromium code. Our
     70     # third party code will still have the reduced warning settings.
     71     'chromium_code': 1,
     72 
     73     # Set to 1 to enable code coverage on Linux using the gcov library.
     74     'coverage%': 0,
     75 
     76     # Remote bitrate estimator logging/plotting.
     77     'enable_bwe_test_logging%': 0,
     78 
     79     # Adds video support to dependencies shared by voice and video engine.
     80     # This should normally be enabled; the intended use is to disable only
     81     # when building voice engine exclusively.
     82     'enable_video%': 1,
     83 
     84     # Selects fixed-point code where possible.
     85     'prefer_fixed_point%': 0,
     86 
     87     # Enable data logging. Produces text files with data logged within engines
     88     # which can be easily parsed for offline processing.
     89     'enable_data_logging%': 0,
     90 
     91     # Enables the use of protocol buffers for debug recordings.
     92     'enable_protobuf%': 1,
     93 
     94     # Disable these to not build components which can be externally provided.
     95     'build_json%': 1,
     96     'build_libjpeg%': 1,
     97     'build_libyuv%': 1,
     98     'build_libvpx%': 1,
     99     'build_ssl%': 1,
    100 
    101     # Disable by default
    102     'have_dbus_glib%': 0,
    103 
    104     # Enable to use the Mozilla internal settings.
    105     'build_with_mozilla%': 0,
    106 
    107     'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
    108 
    109     # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
    110     # This may be subject to change in accordance to Chromium's MIPS flags
    111     'mips_dsp_rev%': 0,
    112     'mips_fpu%' : 1,
    113     'enable_android_opensl%': 1,
    114 
    115     # Link-Time Optimizations
    116     # Executes code generation at link-time instead of compile-time
    117     # https://gcc.gnu.org/wiki/LinkTimeOptimization
    118     'use_lto%': 0,
    119 
    120     # Defer ssl perference to that specified through sslconfig.h instead of
    121     # choosing openssl or nss directly.  In practice, this can be used to
    122     # enable schannel on windows.
    123     'use_legacy_ssl_defaults%': 0,
    124 
    125     'conditions': [
    126       ['build_with_chromium==1', {
    127         # Exclude pulse audio on Chromium since its prerequisites don't require
    128         # pulse audio.
    129         'include_pulse_audio%': 0,
    130 
    131         # Exclude internal ADM since Chromium uses its own IO handling.
    132         'include_internal_audio_device%': 0,
    133 
    134       }, {  # Settings for the standalone (not-in-Chromium) build.
    135         # TODO(andrew): For now, disable the Chrome plugins, which causes a
    136         # flood of chromium-style warnings. Investigate enabling them:
    137         # http://code.google.com/p/webrtc/issues/detail?id=163
    138         'clang_use_chrome_plugins%': 0,
    139 
    140         'include_pulse_audio%': 1,
    141         'include_internal_audio_device%': 1,
    142       }],
    143       ['build_with_libjingle==1', {
    144         'include_tests%': 0,
    145         'restrict_webrtc_logging%': 1,
    146       }, {
    147         'include_tests%': 1,
    148         'restrict_webrtc_logging%': 0,
    149       }],
    150       ['OS=="ios"', {
    151         'build_libjpeg%': 0,
    152         'enable_protobuf%': 0,
    153       }],
    154       ['target_arch=="arm" or target_arch=="armv7"', {
    155         'prefer_fixed_point%': 1,
    156       }],
    157     ], # conditions
    158   },
    159   'target_defaults': {
    160     'include_dirs': [
    161       # To include the top-level directory when building in Chrome, so we can
    162       # use full paths (e.g. headers inside testing/ or third_party/).
    163       '<(DEPTH)',
    164     ],
    165     'conditions': [
    166       ['restrict_webrtc_logging==1', {
    167         'defines': ['WEBRTC_RESTRICT_LOGGING',],
    168       }],
    169       ['build_with_mozilla==1', {
    170         'defines': [
    171           # Changes settings for Mozilla build.
    172           'WEBRTC_MOZILLA_BUILD',
    173          ],
    174       }],
    175       ['have_dbus_glib==1', {
    176         'defines': [
    177           'HAVE_DBUS_GLIB',
    178          ],
    179          'cflags': [
    180            '<!@(pkg-config --cflags dbus-glib-1)',
    181          ],
    182       }],
    183       ['rtc_relative_path==1', {
    184         'defines': ['EXPAT_RELATIVE_PATH',],
    185       }],
    186       ['enable_video==1', {
    187         'defines': ['WEBRTC_MODULE_UTILITY_VIDEO',],
    188       }],
    189       ['build_with_chromium==1', {
    190         'defines': [
    191           # Changes settings for Chromium build.
    192           'WEBRTC_CHROMIUM_BUILD',
    193           'LOGGING_INSIDE_WEBRTC',
    194         ],
    195         'include_dirs': [
    196           # overrides must be included first as that is the mechanism for
    197           # selecting the override headers in Chromium.
    198           '../overrides',
    199           # Allow includes to be prefixed with webrtc/ in case it is not an
    200           # immediate subdirectory of <(DEPTH).
    201           '../..',
    202         ],
    203       }, {
    204         'conditions': [
    205           ['os_posix==1', {
    206             'conditions': [
    207               # -Wextra is currently disabled in Chromium's common.gypi. Enable
    208               # for targets that can handle it. For Android/arm64 right now
    209               # there will be an 'enumeral and non-enumeral type in conditional
    210               # expression' warning in android_tools/ndk_experimental's version
    211               # of stlport.
    212               # See: https://code.google.com/p/chromium/issues/detail?id=379699
    213               ['target_arch!="arm64" or OS!="android"', {
    214                 'cflags': [
    215                   '-Wextra',
    216                   # We need to repeat some flags from Chromium's common.gypi
    217                   # here that get overridden by -Wextra.
    218                   '-Wno-unused-parameter',
    219                   '-Wno-missing-field-initializers',
    220                   '-Wno-strict-overflow',
    221                 ],
    222               }],
    223             ],
    224             'cflags_cc': [
    225               '-Wnon-virtual-dtor',
    226               # This is enabled for clang; enable for gcc as well.
    227               '-Woverloaded-virtual',
    228             ],
    229           }],
    230           ['clang==1', {
    231             'cflags': [
    232               '-Wthread-safety',
    233             ],
    234           }],
    235         ],
    236       }],
    237       ['target_arch=="arm" or target_arch=="armv7"', {
    238         'defines': [
    239           'WEBRTC_ARCH_ARM',
    240         ],
    241         'conditions': [
    242           ['arm_version==7', {
    243             'defines': ['WEBRTC_ARCH_ARM_V7',],
    244             'conditions': [
    245               ['arm_neon==1', {
    246                 'defines': ['WEBRTC_ARCH_ARM_NEON',],
    247               }, {
    248                 'defines': ['WEBRTC_DETECT_ARM_NEON',],
    249               }],
    250             ],
    251           }],
    252         ],
    253       }],
    254       ['target_arch=="mipsel" and mips_arch_variant!="r6" and android_webview_build==0', {
    255         'defines': [
    256           'MIPS32_LE',
    257         ],
    258         'conditions': [
    259           ['mips_fpu==1', {
    260             'defines': [
    261               'MIPS_FPU_LE',
    262             ],
    263             'cflags': [
    264               '-mhard-float',
    265             ],
    266           }, {
    267             'cflags': [
    268               '-msoft-float',
    269             ],
    270           }],
    271           ['mips_arch_variant=="r2"', {
    272             'defines': [
    273               'MIPS32_R2_LE',
    274             ],
    275             'cflags': [
    276               '-mips32r2',
    277             ],
    278             'cflags_cc': [
    279               '-mips32r2',
    280             ],
    281           }],
    282           ['mips_dsp_rev==1', {
    283             'defines': [
    284               'MIPS_DSP_R1_LE',
    285             ],
    286             'cflags': [
    287               '-mdsp',
    288             ],
    289             'cflags_cc': [
    290               '-mdsp',
    291             ],
    292           }],
    293           ['mips_dsp_rev==2', {
    294             'defines': [
    295               'MIPS_DSP_R1_LE',
    296               'MIPS_DSP_R2_LE',
    297             ],
    298             'cflags': [
    299               '-mdspr2',
    300             ],
    301             'cflags_cc': [
    302               '-mdspr2',
    303             ],
    304           }],
    305         ],
    306       }],
    307       ['coverage==1 and OS=="linux"', {
    308         'cflags': [ '-ftest-coverage',
    309                     '-fprofile-arcs' ],
    310         'link_settings': { 'libraries': [ '-lgcov' ] },
    311       }],
    312       ['os_posix==1', {
    313         # For access to standard POSIXish features, use WEBRTC_POSIX instead of
    314         # a more specific macro.
    315         'defines': [
    316           'WEBRTC_POSIX',
    317         ],
    318       }],
    319       ['OS=="ios"', {
    320         'defines': [
    321           'WEBRTC_MAC',
    322           'WEBRTC_IOS',
    323         ],
    324       }],
    325       ['OS=="linux"', {
    326         'defines': [
    327           'WEBRTC_LINUX',
    328         ],
    329       }],
    330       ['OS=="mac"', {
    331         'defines': [
    332           'WEBRTC_MAC',
    333         ],
    334       }],
    335       ['OS=="win"', {
    336         'defines': [
    337           'WEBRTC_WIN',
    338         ],
    339         # TODO(andrew): enable all warnings when possible.
    340         # TODO(phoglund): get rid of 4373 supression when
    341         # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
    342         'msvs_disabled_warnings': [
    343           4373,  # legacy warning for ignoring const / volatile in signatures.
    344           4389,  # Signed/unsigned mismatch.
    345         ],
    346         # Re-enable some warnings that Chromium disables.
    347         'msvs_disabled_warnings!': [4189,],
    348       }],
    349       ['OS=="android"', {
    350         'defines': [
    351           'WEBRTC_LINUX',
    352           'WEBRTC_ANDROID',
    353          ],
    354          'conditions': [
    355            ['enable_android_opensl==1', {
    356              'defines': [
    357                'WEBRTC_ANDROID_OPENSLES',
    358              ],
    359            }],
    360            ['clang!=1', {
    361              # The Android NDK doesn't provide optimized versions of these
    362              # functions. Ensure they are disabled for all compilers.
    363              'cflags': [
    364                '-fno-builtin-cos',
    365                '-fno-builtin-sin',
    366                '-fno-builtin-cosf',
    367                '-fno-builtin-sinf',
    368              ],
    369            }],
    370          ],
    371       }],
    372     ], # conditions
    373     'direct_dependent_settings': {
    374       'conditions': [
    375         ['build_with_mozilla==1', {
    376           'defines': [
    377             # Changes settings for Mozilla build.
    378             'WEBRTC_MOZILLA_BUILD',
    379            ],
    380         }],
    381         ['build_with_chromium==1', {
    382           'defines': [
    383             # Changes settings for Chromium build.
    384             'WEBRTC_CHROMIUM_BUILD',
    385           ],
    386           'include_dirs': [
    387             # overrides must be included first as that is the mechanism for
    388             # selecting the override headers in Chromium.
    389             '../overrides',
    390             '../..',
    391           ],
    392         }, {
    393           'include_dirs': [
    394             '../..',
    395           ],
    396         }],
    397         ['OS=="mac"', {
    398           'defines': [
    399             'WEBRTC_MAC',
    400           ],
    401         }],
    402         ['OS=="ios"', {
    403           'defines': [
    404             'WEBRTC_MAC',
    405             'WEBRTC_IOS',
    406           ],
    407         }],
    408         ['OS=="win"', {
    409           'defines': [
    410             'WEBRTC_WIN',
    411           ],
    412         }],
    413         ['OS=="linux"', {
    414           'defines': [
    415             'WEBRTC_LINUX',
    416           ],
    417         }],
    418         ['OS=="android"', {
    419           'defines': [
    420             'WEBRTC_LINUX',
    421             'WEBRTC_ANDROID',
    422            ],
    423            'conditions': [
    424              ['enable_android_opensl==1', {
    425                'defines': [
    426                  'WEBRTC_ANDROID_OPENSLES',
    427                ],
    428              }]
    429            ],
    430         }],
    431         ['os_posix==1', {
    432           # For access to standard POSIXish features, use WEBRTC_POSIX instead
    433           # of a more specific macro.
    434           'defines': [
    435             'WEBRTC_POSIX',
    436           ],
    437         }],
    438       ],
    439     },
    440   }, # target_defaults
    441 }
    442 
    443