blob: cbc398e4004cc725659497ccb51bcc15c5333d35 [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',
michaelbai@google.com82ebb462014-02-11 04:48:27 +000028 'gen_core_neon_offsets_gyp%': '<(DEPTH)/third_party/webrtc/modules/audio_processing/gen_core_neon_offsets_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',
michaelbai@google.com82ebb462014-02-11 04:48:27 +000034 'gen_core_neon_offsets_gyp%':'<(DEPTH)/webrtc/modules/audio_processing/gen_core_neon_offsets.gyp',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000035 }],
36 ],
37 },
38 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000039 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000040 'webrtc_root%': '<(webrtc_root)',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000041 'apk_tests_path%': '<(apk_tests_path)',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000042 'modules_java_gyp_path%': '<(modules_java_gyp_path)',
michaelbai@google.com82ebb462014-02-11 04:48:27 +000043 'gen_core_neon_offsets_gyp%': '<(gen_core_neon_offsets_gyp)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000044 'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
stefan@webrtc.orgf56d6122013-07-09 12:32:35 +000045 'rbe_components_path%': '<(webrtc_root)/modules/remote_bitrate_estimator',
leozwang@webrtc.org6f19b1b2012-10-27 17:46:55 +000046 'include_opus%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000047 },
48 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000049 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000050 'webrtc_root%': '<(webrtc_root)',
henrike@webrtc.org1303af32013-07-03 21:50:33 +000051 'apk_tests_path%': '<(apk_tests_path)',
henrike@webrtc.orga2073af2013-07-08 18:14:58 +000052 'modules_java_gyp_path%': '<(modules_java_gyp_path)',
michaelbai@google.com82ebb462014-02-11 04:48:27 +000053 'gen_core_neon_offsets_gyp%': '<(gen_core_neon_offsets_gyp)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000054 'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
55 'include_opus%': '<(include_opus)',
stefan@webrtc.orgf56d6122013-07-09 12:32:35 +000056 'rbe_components_path%': '<(rbe_components_path)',
henrike@webrtc.org9f36c082014-06-16 21:35:20 +000057 'external_libraries%': '0',
58 'json_root%': '<(DEPTH)/third_party/jsoncpp/source/include/',
59 # openssl needs to be defined or gyp will complain. Is is only used when
60 # when providing external libraries so just use current directory as a
61 # placeholder.
62 'ssl_root%': '.',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000063
64 # The Chromium common.gypi we use treats all gyp files without
65 # chromium_code==1 as third party code. This disables many of the
66 # preferred warning settings.
67 #
68 # We can set this here to have WebRTC code treated as Chromium code. Our
69 # third party code will still have the reduced warning settings.
70 'chromium_code': 1,
71
kjellander@webrtc.org0aa04f92014-03-28 13:14:00 +000072 # Set to 1 to enable code coverage on Linux using the gcov library.
73 'coverage%': 0,
74
solenberg@webrtc.orgd6e46632013-10-30 16:06:26 +000075 # Remote bitrate estimator logging/plotting.
76 'enable_bwe_test_logging%': 0,
77
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000078 # Adds video support to dependencies shared by voice and video engine.
79 # This should normally be enabled; the intended use is to disable only
80 # when building voice engine exclusively.
81 'enable_video%': 1,
82
83 # Selects fixed-point code where possible.
84 'prefer_fixed_point%': 0,
85
86 # Enable data logging. Produces text files with data logged within engines
87 # which can be easily parsed for offline processing.
88 'enable_data_logging%': 0,
89
andrew@webrtc.orgf9825e52013-05-20 21:18:04 +000090 # Enables the use of protocol buffers for debug recordings.
91 'enable_protobuf%': 1,
92
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000093 # Disable these to not build components which can be externally provided.
henrike@webrtc.orga685c9d2014-06-17 14:48:44 +000094 'build_json%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000095 'build_libjpeg%': 1,
96 'build_libyuv%': 1,
97 'build_libvpx%': 1,
henrike@webrtc.orga685c9d2014-06-17 14:48:44 +000098 'build_ssl%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000099
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000100 # Disable by default
101 'have_dbus_glib%': 0,
102
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +0000103 # Enable to use the Mozilla internal settings.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000104 'build_with_mozilla%': 0,
105
106 'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
107
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000108 # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
109 # This may be subject to change in accordance to Chromium's MIPS flags
110 'mips_arch_variant%': 'mips32r1',
111 'mips_dsp_rev%': 0,
112 'mips_fpu%' : 1,
henrike@webrtc.org34c50c12013-09-27 22:34:35 +0000113 'enable_android_opensl%': 1,
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000114
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000115 'conditions': [
116 ['build_with_chromium==1', {
117 # Exclude pulse audio on Chromium since its prerequisites don't require
118 # pulse audio.
119 'include_pulse_audio%': 0,
120
121 # Exclude internal ADM since Chromium uses its own IO handling.
122 'include_internal_audio_device%': 0,
123
124 # Exclude internal VCM in Chromium build.
125 'include_internal_video_capture%': 0,
126
127 # Exclude internal video render module in Chromium build.
128 'include_internal_video_render%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000129 }, { # Settings for the standalone (not-in-Chromium) build.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000130 # TODO(andrew): For now, disable the Chrome plugins, which causes a
131 # flood of chromium-style warnings. Investigate enabling them:
132 # http://code.google.com/p/webrtc/issues/detail?id=163
133 'clang_use_chrome_plugins%': 0,
134
henrike@webrtc.org42581542013-07-16 16:37:22 +0000135 'include_pulse_audio%': 1,
136 'include_internal_audio_device%': 1,
137 'include_internal_video_capture%': 1,
138 'include_internal_video_render%': 1,
henrike@webrtc.org42581542013-07-16 16:37:22 +0000139 }],
140 ['build_with_libjingle==1', {
141 'include_tests%': 0,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000142 'restrict_webrtc_logging%': 1,
henrike@webrtc.org42581542013-07-16 16:37:22 +0000143 }, {
144 'include_tests%': 1,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000145 'restrict_webrtc_logging%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000146 }],
147 ['OS=="ios"', {
fischman@webrtc.orgd0f4c212013-08-20 22:16:55 +0000148 'build_libjpeg%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000149 'enable_protobuf%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000150 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000151 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000152 'prefer_fixed_point%': 1,
153 }],
154 ], # conditions
155 },
156 'target_defaults': {
157 'include_dirs': [
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000158 # To include the top-level directory when building in Chrome, so we can
159 # use full paths (e.g. headers inside testing/ or third_party/).
160 '<(DEPTH)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000161 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000162 'conditions': [
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000163 ['restrict_webrtc_logging==1', {
164 'defines': ['WEBRTC_RESTRICT_LOGGING',],
andrew@webrtc.orgc3e5d342012-11-23 19:30:59 +0000165 }],
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +0000166 ['build_with_mozilla==1', {
167 'defines': [
168 # Changes settings for Mozilla build.
169 'WEBRTC_MOZILLA_BUILD',
170 ],
171 }],
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000172 ['have_dbus_glib==1', {
173 'defines': [
174 'HAVE_DBUS_GLIB',
175 ],
176 'cflags': [
177 '<!@(pkg-config --cflags dbus-glib-1)',
178 ],
179 }],
andrew@webrtc.orgde7c9e82013-12-09 16:23:00 +0000180 ['enable_video==1', {
181 'defines': ['WEBRTC_MODULE_UTILITY_VIDEO',],
182 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000183 ['build_with_chromium==1', {
184 'defines': [
185 # Changes settings for Chromium build.
186 'WEBRTC_CHROMIUM_BUILD',
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000187 'LOGGING_INSIDE_WEBRTC',
188 ],
189 'include_dirs': [
190 # overrides must be included first as that is the mechanism for
191 # selecting the override headers in Chromium.
192 '../overrides',
193 # Allow includes to be prefixed with webrtc/ in case it is not an
194 # immediate subdirectory of <(DEPTH).
195 '../..',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000196 ],
197 }, {
198 'conditions': [
199 ['os_posix==1', {
solenberg@webrtc.orgc6db88b2014-06-04 17:15:42 +0000200 'conditions': [
201 # -Wextra is currently disabled in Chromium's common.gypi. Enable
202 # for targets that can handle it. For Android/arm64 right now
203 # there will be an 'enumeral and non-enumeral type in conditional
204 # expression' warning in android_tools/ndk_experimental's version
205 # of stlport.
206 # See: https://code.google.com/p/chromium/issues/detail?id=379699
207 ['target_arch!="arm64" or OS!="android"', {
208 'cflags': [
209 '-Wextra',
210 # We need to repeat some flags from Chromium's common.gypi
211 # here that get overridden by -Wextra.
212 '-Wno-unused-parameter',
213 '-Wno-missing-field-initializers',
214 '-Wno-strict-overflow',
215 ],
216 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000217 ],
218 'cflags_cc': [
pbos@webrtc.orgb3cc78d2013-11-21 11:42:02 +0000219 '-Wnon-virtual-dtor',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000220 # This is enabled for clang; enable for gcc as well.
221 '-Woverloaded-virtual',
222 ],
223 }],
andresp@webrtc.org7fb75ec2013-12-20 20:20:50 +0000224 ['clang==1', {
225 'cflags': [
226 '-Wthread-safety',
227 ],
228 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000229 ],
230 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000231 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000232 'defines': [
233 'WEBRTC_ARCH_ARM',
234 ],
235 'conditions': [
kjellander@webrtc.org917306d2013-12-10 09:26:07 +0000236 ['arm_version==7', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000237 'defines': ['WEBRTC_ARCH_ARM_V7',],
238 'conditions': [
239 ['arm_neon==1', {
240 'defines': ['WEBRTC_ARCH_ARM_NEON',],
241 }, {
242 'defines': ['WEBRTC_DETECT_ARM_NEON',],
243 }],
244 ],
245 }],
246 ],
247 }],
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000248 ['target_arch=="mipsel"', {
249 'defines': [
250 'MIPS32_LE',
251 ],
252 'conditions': [
253 ['mips_fpu==1', {
254 'defines': [
255 'MIPS_FPU_LE',
256 ],
257 'cflags': [
258 '-mhard-float',
259 ],
260 }, {
261 'cflags': [
262 '-msoft-float',
263 ],
264 }],
265 ['mips_arch_variant=="mips32r2"', {
266 'defines': [
267 'MIPS32_R2_LE',
268 ],
269 'cflags': [
270 '-mips32r2',
271 ],
272 'cflags_cc': [
273 '-mips32r2',
274 ],
275 }],
276 ['mips_dsp_rev==1', {
277 'defines': [
278 'MIPS_DSP_R1_LE',
279 ],
280 'cflags': [
281 '-mdsp',
282 ],
283 'cflags_cc': [
284 '-mdsp',
285 ],
286 }],
287 ['mips_dsp_rev==2', {
288 'defines': [
289 'MIPS_DSP_R1_LE',
290 'MIPS_DSP_R2_LE',
291 ],
292 'cflags': [
293 '-mdspr2',
294 ],
295 'cflags_cc': [
296 '-mdspr2',
297 ],
298 }],
299 ],
300 }],
kjellander@webrtc.org0aa04f92014-03-28 13:14:00 +0000301 ['coverage==1 and OS=="linux"', {
302 'cflags': [ '-ftest-coverage',
303 '-fprofile-arcs' ],
304 'link_settings': { 'libraries': [ '-lgcov' ] },
305 }],
henrike@webrtc.orgcc08e3f2014-03-07 15:30:21 +0000306 ['os_posix==1', {
307 # For access to standard POSIXish features, use WEBRTC_POSIX instead of
308 # a more specific macro.
309 'defines': [
310 'WEBRTC_POSIX',
311 ],
312 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000313 ['OS=="ios"', {
314 'defines': [
315 'WEBRTC_MAC',
316 'WEBRTC_IOS',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000317 ],
318 }],
319 ['OS=="linux"', {
320 'defines': [
321 'WEBRTC_LINUX',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000322 ],
323 }],
324 ['OS=="mac"', {
325 'defines': [
326 'WEBRTC_MAC',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000327 ],
328 }],
329 ['OS=="win"', {
330 'defines': [
331 'WEBRTC_WIN',
332 ],
333 # TODO(andrew): enable all warnings when possible.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000334 # TODO(phoglund): get rid of 4373 supression when
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000335 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000336 'msvs_disabled_warnings': [
337 4373, # legacy warning for ignoring const / volatile in signatures.
338 4389, # Signed/unsigned mismatch.
339 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000340 # Re-enable some warnings that Chromium disables.
341 'msvs_disabled_warnings!': [4189,],
342 }],
343 ['OS=="android"', {
344 'defines': [
345 'WEBRTC_LINUX',
346 'WEBRTC_ANDROID',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000347 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000348 'conditions': [
349 ['enable_android_opensl==1', {
350 'defines': [
351 'WEBRTC_ANDROID_OPENSLES',
352 ],
353 }],
wjia@webrtc.orgb1193692013-01-12 01:52:07 +0000354 ['clang!=1', {
355 # The Android NDK doesn't provide optimized versions of these
356 # functions. Ensure they are disabled for all compilers.
357 'cflags': [
358 '-fno-builtin-cos',
359 '-fno-builtin-sin',
360 '-fno-builtin-cosf',
361 '-fno-builtin-sinf',
362 ],
363 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000364 ],
365 }],
366 ], # conditions
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000367 'direct_dependent_settings': {
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000368 'conditions': [
369 ['build_with_mozilla==1', {
370 'defines': [
371 # Changes settings for Mozilla build.
372 'WEBRTC_MOZILLA_BUILD',
373 ],
374 }],
375 ['build_with_chromium==1', {
376 'defines': [
377 # Changes settings for Chromium build.
378 'WEBRTC_CHROMIUM_BUILD',
379 ],
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000380 'include_dirs': [
381 # overrides must be included first as that is the mechanism for
382 # selecting the override headers in Chromium.
383 '../overrides',
384 '../..',
385 ],
386 }, {
387 'include_dirs': [
388 '../..',
389 ],
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000390 }],
391 ['OS=="mac"', {
392 'defines': [
393 'WEBRTC_MAC',
394 ],
395 }],
396 ['OS=="ios"', {
397 'defines': [
398 'WEBRTC_MAC',
399 'WEBRTC_IOS',
400 ],
401 }],
402 ['OS=="win"', {
403 'defines': [
404 'WEBRTC_WIN',
405 ],
406 }],
407 ['OS=="linux"', {
408 'defines': [
409 'WEBRTC_LINUX',
410 ],
411 }],
412 ['OS=="android"', {
413 'defines': [
414 'WEBRTC_LINUX',
415 'WEBRTC_ANDROID',
416 ],
417 'conditions': [
418 ['enable_android_opensl==1', {
419 'defines': [
420 'WEBRTC_ANDROID_OPENSLES',
421 ],
422 }]
423 ],
424 }],
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000425 ['os_posix==1', {
426 # For access to standard POSIXish features, use WEBRTC_POSIX instead
427 # of a more specific macro.
428 'defines': [
429 'WEBRTC_POSIX',
430 ],
431 }],
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000432 ],
433 },
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000434 }, # target_defaults
435}
436