1#
2# libjingle
3# Copyright 2012 Google Inc.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are met:
7#
8#  1. Redistributions of source code must retain the above copyright notice,
9#     this list of conditions and the following disclaimer.
10#  2. Redistributions in binary form must reproduce the above copyright notice,
11#     this list of conditions and the following disclaimer in the documentation
12#     and/or other materials provided with the distribution.
13#  3. The name of the author may not be used to endorse or promote products
14#     derived from this software without specific prior written permission.
15#
16# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26#
27
28# This file contains common settings for building libjingle components.
29
30{
31  'variables': {
32    'webrtc_root%': '<(DEPTH)/webrtc',
33    'libjingle_tests_additional_deps%': [],
34    # TODO(ronghuawu): For now, disable the Chrome plugins, which causes a
35    # flood of chromium-style warnings.
36    'clang_use_chrome_plugins%': 0,
37    'conditions': [
38      ['OS=="android" or OS=="linux"', {
39        'java_home%': '<!(python -c "import os; dir=os.getenv(\'JAVA_HOME\', \'/usr/lib/jvm/java-7-openjdk-amd64\'); assert os.path.exists(os.path.join(dir, \'include/jni.h\')), \'Point \\$JAVA_HOME or the java_home gyp variable to a directory containing include/jni.h!\'; print dir")',
40      }],
41    ],
42    # Disable these to not build components which can be externally provided.
43    'build_expat%': 1,
44    'build_json%': 1,
45    'build_libsrtp%': 1,
46    'build_libyuv%': 1,
47    'build_usrsctp%': 1,
48    # Make it possible to provide custom locations for some libraries.
49    'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
50
51    # Disable this to skip building source requiring GTK.
52    'use_gtk%': 1,
53  },
54  'target_defaults': {
55    'include_dirs': [
56      '<(DEPTH)',
57      '../..',
58      '../../third_party',
59      '../../third_party/webrtc',
60      '../../webrtc',
61    ],
62    'defines': [
63      'SRTP_RELATIVE_PATH',
64
65      # Feature selection
66      'HAVE_SCTP',
67      'HAVE_SRTP',
68      'HAVE_WEBRTC_VIDEO',
69      'HAVE_WEBRTC_VOICE',
70    ],
71    'conditions': [
72      ['OS=="linux"', {
73        'defines': [
74          'WEBRTC_LINUX',
75        ],
76        # Remove Chromium's disabling of the -Wformat warning.
77        'cflags!': [
78          '-Wno-format',
79        ],
80        'conditions': [
81          ['clang==1', {
82            'cflags': [
83              '-Wall',
84              '-Wextra',
85              '-Wformat',
86              '-Wformat-security',
87              '-Wimplicit-fallthrough',
88              '-Wmissing-braces',
89              '-Wreorder',
90              '-Wunused-variable',
91              # TODO(ronghuawu): Fix the warning caused by
92              # LateBindingSymbolTable::TableInfo from
93              # latebindingsymboltable.cc.def and remove below flag.
94              '-Wno-address-of-array-temporary',
95              '-Wthread-safety',
96            ],
97            'cflags_cc': [
98              '-Wunused-private-field',
99            ],
100          }],
101        ],
102      }],
103      ['OS=="mac"', {
104        'defines': [
105          'WEBRTC_MAC',
106        ],
107      }],
108      ['OS=="win"', {
109        'defines': [
110          'WEBRTC_WIN',
111        ],
112        'msvs_disabled_warnings': [
113          # https://code.google.com/p/chromium/issues/detail?id=372451#c20
114          # Warning 4702 ("Unreachable code") should be re-enabled once
115          # users are updated to VS2013 Update 2.
116            4702,
117        ],
118      }],
119      ['OS=="ios"', {
120        'defines': [
121          'WEBRTC_MAC',
122          'WEBRTC_IOS',
123        ],
124      }],
125      ['OS=="ios" or (OS=="mac" and target_arch!="ia32")', {
126        'defines': [
127          'CARBON_DEPRECATED=YES',
128        ],
129      }],
130      ['os_posix==1', {
131        'configurations': {
132          'Debug_Base': {
133            'defines': [
134              # Chromium's build/common.gypi defines this for all posix _except_
135              # for ios & mac.  We want it there as well, e.g. because ASSERT
136              # and friends trigger off of it.
137              '_DEBUG',
138            ],
139          },
140        },
141        'defines': [
142          'HASH_NAMESPACE=__gnu_cxx',
143          'WEBRTC_POSIX',
144          'DISABLE_DYNAMIC_CAST',
145          # The POSIX standard says we have to define this.
146          '_REENTRANT',
147        ],
148      }],
149    ],
150  }, # target_defaults
151}
152