blob: b4d6aa15ce0a5d804ff65f3010a49e2e3e4b34a4 [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,
20 },
21 'build_with_chromium%': '<(build_with_chromium)',
22
23 'conditions': [
henrike@webrtc.org42581542013-07-16 16:37:22 +000024 ['build_with_chromium==1', {
25 'build_with_libjingle': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000026 'webrtc_root%': '<(DEPTH)/third_party/webrtc',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000027 'apk_tests_path%': '<(DEPTH)/third_party/webrtc/build/apk_tests.gyp',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000028 'modules_java_gyp_path%': '<(DEPTH)/third_party/webrtc/modules/modules_java_chromium.gyp',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000029 }, {
henrike@webrtc.org42581542013-07-16 16:37:22 +000030 'build_with_libjingle%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000031 'webrtc_root%': '<(DEPTH)/webrtc',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000032 'apk_tests_path%': '<(DEPTH)/webrtc/build/apk_test_noop.gyp',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000033 'modules_java_gyp_path%': '<(DEPTH)/webrtc/modules/modules_java.gyp',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000034 }],
35 ],
36 },
37 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000038 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000039 'webrtc_root%': '<(webrtc_root)',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000040 'apk_tests_path%': '<(apk_tests_path)',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000041 'modules_java_gyp_path%': '<(modules_java_gyp_path)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000042
43 'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
stefan@webrtc.orgf56d6122013-07-09 12:32:35 +000044 'rbe_components_path%': '<(webrtc_root)/modules/remote_bitrate_estimator',
leozwang@webrtc.org6f19b1b2012-10-27 17:46:55 +000045 'include_opus%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000046 },
47 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000048 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000049 'webrtc_root%': '<(webrtc_root)',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000050 'apk_tests_path%': '<(apk_tests_path)',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000051 'modules_java_gyp_path%': '<(modules_java_gyp_path)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000052 'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
53 'include_opus%': '<(include_opus)',
stefan@webrtc.orgf56d6122013-07-09 12:32:35 +000054 'rbe_components_path%': '<(rbe_components_path)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000055
56 # The Chromium common.gypi we use treats all gyp files without
57 # chromium_code==1 as third party code. This disables many of the
58 # preferred warning settings.
59 #
60 # We can set this here to have WebRTC code treated as Chromium code. Our
61 # third party code will still have the reduced warning settings.
62 'chromium_code': 1,
63
solenberg@webrtc.orgd6e46632013-10-30 16:06:26 +000064 # Remote bitrate estimator logging/plotting.
65 'enable_bwe_test_logging%': 0,
66
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000067 # Adds video support to dependencies shared by voice and video engine.
68 # This should normally be enabled; the intended use is to disable only
69 # when building voice engine exclusively.
70 'enable_video%': 1,
71
72 # Selects fixed-point code where possible.
73 'prefer_fixed_point%': 0,
74
75 # Enable data logging. Produces text files with data logged within engines
76 # which can be easily parsed for offline processing.
77 'enable_data_logging%': 0,
78
andrew@webrtc.orgf9825e52013-05-20 21:18:04 +000079 # Enables the use of protocol buffers for debug recordings.
80 'enable_protobuf%': 1,
81
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000082 # Disable these to not build components which can be externally provided.
83 'build_libjpeg%': 1,
84 'build_libyuv%': 1,
85 'build_libvpx%': 1,
86
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +000087 # Enable to use the Mozilla internal settings.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000088 'build_with_mozilla%': 0,
89
90 'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
91
andrew@webrtc.org5140e242013-02-21 20:12:21 +000092 # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
93 # This may be subject to change in accordance to Chromium's MIPS flags
94 'mips_arch_variant%': 'mips32r1',
95 'mips_dsp_rev%': 0,
96 'mips_fpu%' : 1,
henrike@webrtc.org34c50c12013-09-27 22:34:35 +000097 'enable_android_opensl%': 1,
andrew@webrtc.org5140e242013-02-21 20:12:21 +000098
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000099 'conditions': [
100 ['build_with_chromium==1', {
101 # Exclude pulse audio on Chromium since its prerequisites don't require
102 # pulse audio.
103 'include_pulse_audio%': 0,
104
105 # Exclude internal ADM since Chromium uses its own IO handling.
106 'include_internal_audio_device%': 0,
107
108 # Exclude internal VCM in Chromium build.
109 'include_internal_video_capture%': 0,
110
111 # Exclude internal video render module in Chromium build.
112 'include_internal_video_render%': 0,
113
henrike@webrtc.org42581542013-07-16 16:37:22 +0000114 # Include ndk cpu features in Chromium build.
115 'include_ndk_cpu_features%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000116 }, { # Settings for the standalone (not-in-Chromium) build.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000117 # TODO(andrew): For now, disable the Chrome plugins, which causes a
118 # flood of chromium-style warnings. Investigate enabling them:
119 # http://code.google.com/p/webrtc/issues/detail?id=163
120 'clang_use_chrome_plugins%': 0,
121
henrike@webrtc.org42581542013-07-16 16:37:22 +0000122 'include_pulse_audio%': 1,
123 'include_internal_audio_device%': 1,
124 'include_internal_video_capture%': 1,
125 'include_internal_video_render%': 1,
126 'include_ndk_cpu_features%': 0,
127 }],
128 ['build_with_libjingle==1', {
129 'include_tests%': 0,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000130 'restrict_webrtc_logging%': 1,
henrike@webrtc.org42581542013-07-16 16:37:22 +0000131 }, {
132 'include_tests%': 1,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000133 'restrict_webrtc_logging%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000134 }],
135 ['OS=="ios"', {
fischman@webrtc.orgd0f4c212013-08-20 22:16:55 +0000136 'build_libjpeg%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000137 'enable_protobuf%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000138 'include_tests%': 0,
139 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000140 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000141 'prefer_fixed_point%': 1,
142 }],
143 ], # conditions
144 },
145 'target_defaults': {
146 'include_dirs': [
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000147 # Allow includes to be prefixed with webrtc/ in case it is not an
148 # immediate subdirectory of <(DEPTH).
andrew@webrtc.orgbe8ec382012-10-22 21:51:58 +0000149 '../..',
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000150 # To include the top-level directory when building in Chrome, so we can
151 # use full paths (e.g. headers inside testing/ or third_party/).
152 '<(DEPTH)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000153 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000154 'conditions': [
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000155 ['restrict_webrtc_logging==1', {
156 'defines': ['WEBRTC_RESTRICT_LOGGING',],
andrew@webrtc.orgc3e5d342012-11-23 19:30:59 +0000157 }],
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +0000158 ['build_with_mozilla==1', {
159 'defines': [
160 # Changes settings for Mozilla build.
161 'WEBRTC_MOZILLA_BUILD',
162 ],
163 }],
andrew@webrtc.orgde7c9e82013-12-09 16:23:00 +0000164 ['enable_video==1', {
165 'defines': ['WEBRTC_MODULE_UTILITY_VIDEO',],
166 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000167 ['build_with_chromium==1', {
168 'defines': [
169 # Changes settings for Chromium build.
170 'WEBRTC_CHROMIUM_BUILD',
171 ],
172 }, {
173 'conditions': [
174 ['os_posix==1', {
175 'cflags': [
176 '-Wextra',
177 # We need to repeat some flags from Chromium's common.gypi here
178 # that get overridden by -Wextra.
179 '-Wno-unused-parameter',
180 '-Wno-missing-field-initializers',
kjellander@webrtc.orgf9bdbe32013-12-11 13:37:12 +0000181 '-Wno-strict-overflow',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000182 ],
183 'cflags_cc': [
pbos@webrtc.orgb3cc78d2013-11-21 11:42:02 +0000184 '-Wnon-virtual-dtor',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000185 # This is enabled for clang; enable for gcc as well.
186 '-Woverloaded-virtual',
187 ],
188 }],
andresp@webrtc.org7fb75ec2013-12-20 20:20:50 +0000189 ['clang==1', {
190 'cflags': [
191 '-Wthread-safety',
192 ],
193 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000194 ],
195 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000196 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000197 'defines': [
198 'WEBRTC_ARCH_ARM',
199 ],
200 'conditions': [
kjellander@webrtc.org917306d2013-12-10 09:26:07 +0000201 ['arm_version==7', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000202 'defines': ['WEBRTC_ARCH_ARM_V7',],
203 'conditions': [
204 ['arm_neon==1', {
205 'defines': ['WEBRTC_ARCH_ARM_NEON',],
206 }, {
207 'defines': ['WEBRTC_DETECT_ARM_NEON',],
208 }],
209 ],
210 }],
211 ],
212 }],
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000213 ['target_arch=="mipsel"', {
214 'defines': [
215 'MIPS32_LE',
216 ],
217 'conditions': [
218 ['mips_fpu==1', {
219 'defines': [
220 'MIPS_FPU_LE',
221 ],
222 'cflags': [
223 '-mhard-float',
224 ],
225 }, {
226 'cflags': [
227 '-msoft-float',
228 ],
229 }],
230 ['mips_arch_variant=="mips32r2"', {
231 'defines': [
232 'MIPS32_R2_LE',
233 ],
234 'cflags': [
235 '-mips32r2',
236 ],
237 'cflags_cc': [
238 '-mips32r2',
239 ],
240 }],
241 ['mips_dsp_rev==1', {
242 'defines': [
243 'MIPS_DSP_R1_LE',
244 ],
245 'cflags': [
246 '-mdsp',
247 ],
248 'cflags_cc': [
249 '-mdsp',
250 ],
251 }],
252 ['mips_dsp_rev==2', {
253 'defines': [
254 'MIPS_DSP_R1_LE',
255 'MIPS_DSP_R2_LE',
256 ],
257 'cflags': [
258 '-mdspr2',
259 ],
260 'cflags_cc': [
261 '-mdspr2',
262 ],
263 }],
264 ],
265 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000266 ['OS=="ios"', {
267 'defines': [
268 'WEBRTC_MAC',
269 'WEBRTC_IOS',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000270 ],
271 }],
272 ['OS=="linux"', {
273 'defines': [
274 'WEBRTC_LINUX',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000275 ],
276 }],
277 ['OS=="mac"', {
278 'defines': [
279 'WEBRTC_MAC',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000280 ],
281 }],
282 ['OS=="win"', {
283 'defines': [
284 'WEBRTC_WIN',
285 ],
286 # TODO(andrew): enable all warnings when possible.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000287 # TODO(phoglund): get rid of 4373 supression when
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000288 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000289 'msvs_disabled_warnings': [
290 4373, # legacy warning for ignoring const / volatile in signatures.
291 4389, # Signed/unsigned mismatch.
292 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000293 # Re-enable some warnings that Chromium disables.
294 'msvs_disabled_warnings!': [4189,],
295 }],
296 ['OS=="android"', {
297 'defines': [
298 'WEBRTC_LINUX',
299 'WEBRTC_ANDROID',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000300 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000301 'conditions': [
302 ['enable_android_opensl==1', {
303 'defines': [
304 'WEBRTC_ANDROID_OPENSLES',
305 ],
306 }],
wjia@webrtc.orgb1193692013-01-12 01:52:07 +0000307 ['clang!=1', {
308 # The Android NDK doesn't provide optimized versions of these
309 # functions. Ensure they are disabled for all compilers.
310 'cflags': [
311 '-fno-builtin-cos',
312 '-fno-builtin-sin',
313 '-fno-builtin-cosf',
314 '-fno-builtin-sinf',
315 ],
316 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000317 ],
318 }],
319 ], # conditions
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000320 'direct_dependent_settings': {
321 'include_dirs': [
322 '../..',
323 ],
324 'conditions': [
325 ['build_with_mozilla==1', {
326 'defines': [
327 # Changes settings for Mozilla build.
328 'WEBRTC_MOZILLA_BUILD',
329 ],
330 }],
331 ['build_with_chromium==1', {
332 'defines': [
333 # Changes settings for Chromium build.
334 'WEBRTC_CHROMIUM_BUILD',
335 ],
336 }],
337 ['OS=="mac"', {
338 'defines': [
339 'WEBRTC_MAC',
340 ],
341 }],
342 ['OS=="ios"', {
343 'defines': [
344 'WEBRTC_MAC',
345 'WEBRTC_IOS',
346 ],
347 }],
348 ['OS=="win"', {
349 'defines': [
350 'WEBRTC_WIN',
351 ],
352 }],
353 ['OS=="linux"', {
354 'defines': [
355 'WEBRTC_LINUX',
356 ],
357 }],
358 ['OS=="android"', {
359 'defines': [
360 'WEBRTC_LINUX',
361 'WEBRTC_ANDROID',
362 ],
363 'conditions': [
364 ['enable_android_opensl==1', {
365 'defines': [
366 'WEBRTC_ANDROID_OPENSLES',
367 ],
368 }]
369 ],
370 }],
371 ],
372 },
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000373 }, # target_defaults
374}
375