blob: 33dbace9b099c33c7454a6a835f87483f4260f12 [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',
kjellander@webrtc.org0372b932014-09-03 14:34:46 +000026 'apk_tests_path%': '<(DEPTH)/third_party/webrtc/build/apk_tests_noop.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',
kjellander@webrtc.org0372b932014-09-03 14:34:46 +000032 'apk_tests_path%': '<(DEPTH)/webrtc/build/apk_tests.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)',
kjellander@webrtc.org0372b932014-09-03 14:34:46 +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)',
kjellander@webrtc.org0372b932014-09-03 14:34:46 +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)',
henrike@webrtc.orgd72a7592014-09-02 15:41:12 +000056 'rtc_relative_path%': 1,
stefan@webrtc.orgf56d6122013-07-09 12:32:35 +000057 'rbe_components_path%': '<(rbe_components_path)',
henrike@webrtc.org9f36c082014-06-16 21:35:20 +000058 'external_libraries%': '0',
59 'json_root%': '<(DEPTH)/third_party/jsoncpp/source/include/',
60 # openssl needs to be defined or gyp will complain. Is is only used when
61 # when providing external libraries so just use current directory as a
62 # placeholder.
63 'ssl_root%': '.',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000064
65 # The Chromium common.gypi we use treats all gyp files without
66 # chromium_code==1 as third party code. This disables many of the
67 # preferred warning settings.
68 #
69 # We can set this here to have WebRTC code treated as Chromium code. Our
70 # third party code will still have the reduced warning settings.
71 'chromium_code': 1,
72
kjellander@webrtc.org0aa04f92014-03-28 13:14:00 +000073 # Set to 1 to enable code coverage on Linux using the gcov library.
74 'coverage%': 0,
75
solenberg@webrtc.orgd6e46632013-10-30 16:06:26 +000076 # Remote bitrate estimator logging/plotting.
77 'enable_bwe_test_logging%': 0,
78
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000079 # Adds video support to dependencies shared by voice and video engine.
80 # This should normally be enabled; the intended use is to disable only
81 # when building voice engine exclusively.
82 'enable_video%': 1,
83
84 # Selects fixed-point code where possible.
85 'prefer_fixed_point%': 0,
86
87 # Enable data logging. Produces text files with data logged within engines
88 # which can be easily parsed for offline processing.
89 'enable_data_logging%': 0,
90
andrew@webrtc.orgf9825e52013-05-20 21:18:04 +000091 # Enables the use of protocol buffers for debug recordings.
92 'enable_protobuf%': 1,
93
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000094 # Disable these to not build components which can be externally provided.
henrike@webrtc.orga685c9d2014-06-17 14:48:44 +000095 'build_json%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000096 'build_libjpeg%': 1,
97 'build_libyuv%': 1,
98 'build_libvpx%': 1,
henrike@webrtc.orga685c9d2014-06-17 14:48:44 +000099 'build_ssl%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000100
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000101 # Disable by default
102 'have_dbus_glib%': 0,
103
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +0000104 # Enable to use the Mozilla internal settings.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000105 'build_with_mozilla%': 0,
106
107 'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
108
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000109 # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
110 # This may be subject to change in accordance to Chromium's MIPS flags
andrew@webrtc.orgd05756f2014-09-30 15:53:24 +0000111 'mips_arch_variant%': 'r1',
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000112 'mips_dsp_rev%': 0,
113 'mips_fpu%' : 1,
henrike@webrtc.org34c50c12013-09-27 22:34:35 +0000114 'enable_android_opensl%': 1,
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000115
andrew@webrtc.orgaf7fdfc2014-08-29 17:41:13 +0000116 # Link-Time Optimizations
117 # Executes code generation at link-time instead of compile-time
118 # https://gcc.gnu.org/wiki/LinkTimeOptimization
119 'use_lto%': 0,
120
tpsiaki@google.com67eabc02014-09-10 18:06:47 +0000121 # Defer ssl perference to that specified through sslconfig.h instead of
122 # choosing openssl or nss directly. In practice, this can be used to
123 # enable schannel on windows.
124 'use_legacy_ssl_defaults%': 0,
125
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000126 'conditions': [
127 ['build_with_chromium==1', {
128 # Exclude pulse audio on Chromium since its prerequisites don't require
129 # pulse audio.
130 'include_pulse_audio%': 0,
131
132 # Exclude internal ADM since Chromium uses its own IO handling.
133 'include_internal_audio_device%': 0,
134
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000135 }, { # Settings for the standalone (not-in-Chromium) build.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000136 # TODO(andrew): For now, disable the Chrome plugins, which causes a
137 # flood of chromium-style warnings. Investigate enabling them:
138 # http://code.google.com/p/webrtc/issues/detail?id=163
139 'clang_use_chrome_plugins%': 0,
140
henrike@webrtc.org42581542013-07-16 16:37:22 +0000141 'include_pulse_audio%': 1,
142 'include_internal_audio_device%': 1,
henrike@webrtc.org42581542013-07-16 16:37:22 +0000143 }],
144 ['build_with_libjingle==1', {
145 'include_tests%': 0,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000146 'restrict_webrtc_logging%': 1,
henrike@webrtc.org42581542013-07-16 16:37:22 +0000147 }, {
148 'include_tests%': 1,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000149 'restrict_webrtc_logging%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000150 }],
151 ['OS=="ios"', {
fischman@webrtc.orgd0f4c212013-08-20 22:16:55 +0000152 'build_libjpeg%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000153 'enable_protobuf%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000154 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000155 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000156 'prefer_fixed_point%': 1,
157 }],
andrew@webrtc.org0001adc2014-10-09 04:13:02 +0000158 ['OS!="ios" and (target_arch!="arm" or arm_version>=7)', {
andrew@webrtc.org4165f7a2014-10-08 18:01:27 +0000159 'rtc_use_openmax_dl%': 1,
160 }, {
161 'rtc_use_openmax_dl%': 0,
162 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000163 ], # conditions
164 },
165 'target_defaults': {
166 'include_dirs': [
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000167 # To include the top-level directory when building in Chrome, so we can
168 # use full paths (e.g. headers inside testing/ or third_party/).
169 '<(DEPTH)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000170 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000171 'conditions': [
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000172 ['restrict_webrtc_logging==1', {
173 'defines': ['WEBRTC_RESTRICT_LOGGING',],
andrew@webrtc.orgc3e5d342012-11-23 19:30:59 +0000174 }],
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +0000175 ['build_with_mozilla==1', {
176 'defines': [
177 # Changes settings for Mozilla build.
178 'WEBRTC_MOZILLA_BUILD',
179 ],
180 }],
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000181 ['have_dbus_glib==1', {
182 'defines': [
183 'HAVE_DBUS_GLIB',
184 ],
185 'cflags': [
186 '<!@(pkg-config --cflags dbus-glib-1)',
187 ],
188 }],
henrike@webrtc.orgd72a7592014-09-02 15:41:12 +0000189 ['rtc_relative_path==1', {
190 'defines': ['EXPAT_RELATIVE_PATH',],
191 }],
andrew@webrtc.orgde7c9e82013-12-09 16:23:00 +0000192 ['enable_video==1', {
193 'defines': ['WEBRTC_MODULE_UTILITY_VIDEO',],
194 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000195 ['build_with_chromium==1', {
196 'defines': [
197 # Changes settings for Chromium build.
198 'WEBRTC_CHROMIUM_BUILD',
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000199 'LOGGING_INSIDE_WEBRTC',
200 ],
201 'include_dirs': [
202 # overrides must be included first as that is the mechanism for
203 # selecting the override headers in Chromium.
204 '../overrides',
205 # Allow includes to be prefixed with webrtc/ in case it is not an
206 # immediate subdirectory of <(DEPTH).
207 '../..',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000208 ],
209 }, {
210 'conditions': [
211 ['os_posix==1', {
henrike@webrtc.org2fe58932014-10-06 22:04:11 +0000212 'configurations': {
213 'Debug_Base': {
214 'defines': [
215 # Chromium's build/common.gypi defines this for all posix
216 # _except_ for ios & mac. We want it there as well, e.g.
217 # because ASSERT and friends trigger off of it.
218 '_DEBUG',
219 ],
220 },
221 },
solenberg@webrtc.orgc6db88b2014-06-04 17:15:42 +0000222 'conditions': [
223 # -Wextra is currently disabled in Chromium's common.gypi. Enable
224 # for targets that can handle it. For Android/arm64 right now
225 # there will be an 'enumeral and non-enumeral type in conditional
226 # expression' warning in android_tools/ndk_experimental's version
227 # of stlport.
228 # See: https://code.google.com/p/chromium/issues/detail?id=379699
229 ['target_arch!="arm64" or OS!="android"', {
230 'cflags': [
231 '-Wextra',
232 # We need to repeat some flags from Chromium's common.gypi
233 # here that get overridden by -Wextra.
234 '-Wno-unused-parameter',
235 '-Wno-missing-field-initializers',
236 '-Wno-strict-overflow',
237 ],
238 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000239 ],
240 'cflags_cc': [
pbos@webrtc.orgb3cc78d2013-11-21 11:42:02 +0000241 '-Wnon-virtual-dtor',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000242 # This is enabled for clang; enable for gcc as well.
243 '-Woverloaded-virtual',
244 ],
245 }],
andresp@webrtc.org7fb75ec2013-12-20 20:20:50 +0000246 ['clang==1', {
247 'cflags': [
248 '-Wthread-safety',
249 ],
250 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000251 ],
252 }],
tkchin@webrtc.org14146e42014-10-31 00:14:39 +0000253 ['target_arch=="arm64"', {
254 'defines': [
255 'WEBRTC_ARCH_ARM',
256 ],
257 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000258 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000259 'defines': [
260 'WEBRTC_ARCH_ARM',
261 ],
262 'conditions': [
kjellander@webrtc.org917306d2013-12-10 09:26:07 +0000263 ['arm_version==7', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000264 'defines': ['WEBRTC_ARCH_ARM_V7',],
265 'conditions': [
266 ['arm_neon==1', {
267 'defines': ['WEBRTC_ARCH_ARM_NEON',],
268 }, {
269 'defines': ['WEBRTC_DETECT_ARM_NEON',],
270 }],
271 ],
272 }],
273 ],
274 }],
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000275 ['target_arch=="mipsel"', {
276 'defines': [
277 'MIPS32_LE',
278 ],
279 'conditions': [
280 ['mips_fpu==1', {
281 'defines': [
282 'MIPS_FPU_LE',
283 ],
284 'cflags': [
285 '-mhard-float',
286 ],
287 }, {
288 'cflags': [
289 '-msoft-float',
290 ],
291 }],
andrew@webrtc.orgd05756f2014-09-30 15:53:24 +0000292 ['mips_arch_variant=="r2"', {
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000293 'defines': [
294 'MIPS32_R2_LE',
295 ],
296 'cflags': [
297 '-mips32r2',
298 ],
299 'cflags_cc': [
300 '-mips32r2',
301 ],
302 }],
303 ['mips_dsp_rev==1', {
304 'defines': [
305 'MIPS_DSP_R1_LE',
306 ],
307 'cflags': [
308 '-mdsp',
309 ],
310 'cflags_cc': [
311 '-mdsp',
312 ],
313 }],
314 ['mips_dsp_rev==2', {
315 'defines': [
316 'MIPS_DSP_R1_LE',
317 'MIPS_DSP_R2_LE',
318 ],
319 'cflags': [
320 '-mdspr2',
321 ],
322 'cflags_cc': [
323 '-mdspr2',
324 ],
325 }],
326 ],
327 }],
kjellander@webrtc.org0aa04f92014-03-28 13:14:00 +0000328 ['coverage==1 and OS=="linux"', {
329 'cflags': [ '-ftest-coverage',
330 '-fprofile-arcs' ],
331 'link_settings': { 'libraries': [ '-lgcov' ] },
332 }],
henrike@webrtc.orgcc08e3f2014-03-07 15:30:21 +0000333 ['os_posix==1', {
334 # For access to standard POSIXish features, use WEBRTC_POSIX instead of
335 # a more specific macro.
336 'defines': [
337 'WEBRTC_POSIX',
338 ],
339 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000340 ['OS=="ios"', {
341 'defines': [
342 'WEBRTC_MAC',
343 'WEBRTC_IOS',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000344 ],
345 }],
346 ['OS=="linux"', {
347 'defines': [
348 'WEBRTC_LINUX',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000349 ],
350 }],
351 ['OS=="mac"', {
352 'defines': [
353 'WEBRTC_MAC',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000354 ],
355 }],
356 ['OS=="win"', {
357 'defines': [
358 'WEBRTC_WIN',
359 ],
360 # TODO(andrew): enable all warnings when possible.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000361 # TODO(phoglund): get rid of 4373 supression when
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000362 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000363 'msvs_disabled_warnings': [
364 4373, # legacy warning for ignoring const / volatile in signatures.
365 4389, # Signed/unsigned mismatch.
366 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000367 # Re-enable some warnings that Chromium disables.
368 'msvs_disabled_warnings!': [4189,],
369 }],
370 ['OS=="android"', {
371 'defines': [
372 'WEBRTC_LINUX',
373 'WEBRTC_ANDROID',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000374 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000375 'conditions': [
376 ['enable_android_opensl==1', {
377 'defines': [
378 'WEBRTC_ANDROID_OPENSLES',
379 ],
380 }],
wjia@webrtc.orgb1193692013-01-12 01:52:07 +0000381 ['clang!=1', {
382 # The Android NDK doesn't provide optimized versions of these
383 # functions. Ensure they are disabled for all compilers.
384 'cflags': [
385 '-fno-builtin-cos',
386 '-fno-builtin-sin',
387 '-fno-builtin-cosf',
388 '-fno-builtin-sinf',
389 ],
390 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000391 ],
392 }],
393 ], # conditions
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000394 'direct_dependent_settings': {
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000395 'conditions': [
396 ['build_with_mozilla==1', {
397 'defines': [
398 # Changes settings for Mozilla build.
399 'WEBRTC_MOZILLA_BUILD',
400 ],
401 }],
402 ['build_with_chromium==1', {
403 'defines': [
404 # Changes settings for Chromium build.
405 'WEBRTC_CHROMIUM_BUILD',
406 ],
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000407 'include_dirs': [
408 # overrides must be included first as that is the mechanism for
409 # selecting the override headers in Chromium.
410 '../overrides',
411 '../..',
412 ],
413 }, {
414 'include_dirs': [
415 '../..',
416 ],
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000417 }],
418 ['OS=="mac"', {
419 'defines': [
420 'WEBRTC_MAC',
421 ],
422 }],
423 ['OS=="ios"', {
424 'defines': [
425 'WEBRTC_MAC',
426 'WEBRTC_IOS',
427 ],
428 }],
429 ['OS=="win"', {
430 'defines': [
431 'WEBRTC_WIN',
432 ],
433 }],
434 ['OS=="linux"', {
435 'defines': [
436 'WEBRTC_LINUX',
437 ],
438 }],
439 ['OS=="android"', {
440 'defines': [
441 'WEBRTC_LINUX',
442 'WEBRTC_ANDROID',
443 ],
444 'conditions': [
445 ['enable_android_opensl==1', {
446 'defines': [
447 'WEBRTC_ANDROID_OPENSLES',
448 ],
449 }]
450 ],
451 }],
henrike@webrtc.orgf0488722014-05-13 18:00:26 +0000452 ['os_posix==1', {
453 # For access to standard POSIXish features, use WEBRTC_POSIX instead
454 # of a more specific macro.
455 'defines': [
456 'WEBRTC_POSIX',
457 ],
458 }],
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000459 ],
460 },
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000461 }, # target_defaults
462}
463