Bug 912450: remove WEBRTC_EXPORT to avoid exporting webrtc symbols from xul.dll r=ted
[gecko.git] / media / webrtc / trunk / webrtc / build / common.gypi
blob5b8a0761926dca067b3208d6e3b8660eea9991c2
1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
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.
9 # This file contains common settings for building WebRTC components.
12   # Nesting is required in order to use variables for setting other variables.
13   'variables': {
14     'variables': {
15       'variables': {
16         'variables': {
17           # This will be set to zero in the supplement.gypi triggered by a
18           # gclient hook in the standalone build.
19           'build_with_chromium%': 1,
20           'build_with_libjingle%': 0,
21         },
22         'build_with_chromium%': '<(build_with_chromium)',
23         'build_with_libjingle%': '<(build_with_libjingle)',
25         'conditions': [
26           ['build_with_chromium==1 or build_with_libjingle==1', {
27             'webrtc_root%': '<(DEPTH)/third_party/webrtc',
28           }, {
29             'webrtc_root%': '<(DEPTH)/webrtc',
30           }],
31         ],
32       },
33       'build_with_chromium%': '<(build_with_chromium)',
34       'build_with_libjingle%': '<(build_with_libjingle)',
35       'webrtc_root%': '<(webrtc_root)',
37       'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
38       'include_g711%': 1,
39       'include_g722%': 1,
40       'include_ilbc%': 1,
41       'include_opus%': 1,
42       'include_isac%': 1,
43       'include_pcm16b%': 1,
44     },
45     'build_with_chromium%': '<(build_with_chromium)',
46     'build_with_libjingle%': '<(build_with_libjingle)',
47     'webrtc_root%': '<(webrtc_root)',
48     'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
50     'include_g711%': '<(include_g711)',
51     'include_g722%': '<(include_g722)',
52     'include_ilbc%': '<(include_ilbc)',
53     'include_opus%': '<(include_opus)',
54     'include_isac%': '<(include_isac)',
55     'include_pcm16b%': '<(include_pcm16b)',
57     # The Chromium common.gypi we use treats all gyp files without
58     # chromium_code==1 as third party code. This disables many of the
59     # preferred warning settings.
60     #
61     # We can set this here to have WebRTC code treated as Chromium code. Our
62     # third party code will still have the reduced warning settings.
63     'chromium_code': 1,
65     # Adds video support to dependencies shared by voice and video engine.
66     # This should normally be enabled; the intended use is to disable only
67     # when building voice engine exclusively.
68     'enable_video%': 1,
70     # Selects fixed-point code where possible.
71     'prefer_fixed_point%': 0,
73     # Enable data logging. Produces text files with data logged within engines
74     # which can be easily parsed for offline processing.
75     'enable_data_logging%': 0,
77     # Enables the use of protocol buffers for debug recordings.
78     'enable_protobuf%': 1,
80     # Disable these to not build components which can be externally provided.
81     'build_libjpeg%': 1,
82     'build_libyuv%': 1,
83     'build_libvpx%': 1,
85     # Enable to use the Mozilla internal settings.
86     'build_with_mozilla%': 0,
88     'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
90     # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
91     # This may be subject to change in accordance to Chromium's MIPS flags
92     'mips_arch_variant%': 'mips32r1',
93     'mips_dsp_rev%': 0,
94     'mips_fpu%' : 1,
96     'conditions': [
97       ['build_with_chromium==1', {
98         # Exclude pulse audio on Chromium since its prerequisites don't require
99         # pulse audio.
100         'include_pulse_audio%': 0,
102         # Exclude internal ADM since Chromium uses its own IO handling.
103         'include_internal_audio_device%': 0,
105         # Exclude internal VCM in Chromium build.
106         'include_internal_video_capture%': 0,
108         # Exclude internal video render module in Chromium build.
109         'include_internal_video_render%': 0,
111         'include_tests%': 0,
113         'enable_tracing%': 0,
115         'enable_android_opensl%': 0,
116       }, {  # Settings for the standalone (not-in-Chromium) build.
117         'include_pulse_audio%': 1,
118         'include_internal_audio_device%': 1,
119         'include_internal_video_capture%': 1,
120         'include_internal_video_render%': 1,
121         'enable_tracing%': 1,
122         'include_tests%': 1,
124         # TODO(andrew): For now, disable the Chrome plugins, which causes a
125         # flood of chromium-style warnings. Investigate enabling them:
126         # http://code.google.com/p/webrtc/issues/detail?id=163
127         'clang_use_chrome_plugins%': 0,
129         # Switch between Android audio device OpenSL ES implementation
130         # and Java Implementation
131         'enable_android_opensl%': 0,
132       }],
133       ['OS=="linux"', {
134         'include_alsa_audio%': 1,
135       }, {
136         'include_alsa_audio%': 0,
137       }],
138       ['OS=="solaris" or os_bsd==1', {
139         'include_pulse_audio%': 1,
140       }, {
141         'include_pulse_audio%': 0,
142       }],
143       ['OS=="linux" or OS=="solaris" or os_bsd==1', {
144         'include_v4l2_video_capture%': 1,
145       }, {
146         'include_v4l2_video_capture%': 0,
147       }],
148       ['OS=="ios"', {
149         'enable_video%': 0,
150         'enable_protobuf%': 0,
151         'build_libjpeg%': 0,
152         'build_libyuv%': 0,
153         'build_libvpx%': 0,
154         'include_tests%': 0,
155       }],
156       ['build_with_libjingle==1', {
157         'include_tests%': 0,
158       }],
159       ['target_arch=="arm"', {
160         'prefer_fixed_point%': 1,
161       }],
162     ], # conditions
163   },
164   'target_defaults': {
165     'include_dirs': [
166       # TODO(andrew): Remove '..' when we've added webrtc/ to include paths.
167       '..',
168       # Allow includes to be prefixed with webrtc/ in case it is not an
169       # immediate subdirectory of <(DEPTH).
170       '../..',
171       # To include the top-level directory when building in Chrome, so we can
172       # use full paths (e.g. headers inside testing/ or third_party/).
173       '<(DEPTH)',
174     ],
175     'defines': [
176       # TODO(leozwang): Run this as a gclient hook rather than at build-time:
177       # http://code.google.com/p/webrtc/issues/detail?id=687
178       'WEBRTC_SVNREVISION="\\\"Unavailable_issue687\\\""',
179       #'WEBRTC_SVNREVISION="<!(python <(webrtc_root)/build/version.py)"',
180     ],
181     'conditions': [
182       ['moz_widget_toolkit_gonk==1', {
183         'defines' : [
184           'WEBRTC_GONK',
185         ],
186       }],
187       ['enable_tracing==1', {
188         'defines': ['WEBRTC_LOGGING',],
189       }],
190       ['build_with_mozilla==1', {
191         'defines': [
192           # Changes settings for Mozilla build.
193           'WEBRTC_MOZILLA_BUILD',
194          ],
195       }],
196       ['build_with_chromium==1', {
197         'defines': [
198           # Changes settings for Chromium build.
199           'WEBRTC_CHROMIUM_BUILD',
200         ],
201       }, {
202         'conditions': [
203           ['os_posix==1', {
204             'cflags': [
205               '-Wextra',
206               # We need to repeat some flags from Chromium's common.gypi here
207               # that get overridden by -Wextra.
208               '-Wno-unused-parameter',
209               '-Wno-missing-field-initializers',
210             ],
211             'cflags_cc': [
212               # This is enabled for clang; enable for gcc as well.
213               '-Woverloaded-virtual',
214             ],
215           }],
216         ],
217       }],
218       ['target_arch=="arm"', {
219         'defines': [
220           'WEBRTC_ARCH_ARM',
221         ],
222         'conditions': [
223           ['armv7==1', {
224             'defines': ['WEBRTC_ARCH_ARM_V7',
225                         'WEBRTC_BUILD_NEON_LIBS'],
226             'conditions': [
227               ['arm_neon==1', {
228                 'defines': ['WEBRTC_ARCH_ARM_NEON',],
229               }, {
230                 'defines': ['WEBRTC_DETECT_ARM_NEON',],
231               }],
232             ],
233           }],
234         ],
235       }],
236       ['os_bsd==1', {
237         'defines': [
238           'WEBRTC_BSD',
239           'WEBRTC_THREAD_RR',
240         ],
241       }],
242       ['OS=="dragonfly" or OS=="netbsd"', {
243         'defines': [
244           # doesn't support pthread_condattr_setclock
245           'WEBRTC_CLOCK_TYPE_REALTIME',
246         ],
247       }],
248       # Mozilla: if we support Mozilla on MIPS, we'll need to mod the cflags entries here
249       ['target_arch=="mipsel"', {
250         'defines': [
251           'MIPS32_LE',
252         ],
253         'conditions': [
254           ['mips_fpu==1', {
255             'defines': [
256               'MIPS_FPU_LE',
257             ],
258             'cflags': [
259               '-mhard-float',
260             ],
261           }, {
262             'cflags': [
263               '-msoft-float',
264             ],
265           }],
266           ['mips_arch_variant=="mips32r2"', {
267             'defines': [
268               'MIPS32_R2_LE',
269             ],
270             'cflags': [
271               '-mips32r2',
272             ],
273             'cflags_cc': [
274               '-mips32r2',
275             ],
276           }],
277           ['mips_dsp_rev==1', {
278             'defines': [
279               'MIPS_DSP_R1_LE',
280             ],
281             'cflags': [
282               '-mdsp',
283             ],
284             'cflags_cc': [
285               '-mdsp',
286             ],
287           }],
288           ['mips_dsp_rev==2', {
289             'defines': [
290               'MIPS_DSP_R1_LE',
291               'MIPS_DSP_R2_LE',
292             ],
293             'cflags': [
294               '-mdspr2',
295             ],
296             'cflags_cc': [
297               '-mdspr2',
298             ],
299           }],
300         ],
301       }],
302       ['OS=="ios"', {
303         'defines': [
304           'WEBRTC_MAC',
305           'WEBRTC_IOS',
306         ],
307       }],
308       ['OS=="linux"', {
309 #        'conditions': [
310 #          ['have_clock_monotonic==1', {
311 #            'defines': [
312 #              'WEBRTC_CLOCK_TYPE_REALTIME',
313 #            ],
314 #          }],
315 #        ],
316         'defines': [
317           'WEBRTC_LINUX',
318         ],
319       }],
320       ['OS=="mac"', {
321         'defines': [
322           'WEBRTC_MAC',
323         ],
324       }],
325       ['OS=="win"', {
326         'defines': [
327           'WEBRTC_WIN',
328         ],
329         # TODO(andrew): enable all warnings when possible.
330         # TODO(phoglund): get rid of 4373 supression when
331         # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
332         'msvs_disabled_warnings': [
333           4373,  # legacy warning for ignoring const / volatile in signatures.
334           4389,  # Signed/unsigned mismatch.
335         ],
336         # Re-enable some warnings that Chromium disables.
337         'msvs_disabled_warnings!': [4189,],
338       }],
339       ['OS=="android"', {
340         'defines': [
341           'WEBRTC_LINUX',
342           'WEBRTC_ANDROID',
343          ],
344          'conditions': [
345            ['enable_android_opensl==1', {
346              'defines': [
347                'WEBRTC_ANDROID_OPENSLES',
348              ],
349            }],
350            ['clang!=1', {
351              # The Android NDK doesn't provide optimized versions of these
352              # functions. Ensure they are disabled for all compilers.
353              'cflags': [
354                '-fno-builtin-cos',
355                '-fno-builtin-sin',
356                '-fno-builtin-cosf',
357                '-fno-builtin-sinf',
358              ],
359            }],
360          ],
361       }],
362     ], # conditions
363     'direct_dependent_settings': {
364       'include_dirs': [
365         '../..',
366       ],
367       'conditions': [
368         ['build_with_mozilla==1', {
369           'defines': [
370             # Changes settings for Mozilla build.
371             'WEBRTC_MOZILLA_BUILD',
372            ],
373         }],
374         ['build_with_chromium==1', {
375           'defines': [
376             # Changes settings for Chromium build.
377             'WEBRTC_CHROMIUM_BUILD',
378           ],
379         }],
380         ['OS=="mac"', {
381           'defines': [
382             'WEBRTC_MAC',
383           ],
384         }],
385         ['OS=="ios"', {
386           'defines': [
387             'WEBRTC_MAC',
388             'WEBRTC_IOS',
389           ],
390         }],
391         ['OS=="win"', {
392           'defines': [
393             'WEBRTC_WIN',
394           ],
395         }],
396         ['OS=="linux"', {
397           'defines': [
398             'WEBRTC_LINUX',
399           ],
400         }],
401         ['OS=="android"', {
402           'defines': [
403             'WEBRTC_LINUX',
404             'WEBRTC_ANDROID',
405            ],
406            'conditions': [
407              ['enable_android_opensl==1', {
408                'defines': [
409                  'WEBRTC_ANDROID_OPENSLES',
410                ],
411              }]
412            ],
413         }],
414       ],
415     },
416   }, # target_defaults