Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / build / common.gypi
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_arch_variant%': 'mips32r1',
112     'mips_dsp_rev%': 0,
113     'mips_fpu%' : 1,
114     'enable_android_opensl%': 1,
115
116     # Link-Time Optimizations
117     # Executes code generation at link-time instead of compile-time
118     # https://gcc.gnu.org/wiki/LinkTimeOptimization
119     'use_lto%': 0,
120
121     # Defer ssl perference to that specified through sslconfig.h instead of
122     # choosing openssl or nss directly.  In practice, this can be used to
123     # enable schannel on windows.
124     'use_legacy_ssl_defaults%': 0,
125
126     'conditions': [
127       ['build_with_chromium==1', {
128         # Exclude pulse audio on Chromium since its prerequisites don't require
129         # pulse audio.
130         'include_pulse_audio%': 0,
131
132         # Exclude internal ADM since Chromium uses its own IO handling.
133         'include_internal_audio_device%': 0,
134
135       }, {  # Settings for the standalone (not-in-Chromium) build.
136         # TODO(andrew): For now, disable the Chrome plugins, which causes a
137         # flood of chromium-style warnings. Investigate enabling them:
138         # http://code.google.com/p/webrtc/issues/detail?id=163
139         'clang_use_chrome_plugins%': 0,
140
141         'include_pulse_audio%': 1,
142         'include_internal_audio_device%': 1,
143       }],
144       ['build_with_libjingle==1', {
145         'include_tests%': 0,
146         'restrict_webrtc_logging%': 1,
147       }, {
148         'include_tests%': 1,
149         'restrict_webrtc_logging%': 0,
150       }],
151       ['OS=="ios"', {
152         'build_libjpeg%': 0,
153         'enable_protobuf%': 0,
154       }],
155       ['target_arch=="arm" or target_arch=="armv7"', {
156         'prefer_fixed_point%': 1,
157       }],
158     ], # conditions
159   },
160   'target_defaults': {
161     'include_dirs': [
162       # To include the top-level directory when building in Chrome, so we can
163       # use full paths (e.g. headers inside testing/ or third_party/).
164       '<(DEPTH)',
165     ],
166     'conditions': [
167       ['restrict_webrtc_logging==1', {
168         'defines': ['WEBRTC_RESTRICT_LOGGING',],
169       }],
170       ['build_with_mozilla==1', {
171         'defines': [
172           # Changes settings for Mozilla build.
173           'WEBRTC_MOZILLA_BUILD',
174          ],
175       }],
176       ['have_dbus_glib==1', {
177         'defines': [
178           'HAVE_DBUS_GLIB',
179          ],
180          'cflags': [
181            '<!@(pkg-config --cflags dbus-glib-1)',
182          ],
183       }],
184       ['rtc_relative_path==1', {
185         'defines': ['EXPAT_RELATIVE_PATH',],
186       }],
187       ['enable_video==1', {
188         'defines': ['WEBRTC_MODULE_UTILITY_VIDEO',],
189       }],
190       ['build_with_chromium==1', {
191         'defines': [
192           # Changes settings for Chromium build.
193           'WEBRTC_CHROMIUM_BUILD',
194           'LOGGING_INSIDE_WEBRTC',
195         ],
196         'include_dirs': [
197           # overrides must be included first as that is the mechanism for
198           # selecting the override headers in Chromium.
199           '../overrides',
200           # Allow includes to be prefixed with webrtc/ in case it is not an
201           # immediate subdirectory of <(DEPTH).
202           '../..',
203         ],
204       }, {
205         'conditions': [
206           ['os_posix==1', {
207             'conditions': [
208               # -Wextra is currently disabled in Chromium's common.gypi. Enable
209               # for targets that can handle it. For Android/arm64 right now
210               # there will be an 'enumeral and non-enumeral type in conditional
211               # expression' warning in android_tools/ndk_experimental's version
212               # of stlport.
213               # See: https://code.google.com/p/chromium/issues/detail?id=379699
214               ['target_arch!="arm64" or OS!="android"', {
215                 'cflags': [
216                   '-Wextra',
217                   # We need to repeat some flags from Chromium's common.gypi
218                   # here that get overridden by -Wextra.
219                   '-Wno-unused-parameter',
220                   '-Wno-missing-field-initializers',
221                   '-Wno-strict-overflow',
222                 ],
223               }],
224             ],
225             'cflags_cc': [
226               '-Wnon-virtual-dtor',
227               # This is enabled for clang; enable for gcc as well.
228               '-Woverloaded-virtual',
229             ],
230           }],
231           ['clang==1', {
232             'cflags': [
233               '-Wthread-safety',
234             ],
235           }],
236         ],
237       }],
238       ['target_arch=="arm" or target_arch=="armv7"', {
239         'defines': [
240           'WEBRTC_ARCH_ARM',
241         ],
242         'conditions': [
243           ['arm_version==7', {
244             'defines': ['WEBRTC_ARCH_ARM_V7',],
245             'conditions': [
246               ['arm_neon==1', {
247                 'defines': ['WEBRTC_ARCH_ARM_NEON',],
248               }, {
249                 'defines': ['WEBRTC_DETECT_ARM_NEON',],
250               }],
251             ],
252           }],
253         ],
254       }],
255       ['target_arch=="mipsel"', {
256         'defines': [
257           'MIPS32_LE',
258         ],
259         'conditions': [
260           ['mips_fpu==1', {
261             'defines': [
262               'MIPS_FPU_LE',
263             ],
264             'cflags': [
265               '-mhard-float',
266             ],
267           }, {
268             'cflags': [
269               '-msoft-float',
270             ],
271           }],
272           ['mips_arch_variant=="mips32r2"', {
273             'defines': [
274               'MIPS32_R2_LE',
275             ],
276             'cflags': [
277               '-mips32r2',
278             ],
279             'cflags_cc': [
280               '-mips32r2',
281             ],
282           }],
283           ['mips_dsp_rev==1', {
284             'defines': [
285               'MIPS_DSP_R1_LE',
286             ],
287             'cflags': [
288               '-mdsp',
289             ],
290             'cflags_cc': [
291               '-mdsp',
292             ],
293           }],
294           ['mips_dsp_rev==2', {
295             'defines': [
296               'MIPS_DSP_R1_LE',
297               'MIPS_DSP_R2_LE',
298             ],
299             'cflags': [
300               '-mdspr2',
301             ],
302             'cflags_cc': [
303               '-mdspr2',
304             ],
305           }],
306         ],
307       }],
308       ['coverage==1 and OS=="linux"', {
309         'cflags': [ '-ftest-coverage',
310                     '-fprofile-arcs' ],
311         'link_settings': { 'libraries': [ '-lgcov' ] },
312       }],
313       ['os_posix==1', {
314         # For access to standard POSIXish features, use WEBRTC_POSIX instead of
315         # a more specific macro.
316         'defines': [
317           'WEBRTC_POSIX',
318         ],
319       }],
320       ['OS=="ios"', {
321         'defines': [
322           'WEBRTC_MAC',
323           'WEBRTC_IOS',
324         ],
325       }],
326       ['OS=="linux"', {
327         'defines': [
328           'WEBRTC_LINUX',
329         ],
330       }],
331       ['OS=="mac"', {
332         'defines': [
333           'WEBRTC_MAC',
334         ],
335       }],
336       ['OS=="win"', {
337         'defines': [
338           'WEBRTC_WIN',
339         ],
340         # TODO(andrew): enable all warnings when possible.
341         # TODO(phoglund): get rid of 4373 supression when
342         # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
343         'msvs_disabled_warnings': [
344           4373,  # legacy warning for ignoring const / volatile in signatures.
345           4389,  # Signed/unsigned mismatch.
346         ],
347         # Re-enable some warnings that Chromium disables.
348         'msvs_disabled_warnings!': [4189,],
349       }],
350       ['OS=="android"', {
351         'defines': [
352           'WEBRTC_LINUX',
353           'WEBRTC_ANDROID',
354          ],
355          'conditions': [
356            ['enable_android_opensl==1', {
357              'defines': [
358                'WEBRTC_ANDROID_OPENSLES',
359              ],
360            }],
361            ['clang!=1', {
362              # The Android NDK doesn't provide optimized versions of these
363              # functions. Ensure they are disabled for all compilers.
364              'cflags': [
365                '-fno-builtin-cos',
366                '-fno-builtin-sin',
367                '-fno-builtin-cosf',
368                '-fno-builtin-sinf',
369              ],
370            }],
371          ],
372       }],
373     ], # conditions
374     'direct_dependent_settings': {
375       'conditions': [
376         ['build_with_mozilla==1', {
377           'defines': [
378             # Changes settings for Mozilla build.
379             'WEBRTC_MOZILLA_BUILD',
380            ],
381         }],
382         ['build_with_chromium==1', {
383           'defines': [
384             # Changes settings for Chromium build.
385             'WEBRTC_CHROMIUM_BUILD',
386           ],
387           'include_dirs': [
388             # overrides must be included first as that is the mechanism for
389             # selecting the override headers in Chromium.
390             '../overrides',
391             '../..',
392           ],
393         }, {
394           'include_dirs': [
395             '../..',
396           ],
397         }],
398         ['OS=="mac"', {
399           'defines': [
400             'WEBRTC_MAC',
401           ],
402         }],
403         ['OS=="ios"', {
404           'defines': [
405             'WEBRTC_MAC',
406             'WEBRTC_IOS',
407           ],
408         }],
409         ['OS=="win"', {
410           'defines': [
411             'WEBRTC_WIN',
412           ],
413         }],
414         ['OS=="linux"', {
415           'defines': [
416             'WEBRTC_LINUX',
417           ],
418         }],
419         ['OS=="android"', {
420           'defines': [
421             'WEBRTC_LINUX',
422             'WEBRTC_ANDROID',
423            ],
424            'conditions': [
425              ['enable_android_opensl==1', {
426                'defines': [
427                  'WEBRTC_ANDROID_OPENSLES',
428                ],
429              }]
430            ],
431         }],
432         ['os_posix==1', {
433           # For access to standard POSIXish features, use WEBRTC_POSIX instead
434           # of a more specific macro.
435           'defines': [
436             'WEBRTC_POSIX',
437           ],
438         }],
439       ],
440     },
441   }, # target_defaults
442 }
443