Home | History | Annotate | Download | only in base
      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.
      8 
      9 {
     10   'includes': [ '../build/common.gypi', ],
     11   'conditions': [
     12     ['os_posix == 1 and OS != "mac" and OS != "ios"', {
     13       'conditions': [
     14         ['sysroot!=""', {
     15           'variables': {
     16             'pkg-config': '../../../build/linux/pkg-config-wrapper "<(sysroot)" "<(target_arch)"',
     17           },
     18         }, {
     19           'variables': {
     20             'pkg-config': 'pkg-config'
     21           },
     22         }],
     23       ],
     24     }],
     25     # TODO(tkchin): Mac support. There are a bunch of problems right now because
     26     # of some settings pulled down from Chromium.
     27     ['OS=="ios"', {
     28       'targets': [
     29         {
     30           'target_name': 'rtc_base_objc',
     31           'type': 'static_library',
     32           'dependencies': [
     33             'rtc_base',
     34           ],
     35           'sources': [
     36             'objc/NSString+StdString.h',
     37             'objc/NSString+StdString.mm',
     38             'objc/RTCDispatcher.h',
     39             'objc/RTCDispatcher.m',
     40             'objc/RTCLogging.h',
     41             'objc/RTCLogging.mm',
     42           ],
     43           'conditions': [
     44             ['OS=="ios"', {
     45               'sources': [
     46                 'objc/RTCCameraPreviewView.h',
     47                 'objc/RTCCameraPreviewView.m',
     48               ],
     49               'all_dependent_settings': {
     50                 'xcode_settings': {
     51                   'OTHER_LDFLAGS': [
     52                     '-framework AVFoundation',
     53                   ],
     54                 },
     55               },
     56             }],
     57           ],
     58           'xcode_settings': {
     59             'CLANG_ENABLE_OBJC_ARC': 'YES',
     60             'CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS': 'YES',
     61           },
     62         }
     63       ],
     64     }], # OS=="ios"
     65   ],
     66   'targets': [
     67     {
     68       # The subset of rtc_base approved for use outside of libjingle.
     69       'target_name': 'rtc_base_approved',
     70       'type': 'static_library',
     71       'sources': [
     72         'array_view.h',
     73         'atomicops.h',
     74         'bitbuffer.cc',
     75         'bitbuffer.h',
     76         'buffer.cc',
     77         'buffer.h',
     78         'bufferqueue.cc',
     79         'bufferqueue.h',
     80         'bytebuffer.cc',
     81         'bytebuffer.h',
     82         'byteorder.h',
     83         'checks.cc',
     84         'checks.h',
     85         'constructormagic.h',
     86         'criticalsection.cc',
     87         'criticalsection.h',
     88         'deprecation.h',
     89         'event.cc',
     90         'event.h',
     91         'event_tracer.cc',
     92         'event_tracer.h',
     93         'exp_filter.cc',
     94         'exp_filter.h',
     95         'logging.cc',
     96         'logging.h',
     97         'md5.cc',
     98         'md5.h',
     99         'md5digest.cc',
    100         'md5digest.h',
    101         'optional.h',
    102         'platform_file.cc',
    103         'platform_file.h',
    104         'platform_thread.cc',
    105         'platform_thread.h',
    106         'platform_thread_types.h',
    107         'random.cc',
    108         'random.h',
    109         'ratetracker.cc',
    110         'ratetracker.h',
    111         'safe_conversions.h',
    112         'safe_conversions_impl.h',
    113         'scoped_ptr.h',
    114         'stringencode.cc',
    115         'stringencode.h',
    116         'stringutils.cc',
    117         'stringutils.h',
    118         'systeminfo.cc',
    119         'systeminfo.h',
    120         'template_util.h',
    121         'thread_annotations.h',
    122         'thread_checker.h',
    123         'thread_checker_impl.cc',
    124         'thread_checker_impl.h',
    125         'timeutils.cc',
    126         'timeutils.h',
    127         'trace_event.h',
    128       ],
    129       'conditions': [
    130         ['build_with_chromium==1', {
    131           'dependencies': [
    132             '<(DEPTH)/base/base.gyp:base',
    133           ],
    134           'include_dirs': [
    135             '../../webrtc_overrides',
    136           ],
    137           'sources': [
    138             '../../webrtc_overrides/webrtc/base/logging.cc',
    139             '../../webrtc_overrides/webrtc/base/logging.h',
    140           ],
    141           'sources!': [
    142             'logging.cc',
    143             'logging.h',
    144           ],
    145         }],
    146       ],
    147     },
    148     {
    149       'target_name': 'rtc_base',
    150       'type': 'static_library',
    151       'dependencies': [
    152         '<(webrtc_root)/common.gyp:webrtc_common',
    153         'rtc_base_approved',
    154       ],
    155       'export_dependent_settings': [
    156         'rtc_base_approved',
    157       ],
    158       'defines': [
    159         'FEATURE_ENABLE_SSL',
    160         'SSL_USE_OPENSSL',
    161         'HAVE_OPENSSL_SSL_H',
    162         'LOGGING=1',
    163       ],
    164       'sources': [
    165         'arraysize.h',
    166         'asyncfile.cc',
    167         'asyncfile.h',
    168         'asyncinvoker.cc',
    169         'asyncinvoker.h',
    170         'asyncinvoker-inl.h',
    171         'asyncpacketsocket.cc',
    172         'asyncpacketsocket.h',
    173         'asyncresolverinterface.cc',
    174         'asyncresolverinterface.h',
    175         'asyncsocket.cc',
    176         'asyncsocket.h',
    177         'asynctcpsocket.cc',
    178         'asynctcpsocket.h',
    179         'asyncudpsocket.cc',
    180         'asyncudpsocket.h',
    181         'autodetectproxy.cc',
    182         'autodetectproxy.h',
    183         'bandwidthsmoother.cc',
    184         'bandwidthsmoother.h',
    185         'base64.cc',
    186         'base64.h',
    187         'bind.h',
    188         'callback.h',
    189         'common.cc',
    190         'common.h',
    191         'crc32.cc',
    192         'crc32.h',
    193         'cryptstring.cc',
    194         'cryptstring.h',
    195         'dbus.cc',
    196         'dbus.h',
    197         'diskcache.cc',
    198         'diskcache.h',
    199         'diskcache_win32.cc',
    200         'diskcache_win32.h',
    201         'filerotatingstream.cc',
    202         'filerotatingstream.h',
    203         'fileutils.cc',
    204         'fileutils.h',
    205         'fileutils_mock.h',
    206         'firewallsocketserver.cc',
    207         'firewallsocketserver.h',
    208         'flags.cc',
    209         'flags.h',
    210         'format_macros.h',
    211         'gunit_prod.h',
    212         'helpers.cc',
    213         'helpers.h',
    214         'httpbase.cc',
    215         'httpbase.h',
    216         'httpclient.cc',
    217         'httpclient.h',
    218         'httpcommon-inl.h',
    219         'httpcommon.cc',
    220         'httpcommon.h',
    221         'httprequest.cc',
    222         'httprequest.h',
    223         'httpserver.cc',
    224         'httpserver.h',
    225         'ifaddrs-android.cc',
    226         'ifaddrs-android.h',
    227         'ifaddrs_converter.cc',
    228         'ifaddrs_converter.h',
    229         'macifaddrs_converter.cc',
    230         'iosfilesystem.mm',
    231         'ipaddress.cc',
    232         'ipaddress.h',
    233         'json.cc',
    234         'json.h',
    235         'latebindingsymboltable.cc',
    236         'latebindingsymboltable.h',
    237         'libdbusglibsymboltable.cc',
    238         'libdbusglibsymboltable.h',
    239         'linux.cc',
    240         'linux.h',
    241         'linuxfdwalk.c',
    242         'linuxfdwalk.h',
    243         'linked_ptr.h',
    244         'logsinks.cc',
    245         'logsinks.h',
    246         'macasyncsocket.cc',
    247         'macasyncsocket.h',
    248         'maccocoasocketserver.h',
    249         'maccocoasocketserver.mm',
    250         'maccocoathreadhelper.h',
    251         'maccocoathreadhelper.mm',
    252         'macconversion.cc',
    253         'macconversion.h',
    254         'macsocketserver.cc',
    255         'macsocketserver.h',
    256         'macutils.cc',
    257         'macutils.h',
    258         'macwindowpicker.cc',
    259         'macwindowpicker.h',
    260         'mathutils.h',
    261         'messagedigest.cc',
    262         'messagedigest.h',
    263         'messagehandler.cc',
    264         'messagehandler.h',
    265         'messagequeue.cc',
    266         'messagequeue.h',
    267         'multipart.cc',
    268         'multipart.h',
    269         'natserver.cc',
    270         'natserver.h',
    271         'natsocketfactory.cc',
    272         'natsocketfactory.h',
    273         'nattypes.cc',
    274         'nattypes.h',
    275         'nethelpers.cc',
    276         'nethelpers.h',
    277         'network.cc',
    278         'network.h',
    279         'networkmonitor.cc',
    280         'networkmonitor.h',
    281         'nullsocketserver.h',
    282         'openssl.h',
    283         'openssladapter.cc',
    284         'openssladapter.h',
    285         'openssldigest.cc',
    286         'openssldigest.h',
    287         'opensslidentity.cc',
    288         'opensslidentity.h',
    289         'opensslstreamadapter.cc',
    290         'opensslstreamadapter.h',
    291         'optionsfile.cc',
    292         'optionsfile.h',
    293         'pathutils.cc',
    294         'pathutils.h',
    295         'physicalsocketserver.cc',
    296         'physicalsocketserver.h',
    297         'posix.cc',
    298         'posix.h',
    299         'profiler.cc',
    300         'profiler.h',
    301         'proxydetect.cc',
    302         'proxydetect.h',
    303         'proxyinfo.cc',
    304         'proxyinfo.h',
    305         'proxyserver.cc',
    306         'proxyserver.h',
    307         'ratelimiter.cc',
    308         'ratelimiter.h',
    309         'refcount.h',
    310         'referencecountedsingletonfactory.h',
    311         'rollingaccumulator.h',
    312         'rtccertificate.cc',
    313         'rtccertificate.h',
    314         'scoped_autorelease_pool.h',
    315         'scoped_autorelease_pool.mm',
    316         'scoped_ref_ptr.h',
    317         'scopedptrcollection.h',
    318         'sec_buffer.h',
    319         'sha1.cc',
    320         'sha1.h',
    321         'sha1digest.cc',
    322         'sha1digest.h',
    323         'sharedexclusivelock.cc',
    324         'sharedexclusivelock.h',
    325         'signalthread.cc',
    326         'signalthread.h',
    327         'sigslot.cc',
    328         'sigslot.h',
    329         'sigslotrepeater.h',
    330         'socket.h',
    331         'socketadapters.cc',
    332         'socketadapters.h',
    333         'socketaddress.cc',
    334         'socketaddress.h',
    335         'socketaddresspair.cc',
    336         'socketaddresspair.h',
    337         'socketfactory.h',
    338         'socketpool.cc',
    339         'socketpool.h',
    340         'socketserver.h',
    341         'socketstream.cc',
    342         'socketstream.h',
    343         'ssladapter.cc',
    344         'ssladapter.h',
    345         'sslconfig.h',
    346         'sslfingerprint.cc',
    347         'sslfingerprint.h',
    348         'sslidentity.cc',
    349         'sslidentity.h',
    350         'sslroots.h',
    351         'sslsocketfactory.cc',
    352         'sslsocketfactory.h',
    353         'sslstreamadapter.cc',
    354         'sslstreamadapter.h',
    355         'sslstreamadapterhelper.cc',
    356         'sslstreamadapterhelper.h',
    357         'stream.cc',
    358         'stream.h',
    359         'task.cc',
    360         'task.h',
    361         'taskparent.cc',
    362         'taskparent.h',
    363         'taskrunner.cc',
    364         'taskrunner.h',
    365         'testclient.cc',
    366         'testclient.h',
    367         'thread.cc',
    368         'thread.h',
    369         'timing.cc',
    370         'timing.h',
    371         'transformadapter.cc',
    372         'transformadapter.h',
    373         'unixfilesystem.cc',
    374         'unixfilesystem.h',
    375         'urlencode.cc',
    376         'urlencode.h',
    377         'versionparsing.cc',
    378         'versionparsing.h',
    379         'virtualsocketserver.cc',
    380         'virtualsocketserver.h',
    381         'win32.cc',
    382         'win32.h',
    383         'win32filesystem.cc',
    384         'win32filesystem.h',
    385         'win32regkey.cc',
    386         'win32regkey.h',
    387         'win32securityerrors.cc',
    388         'win32socketinit.cc',
    389         'win32socketinit.h',
    390         'win32socketserver.cc',
    391         'win32socketserver.h',
    392         'win32window.cc',
    393         'win32window.h',
    394         'win32windowpicker.cc',
    395         'win32windowpicker.h',
    396         'window.h',
    397         'windowpicker.h',
    398         'windowpickerfactory.h',
    399         'winfirewall.cc',
    400         'winfirewall.h',
    401         'winping.cc',
    402         'winping.h',
    403         'worker.cc',
    404         'worker.h',
    405         'x11windowpicker.cc',
    406         'x11windowpicker.h',
    407       ],
    408       # TODO(henrike): issue 3307, make rtc_base build without disabling
    409       # these flags.
    410       'cflags!': [
    411         '-Wextra',
    412         '-Wall',
    413       ],
    414       'cflags_cc!': [
    415         '-Wnon-virtual-dtor',
    416       ],
    417       'direct_dependent_settings': {
    418         'cflags_cc!': [
    419           '-Wnon-virtual-dtor',
    420         ],
    421         'defines': [
    422           'FEATURE_ENABLE_SSL',
    423           'SSL_USE_OPENSSL',
    424           'HAVE_OPENSSL_SSL_H',
    425         ],
    426       },
    427       'include_dirs': [
    428         '../../third_party/jsoncpp/overrides/include',
    429         '../../third_party/jsoncpp/source/include',
    430       ],
    431       'conditions': [
    432         ['build_with_chromium==1', {
    433           'include_dirs': [
    434             '../../webrtc_overrides',
    435             '../../boringssl/src/include',
    436           ],
    437           'sources': [
    438             '../../webrtc_overrides/webrtc/base/win32socketinit.cc',
    439           ],
    440           'sources!': [
    441             'atomicops.h',
    442             'bandwidthsmoother.cc',
    443             'bandwidthsmoother.h',
    444             'bind.h',
    445             'callback.h',
    446             'dbus.cc',
    447             'dbus.h',
    448             'diskcache_win32.cc',
    449             'diskcache_win32.h',
    450             'fileutils_mock.h',
    451             'genericslot.h',
    452             'httpserver.cc',
    453             'httpserver.h',
    454             'json.cc',
    455             'json.h',
    456             'latebindingsymboltable.cc',
    457             'latebindingsymboltable.h',
    458             'libdbusglibsymboltable.cc',
    459             'libdbusglibsymboltable.h',
    460             'linuxfdwalk.c',
    461             'linuxfdwalk.h',
    462             'x11windowpicker.cc',
    463             'x11windowpicker.h',
    464             'logging.cc',
    465             'logging.h',
    466             'logsinks.cc',
    467             'logsinks.h',
    468             'macasyncsocket.cc',
    469             'macasyncsocket.h',
    470             'maccocoasocketserver.h',
    471             'maccocoasocketserver.mm',
    472             'macsocketserver.cc',
    473             'macsocketserver.h',
    474             'macwindowpicker.cc',
    475             'macwindowpicker.h',
    476             'mathutils.h',
    477             'multipart.cc',
    478             'multipart.h',
    479             'natserver.cc',
    480             'natserver.h',
    481             'natsocketfactory.cc',
    482             'natsocketfactory.h',
    483             'nattypes.cc',
    484             'nattypes.h',
    485             'optionsfile.cc',
    486             'optionsfile.h',
    487             'posix.cc',
    488             'posix.h',
    489             'profiler.cc',
    490             'profiler.h',
    491             'proxyserver.cc',
    492             'proxyserver.h',
    493             'refcount.h',
    494             'referencecountedsingletonfactory.h',
    495             'rollingaccumulator.h',
    496             'safe_conversions.h',
    497             'safe_conversions_impl.h',
    498             'scopedptrcollection.h',
    499             'scoped_ref_ptr.h',
    500             'sec_buffer.h',
    501             'sharedexclusivelock.cc',
    502             'sharedexclusivelock.h',
    503             'sslconfig.h',
    504             'sslroots.h',
    505             'testbase64.h',
    506             'testclient.cc',
    507             'testclient.h',
    508             'transformadapter.cc',
    509             'transformadapter.h',
    510             'versionparsing.cc',
    511             'versionparsing.h',
    512             'virtualsocketserver.cc',
    513             'virtualsocketserver.h',
    514             'win32regkey.cc',
    515             'win32regkey.h',
    516             'win32socketinit.cc',
    517             'win32socketinit.h',
    518             'win32socketserver.cc',
    519             'win32socketserver.h',
    520             'window.h',
    521             'windowpickerfactory.h',
    522             'windowpicker.h',
    523           ],
    524           'defines': [
    525             'NO_MAIN_THREAD_WRAPPING',
    526           ],
    527           'direct_dependent_settings': {
    528             'defines': [
    529               'NO_MAIN_THREAD_WRAPPING',
    530             ],
    531           },
    532         }, {
    533           'conditions': [
    534             ['build_json==1', {
    535               'dependencies': [
    536                 '<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp',
    537               ],
    538             }, {
    539               'include_dirs': [
    540                 '<(json_root)',
    541               ],
    542               'defines': [
    543                 # When defined changes the include path for json.h to where it
    544                 # is expected to be when building json outside of the standalone
    545                 # build.
    546                 'WEBRTC_EXTERNAL_JSON',
    547               ],
    548             }],
    549             ['OS=="win" and clang==1', {
    550               'msvs_settings': {
    551                 'VCCLCompilerTool': {
    552                   'AdditionalOptions': [
    553                     # Disable warnings failing when compiling with Clang on Windows.
    554                     # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366
    555                     '-Wno-missing-braces',
    556                   ],
    557                 },
    558               },
    559             }],
    560           ],
    561         }],
    562         ['OS == "android"', {
    563           'link_settings': {
    564             'libraries': [
    565               '-llog',
    566               '-lGLESv2',
    567             ],
    568           },
    569         }, {
    570           'sources!': [
    571             'ifaddrs-android.cc',
    572             'ifaddrs-android.h',
    573           ],
    574         }],
    575         ['OS=="ios"', {
    576           'sources/': [
    577             ['include', 'macconversion.*'],
    578           ],
    579           'all_dependent_settings': {
    580             'xcode_settings': {
    581               'OTHER_LDFLAGS': [
    582                 '-framework CFNetwork',
    583                 '-framework Foundation',
    584                 '-framework Security',
    585                 '-framework SystemConfiguration',
    586                 '-framework UIKit',
    587               ],
    588             },
    589           },
    590         }],
    591         ['use_x11 == 1', {
    592           'link_settings': {
    593             'libraries': [
    594               '-ldl',
    595               '-lrt',
    596               '-lXext',
    597               '-lX11',
    598               '-lXcomposite',
    599               '-lXrender',
    600             ],
    601           },
    602         }, {
    603           'sources!': [
    604             'x11windowpicker.cc',
    605             'x11windowpicker.h',
    606           ],
    607         }],
    608         ['OS=="linux"', {
    609           'link_settings': {
    610             'libraries': [
    611               '-ldl',
    612               '-lrt',
    613             ],
    614           },
    615         }, {
    616           'sources!': [
    617             'dbus.cc',
    618             'dbus.h',
    619             'libdbusglibsymboltable.cc',
    620             'libdbusglibsymboltable.h',
    621             'linuxfdwalk.c',
    622           ],
    623         }],
    624         ['OS=="mac"', {
    625           'all_dependent_settings': {
    626             'link_settings': {
    627               'xcode_settings': {
    628                 'OTHER_LDFLAGS': [
    629                   '-framework Cocoa',
    630                   '-framework Foundation',
    631                   '-framework IOKit',
    632                   '-framework Security',
    633                   '-framework SystemConfiguration',
    634                 ],
    635               },
    636             },
    637           },
    638           'conditions': [
    639             ['target_arch=="ia32"', {
    640               'all_dependent_settings': {
    641                 'link_settings': {
    642                   'xcode_settings': {
    643                     'OTHER_LDFLAGS': [
    644                       '-framework Carbon',
    645                     ],
    646                   },
    647                 },
    648               },
    649             }],
    650           ],
    651         }, {
    652           'sources!': [
    653             'macasyncsocket.cc',
    654             'macasyncsocket.h',
    655             'maccocoasocketserver.h',
    656             'maccocoasocketserver.mm',
    657             'macconversion.cc',
    658             'macconversion.h',
    659             'macsocketserver.cc',
    660             'macsocketserver.h',
    661             'macutils.cc',
    662             'macutils.h',
    663             'macwindowpicker.cc',
    664             'macwindowpicker.h',
    665           ],
    666         }],
    667         ['OS=="win"', {
    668           'sources!': [
    669             'ifaddrs_converter.cc',
    670           ],
    671           'link_settings': {
    672             'libraries': [
    673               '-lcrypt32.lib',
    674               '-liphlpapi.lib',
    675               '-lsecur32.lib',
    676             ],
    677           },
    678           # Suppress warnings about WIN32_LEAN_AND_MEAN.
    679           'msvs_disabled_warnings': [4005, 4703],
    680           'defines': [
    681             '_CRT_NONSTDC_NO_DEPRECATE',
    682           ],
    683         }, {
    684           'sources/': [
    685             ['exclude', 'win32[a-z0-9]*\\.(h|cc)$'],
    686           ],
    687           'sources!': [
    688               'winping.cc',
    689               'winping.h',
    690               'winfirewall.cc',
    691               'winfirewall.h',
    692             ],
    693         }],
    694         ['os_posix==0', {
    695           'sources!': [
    696             'latebindingsymboltable.cc',
    697             'latebindingsymboltable.h',
    698             'posix.cc',
    699             'posix.h',
    700             'unixfilesystem.cc',
    701             'unixfilesystem.h',
    702           ],
    703         }, {
    704           'configurations': {
    705             'Debug_Base': {
    706               'defines': [
    707                 # Chromium's build/common.gypi defines this for all posix
    708                 # _except_ for ios & mac.  We want it there as well, e.g.
    709                 # because ASSERT and friends trigger off of it.
    710                 '_DEBUG',
    711               ],
    712             },
    713           }
    714         }],
    715         ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', {
    716           'defines': [
    717             'CARBON_DEPRECATED=YES',
    718           ],
    719         }],
    720         ['OS!="ios" and OS!="mac"', {
    721           'sources!': [
    722             'macifaddrs_converter.cc',
    723             'scoped_autorelease_pool.mm',
    724           ],
    725         }],
    726         ['OS!="linux" and OS!="android"', {
    727           'sources!': [
    728             'linux.cc',
    729             'linux.h',
    730           ],
    731         }],
    732         ['build_ssl==1', {
    733           'dependencies': [
    734             '<(DEPTH)/third_party/boringssl/boringssl.gyp:boringssl',
    735           ],
    736         }, {
    737           'include_dirs': [
    738             '<(ssl_root)',
    739           ],
    740         }],
    741       ],
    742     },
    743   ],
    744 }
    745