blob: e4a4b09bc471fbba99bbea2e46270f3fc55980b7 [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': {
henrike@webrtc.org7ef7df52014-01-21 15:54:56 +000017 # This will already be set to zero by supplement.gypi
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000018 'build_with_chromium%': 1,
19 },
20 'build_with_chromium%': '<(build_with_chromium)',
21
22 'conditions': [
henrike@webrtc.org42581542013-07-16 16:37:22 +000023 ['build_with_chromium==1', {
24 'build_with_libjingle': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000025 'webrtc_root%': '<(DEPTH)/third_party/webrtc',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000026 'apk_tests_path%': '<(DEPTH)/third_party/webrtc/build/apk_tests.gyp',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000027 'modules_java_gyp_path%': '<(DEPTH)/third_party/webrtc/modules/modules_java_chromium.gyp',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000028 }, {
henrike@webrtc.org42581542013-07-16 16:37:22 +000029 'build_with_libjingle%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000030 'webrtc_root%': '<(DEPTH)/webrtc',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000031 'apk_tests_path%': '<(DEPTH)/webrtc/build/apk_test_noop.gyp',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000032 'modules_java_gyp_path%': '<(DEPTH)/webrtc/modules/modules_java.gyp',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000033 }],
34 ],
35 },
36 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000037 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000038 'webrtc_root%': '<(webrtc_root)',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000039 'apk_tests_path%': '<(apk_tests_path)',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000040 'modules_java_gyp_path%': '<(modules_java_gyp_path)',
michaelbai@google.coma65abf92014-02-10 19:26:26 +000041
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000042 'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
stefan@webrtc.orgf56d6122013-07-09 12:32:35 +000043 'rbe_components_path%': '<(webrtc_root)/modules/remote_bitrate_estimator',
leozwang@webrtc.org6f19b1b2012-10-27 17:46:55 +000044 'include_opus%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000045 },
46 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000047 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000048 'webrtc_root%': '<(webrtc_root)',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000049 'apk_tests_path%': '<(apk_tests_path)',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000050 'modules_java_gyp_path%': '<(modules_java_gyp_path)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000051 'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
52 'include_opus%': '<(include_opus)',
stefan@webrtc.orgf56d6122013-07-09 12:32:35 +000053 'rbe_components_path%': '<(rbe_components_path)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000054
55 # The Chromium common.gypi we use treats all gyp files without
56 # chromium_code==1 as third party code. This disables many of the
57 # preferred warning settings.
58 #
59 # We can set this here to have WebRTC code treated as Chromium code. Our
60 # third party code will still have the reduced warning settings.
61 'chromium_code': 1,
62
solenberg@webrtc.orgd6e46632013-10-30 16:06:26 +000063 # Remote bitrate estimator logging/plotting.
64 'enable_bwe_test_logging%': 0,
65
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000066 # Adds video support to dependencies shared by voice and video engine.
67 # This should normally be enabled; the intended use is to disable only
68 # when building voice engine exclusively.
69 'enable_video%': 1,
70
71 # Selects fixed-point code where possible.
72 'prefer_fixed_point%': 0,
73
74 # Enable data logging. Produces text files with data logged within engines
75 # which can be easily parsed for offline processing.
76 'enable_data_logging%': 0,
77
andrew@webrtc.orgf9825e52013-05-20 21:18:04 +000078 # Enables the use of protocol buffers for debug recordings.
79 'enable_protobuf%': 1,
80
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000081 # Disable these to not build components which can be externally provided.
82 'build_libjpeg%': 1,
83 'build_libyuv%': 1,
84 'build_libvpx%': 1,
85
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +000086 # Enable to use the Mozilla internal settings.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000087 'build_with_mozilla%': 0,
88
89 'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
90
andrew@webrtc.org5140e242013-02-21 20:12:21 +000091 # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
92 # This may be subject to change in accordance to Chromium's MIPS flags
93 'mips_arch_variant%': 'mips32r1',
94 'mips_dsp_rev%': 0,
95 'mips_fpu%' : 1,
henrike@webrtc.org34c50c12013-09-27 22:34:35 +000096 'enable_android_opensl%': 1,
andrew@webrtc.org5140e242013-02-21 20:12:21 +000097
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000098 'conditions': [
99 ['build_with_chromium==1', {
100 # Exclude pulse audio on Chromium since its prerequisites don't require
101 # pulse audio.
102 'include_pulse_audio%': 0,
103
104 # Exclude internal ADM since Chromium uses its own IO handling.
105 'include_internal_audio_device%': 0,
106
107 # Exclude internal VCM in Chromium build.
108 'include_internal_video_capture%': 0,
109
110 # Exclude internal video render module in Chromium build.
111 'include_internal_video_render%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000112 }, { # Settings for the standalone (not-in-Chromium) build.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000113 # 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
henrike@webrtc.org42581542013-07-16 16:37:22 +0000118 'include_pulse_audio%': 1,
119 'include_internal_audio_device%': 1,
120 'include_internal_video_capture%': 1,
121 'include_internal_video_render%': 1,
henrike@webrtc.org42581542013-07-16 16:37:22 +0000122 }],
123 ['build_with_libjingle==1', {
124 'include_tests%': 0,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000125 'restrict_webrtc_logging%': 1,
henrike@webrtc.org42581542013-07-16 16:37:22 +0000126 }, {
127 'include_tests%': 1,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000128 'restrict_webrtc_logging%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000129 }],
130 ['OS=="ios"', {
fischman@webrtc.orgd0f4c212013-08-20 22:16:55 +0000131 'build_libjpeg%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000132 'enable_protobuf%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000133 'include_tests%': 0,
134 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000135 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000136 'prefer_fixed_point%': 1,
137 }],
138 ], # conditions
139 },
140 'target_defaults': {
141 'include_dirs': [
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 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000149 'conditions': [
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000150 ['restrict_webrtc_logging==1', {
151 'defines': ['WEBRTC_RESTRICT_LOGGING',],
andrew@webrtc.orgc3e5d342012-11-23 19:30:59 +0000152 }],
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +0000153 ['build_with_mozilla==1', {
154 'defines': [
155 # Changes settings for Mozilla build.
156 'WEBRTC_MOZILLA_BUILD',
157 ],
158 }],
andrew@webrtc.orgde7c9e82013-12-09 16:23:00 +0000159 ['enable_video==1', {
160 'defines': ['WEBRTC_MODULE_UTILITY_VIDEO',],
161 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000162 ['build_with_chromium==1', {
163 'defines': [
164 # Changes settings for Chromium build.
165 'WEBRTC_CHROMIUM_BUILD',
166 ],
167 }, {
168 'conditions': [
169 ['os_posix==1', {
170 'cflags': [
171 '-Wextra',
172 # We need to repeat some flags from Chromium's common.gypi here
173 # that get overridden by -Wextra.
174 '-Wno-unused-parameter',
175 '-Wno-missing-field-initializers',
kjellander@webrtc.orgf9bdbe32013-12-11 13:37:12 +0000176 '-Wno-strict-overflow',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000177 ],
178 'cflags_cc': [
pbos@webrtc.orgb3cc78d2013-11-21 11:42:02 +0000179 '-Wnon-virtual-dtor',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000180 # This is enabled for clang; enable for gcc as well.
181 '-Woverloaded-virtual',
182 ],
183 }],
andresp@webrtc.org7fb75ec2013-12-20 20:20:50 +0000184 ['clang==1', {
185 'cflags': [
186 '-Wthread-safety',
187 ],
188 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000189 ],
190 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000191 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000192 'defines': [
193 'WEBRTC_ARCH_ARM',
194 ],
195 'conditions': [
kjellander@webrtc.org917306d2013-12-10 09:26:07 +0000196 ['arm_version==7', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000197 'defines': ['WEBRTC_ARCH_ARM_V7',],
198 'conditions': [
199 ['arm_neon==1', {
200 'defines': ['WEBRTC_ARCH_ARM_NEON',],
201 }, {
202 'defines': ['WEBRTC_DETECT_ARM_NEON',],
203 }],
204 ],
205 }],
206 ],
207 }],
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000208 ['target_arch=="mipsel"', {
209 'defines': [
210 'MIPS32_LE',
211 ],
212 'conditions': [
213 ['mips_fpu==1', {
214 'defines': [
215 'MIPS_FPU_LE',
216 ],
217 'cflags': [
218 '-mhard-float',
219 ],
220 }, {
221 'cflags': [
222 '-msoft-float',
223 ],
224 }],
225 ['mips_arch_variant=="mips32r2"', {
226 'defines': [
227 'MIPS32_R2_LE',
228 ],
229 'cflags': [
230 '-mips32r2',
231 ],
232 'cflags_cc': [
233 '-mips32r2',
234 ],
235 }],
236 ['mips_dsp_rev==1', {
237 'defines': [
238 'MIPS_DSP_R1_LE',
239 ],
240 'cflags': [
241 '-mdsp',
242 ],
243 'cflags_cc': [
244 '-mdsp',
245 ],
246 }],
247 ['mips_dsp_rev==2', {
248 'defines': [
249 'MIPS_DSP_R1_LE',
250 'MIPS_DSP_R2_LE',
251 ],
252 'cflags': [
253 '-mdspr2',
254 ],
255 'cflags_cc': [
256 '-mdspr2',
257 ],
258 }],
259 ],
260 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000261 ['OS=="ios"', {
262 'defines': [
263 'WEBRTC_MAC',
264 'WEBRTC_IOS',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000265 ],
266 }],
267 ['OS=="linux"', {
268 'defines': [
269 'WEBRTC_LINUX',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000270 ],
271 }],
272 ['OS=="mac"', {
273 'defines': [
274 'WEBRTC_MAC',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000275 ],
276 }],
277 ['OS=="win"', {
278 'defines': [
279 'WEBRTC_WIN',
280 ],
281 # TODO(andrew): enable all warnings when possible.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000282 # TODO(phoglund): get rid of 4373 supression when
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000283 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000284 'msvs_disabled_warnings': [
285 4373, # legacy warning for ignoring const / volatile in signatures.
286 4389, # Signed/unsigned mismatch.
287 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000288 # Re-enable some warnings that Chromium disables.
289 'msvs_disabled_warnings!': [4189,],
290 }],
291 ['OS=="android"', {
292 'defines': [
293 'WEBRTC_LINUX',
294 'WEBRTC_ANDROID',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000295 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000296 'conditions': [
297 ['enable_android_opensl==1', {
298 'defines': [
299 'WEBRTC_ANDROID_OPENSLES',
300 ],
301 }],
wjia@webrtc.orgb1193692013-01-12 01:52:07 +0000302 ['clang!=1', {
303 # The Android NDK doesn't provide optimized versions of these
304 # functions. Ensure they are disabled for all compilers.
305 'cflags': [
306 '-fno-builtin-cos',
307 '-fno-builtin-sin',
308 '-fno-builtin-cosf',
309 '-fno-builtin-sinf',
310 ],
311 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000312 ],
313 }],
314 ], # conditions
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000315 'direct_dependent_settings': {
316 'include_dirs': [
317 '../..',
318 ],
319 'conditions': [
320 ['build_with_mozilla==1', {
321 'defines': [
322 # Changes settings for Mozilla build.
323 'WEBRTC_MOZILLA_BUILD',
324 ],
325 }],
326 ['build_with_chromium==1', {
327 'defines': [
328 # Changes settings for Chromium build.
329 'WEBRTC_CHROMIUM_BUILD',
330 ],
331 }],
332 ['OS=="mac"', {
333 'defines': [
334 'WEBRTC_MAC',
335 ],
336 }],
337 ['OS=="ios"', {
338 'defines': [
339 'WEBRTC_MAC',
340 'WEBRTC_IOS',
341 ],
342 }],
343 ['OS=="win"', {
344 'defines': [
345 'WEBRTC_WIN',
346 ],
347 }],
348 ['OS=="linux"', {
349 'defines': [
350 'WEBRTC_LINUX',
351 ],
352 }],
353 ['OS=="android"', {
354 'defines': [
355 'WEBRTC_LINUX',
356 'WEBRTC_ANDROID',
357 ],
358 'conditions': [
359 ['enable_android_opensl==1', {
360 'defines': [
361 'WEBRTC_ANDROID_OPENSLES',
362 ],
363 }]
364 ],
365 }],
366 ],
367 },
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000368 }, # target_defaults
369}
370