blob: d38c27ceddd33ca0077697c01e62cb2b0164e9a5 [file] [log] [blame]
andrew@webrtc.org14b43be2012-10-22 18:19:23 +00001# 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 be set to zero in the supplement.gypi triggered by a
18 # gclient hook in the standalone build.
19 'build_with_chromium%': 1,
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000020 'build_with_libjingle%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000021 },
22 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000023 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000024
25 'conditions': [
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000026 ['build_with_chromium==1 or build_with_libjingle==1', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000027 'webrtc_root%': '<(DEPTH)/third_party/webrtc',
28 }, {
29 'webrtc_root%': '<(DEPTH)/webrtc',
30 }],
31 ],
32 },
33 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000034 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000035 'webrtc_root%': '<(webrtc_root)',
36
37 'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
leozwang@webrtc.org6f19b1b2012-10-27 17:46:55 +000038 'include_opus%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000039 },
40 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000041 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000042 'webrtc_root%': '<(webrtc_root)',
43 'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
44 'include_opus%': '<(include_opus)',
45
46 # The Chromium common.gypi we use treats all gyp files without
47 # chromium_code==1 as third party code. This disables many of the
48 # preferred warning settings.
49 #
50 # We can set this here to have WebRTC code treated as Chromium code. Our
51 # third party code will still have the reduced warning settings.
52 'chromium_code': 1,
53
54 # Adds video support to dependencies shared by voice and video engine.
55 # This should normally be enabled; the intended use is to disable only
56 # when building voice engine exclusively.
57 'enable_video%': 1,
58
59 # Selects fixed-point code where possible.
60 'prefer_fixed_point%': 0,
61
62 # Enable data logging. Produces text files with data logged within engines
63 # which can be easily parsed for offline processing.
64 'enable_data_logging%': 0,
65
andrew@webrtc.orgf9825e52013-05-20 21:18:04 +000066 # Enables the use of protocol buffers for debug recordings.
67 'enable_protobuf%': 1,
68
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000069 # Disable these to not build components which can be externally provided.
70 'build_libjpeg%': 1,
71 'build_libyuv%': 1,
72 'build_libvpx%': 1,
73
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +000074 # Enable to use the Mozilla internal settings.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000075 'build_with_mozilla%': 0,
76
77 'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
78
andrew@webrtc.org5140e242013-02-21 20:12:21 +000079 # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
80 # This may be subject to change in accordance to Chromium's MIPS flags
81 'mips_arch_variant%': 'mips32r1',
82 'mips_dsp_rev%': 0,
83 'mips_fpu%' : 1,
84
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000085 'conditions': [
86 ['build_with_chromium==1', {
87 # Exclude pulse audio on Chromium since its prerequisites don't require
88 # pulse audio.
89 'include_pulse_audio%': 0,
90
91 # Exclude internal ADM since Chromium uses its own IO handling.
92 'include_internal_audio_device%': 0,
93
94 # Exclude internal VCM in Chromium build.
95 'include_internal_video_capture%': 0,
96
97 # Exclude internal video render module in Chromium build.
98 'include_internal_video_render%': 0,
99
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000100 'include_tests%': 0,
101
andrew@webrtc.org50419b02012-11-14 19:07:54 +0000102 'enable_tracing%': 0,
103
wjia@webrtc.org5c38d902012-11-19 01:41:59 +0000104 'enable_android_opensl%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000105 }, { # Settings for the standalone (not-in-Chromium) build.
106 'include_pulse_audio%': 1,
107 'include_internal_audio_device%': 1,
108 'include_internal_video_capture%': 1,
109 'include_internal_video_render%': 1,
andrew@webrtc.org50419b02012-11-14 19:07:54 +0000110 'enable_tracing%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000111 'include_tests%': 1,
112
113 # TODO(andrew): For now, disable the Chrome plugins, which causes a
114 # flood of chromium-style warnings. Investigate enabling them:
115 # http://code.google.com/p/webrtc/issues/detail?id=163
116 'clang_use_chrome_plugins%': 0,
117
118 # Switch between Android audio device OpenSL ES implementation
119 # and Java Implementation
leozwang@webrtc.org56a1c2c2012-11-29 03:13:00 +0000120 'enable_android_opensl%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000121 }],
122 ['OS=="ios"', {
123 'enable_video%': 0,
124 'enable_protobuf%': 0,
125 'build_libjpeg%': 0,
126 'build_libyuv%': 0,
127 'build_libvpx%': 0,
128 'include_tests%': 0,
129 }],
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +0000130 ['build_with_libjingle==1', {
131 'include_tests%': 0,
132 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000133 ['target_arch=="arm"', {
134 'prefer_fixed_point%': 1,
135 }],
136 ], # conditions
137 },
138 'target_defaults': {
139 'include_dirs': [
andrew@webrtc.orgbe8ec382012-10-22 21:51:58 +0000140 # TODO(andrew): Remove '..' when we've added webrtc/ to include paths.
141 '..',
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000142 # Allow includes to be prefixed with webrtc/ in case it is not an
143 # immediate subdirectory of <(DEPTH).
andrew@webrtc.orgbe8ec382012-10-22 21:51:58 +0000144 '../..',
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000145 # To include the top-level directory when building in Chrome, so we can
146 # use full paths (e.g. headers inside testing/ or third_party/).
147 '<(DEPTH)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000148 ],
149 'defines': [
150 # TODO(leozwang): Run this as a gclient hook rather than at build-time:
151 # http://code.google.com/p/webrtc/issues/detail?id=687
152 'WEBRTC_SVNREVISION="Unavailable(issue687)"',
153 #'WEBRTC_SVNREVISION="<!(python <(webrtc_root)/build/version.py)"',
154 ],
155 'conditions': [
andrew@webrtc.orgc3e5d342012-11-23 19:30:59 +0000156 ['enable_tracing==1', {
157 'defines': ['WEBRTC_LOGGING',],
158 }],
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +0000159 ['build_with_mozilla==1', {
160 'defines': [
161 # Changes settings for Mozilla build.
162 'WEBRTC_MOZILLA_BUILD',
163 ],
164 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000165 ['build_with_chromium==1', {
166 'defines': [
167 # Changes settings for Chromium build.
168 'WEBRTC_CHROMIUM_BUILD',
169 ],
170 }, {
171 'conditions': [
172 ['os_posix==1', {
173 'cflags': [
174 '-Wextra',
175 # We need to repeat some flags from Chromium's common.gypi here
176 # that get overridden by -Wextra.
177 '-Wno-unused-parameter',
178 '-Wno-missing-field-initializers',
179 ],
180 'cflags_cc': [
181 # This is enabled for clang; enable for gcc as well.
182 '-Woverloaded-virtual',
183 ],
184 }],
185 ],
186 }],
187 ['target_arch=="arm"', {
188 'defines': [
189 'WEBRTC_ARCH_ARM',
190 ],
191 'conditions': [
192 ['armv7==1', {
193 'defines': ['WEBRTC_ARCH_ARM_V7',],
194 'conditions': [
195 ['arm_neon==1', {
196 'defines': ['WEBRTC_ARCH_ARM_NEON',],
197 }, {
198 'defines': ['WEBRTC_DETECT_ARM_NEON',],
199 }],
200 ],
201 }],
202 ],
203 }],
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000204 ['target_arch=="mipsel"', {
205 'defines': [
206 'MIPS32_LE',
207 ],
208 'conditions': [
209 ['mips_fpu==1', {
210 'defines': [
211 'MIPS_FPU_LE',
212 ],
213 'cflags': [
214 '-mhard-float',
215 ],
216 }, {
217 'cflags': [
218 '-msoft-float',
219 ],
220 }],
221 ['mips_arch_variant=="mips32r2"', {
222 'defines': [
223 'MIPS32_R2_LE',
224 ],
225 'cflags': [
226 '-mips32r2',
227 ],
228 'cflags_cc': [
229 '-mips32r2',
230 ],
231 }],
232 ['mips_dsp_rev==1', {
233 'defines': [
234 'MIPS_DSP_R1_LE',
235 ],
236 'cflags': [
237 '-mdsp',
238 ],
239 'cflags_cc': [
240 '-mdsp',
241 ],
242 }],
243 ['mips_dsp_rev==2', {
244 'defines': [
245 'MIPS_DSP_R1_LE',
246 'MIPS_DSP_R2_LE',
247 ],
248 'cflags': [
249 '-mdspr2',
250 ],
251 'cflags_cc': [
252 '-mdspr2',
253 ],
254 }],
255 ],
256 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000257 ['OS=="ios"', {
258 'defines': [
259 'WEBRTC_MAC',
260 'WEBRTC_IOS',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000261 ],
262 }],
263 ['OS=="linux"', {
264 'defines': [
265 'WEBRTC_LINUX',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000266 ],
267 }],
268 ['OS=="mac"', {
269 'defines': [
270 'WEBRTC_MAC',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000271 ],
272 }],
273 ['OS=="win"', {
274 'defines': [
275 'WEBRTC_WIN',
276 ],
277 # TODO(andrew): enable all warnings when possible.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000278 # TODO(phoglund): get rid of 4373 supression when
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000279 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000280 'msvs_disabled_warnings': [
281 4373, # legacy warning for ignoring const / volatile in signatures.
282 4389, # Signed/unsigned mismatch.
283 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000284 # Re-enable some warnings that Chromium disables.
285 'msvs_disabled_warnings!': [4189,],
286 }],
287 ['OS=="android"', {
288 'defines': [
289 'WEBRTC_LINUX',
290 'WEBRTC_ANDROID',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000291 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000292 'conditions': [
293 ['enable_android_opensl==1', {
294 'defines': [
295 'WEBRTC_ANDROID_OPENSLES',
296 ],
297 }],
wjia@webrtc.orgb1193692013-01-12 01:52:07 +0000298 ['clang!=1', {
299 # The Android NDK doesn't provide optimized versions of these
300 # functions. Ensure they are disabled for all compilers.
301 'cflags': [
302 '-fno-builtin-cos',
303 '-fno-builtin-sin',
304 '-fno-builtin-cosf',
305 '-fno-builtin-sinf',
306 ],
307 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000308 ],
309 }],
310 ], # conditions
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000311 'direct_dependent_settings': {
312 'include_dirs': [
313 '../..',
314 ],
315 'conditions': [
316 ['build_with_mozilla==1', {
317 'defines': [
318 # Changes settings for Mozilla build.
319 'WEBRTC_MOZILLA_BUILD',
320 ],
321 }],
322 ['build_with_chromium==1', {
323 'defines': [
324 # Changes settings for Chromium build.
325 'WEBRTC_CHROMIUM_BUILD',
326 ],
327 }],
328 ['OS=="mac"', {
329 'defines': [
330 'WEBRTC_MAC',
331 ],
332 }],
333 ['OS=="ios"', {
334 'defines': [
335 'WEBRTC_MAC',
336 'WEBRTC_IOS',
337 ],
338 }],
339 ['OS=="win"', {
340 'defines': [
341 'WEBRTC_WIN',
342 ],
343 }],
344 ['OS=="linux"', {
345 'defines': [
346 'WEBRTC_LINUX',
347 ],
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 ],
361 }],
362 ],
363 },
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000364 }, # target_defaults
365}
366