blob: 9ce59eedca46b6357a603e7ddc7e8b0602063726 [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)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000057
58 # The Chromium common.gypi we use treats all gyp files without
59 # chromium_code==1 as third party code. This disables many of the
60 # preferred warning settings.
61 #
62 # We can set this here to have WebRTC code treated as Chromium code. Our
63 # third party code will still have the reduced warning settings.
64 'chromium_code': 1,
65
kjellander@webrtc.org0aa04f92014-03-28 13:14:00 +000066 # Set to 1 to enable code coverage on Linux using the gcov library.
67 'coverage%': 0,
68
solenberg@webrtc.orgd6e46632013-10-30 16:06:26 +000069 # Remote bitrate estimator logging/plotting.
70 'enable_bwe_test_logging%': 0,
71
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000072 # Adds video support to dependencies shared by voice and video engine.
73 # This should normally be enabled; the intended use is to disable only
74 # when building voice engine exclusively.
75 'enable_video%': 1,
76
77 # Selects fixed-point code where possible.
78 'prefer_fixed_point%': 0,
79
80 # Enable data logging. Produces text files with data logged within engines
81 # which can be easily parsed for offline processing.
82 'enable_data_logging%': 0,
83
andrew@webrtc.orgf9825e52013-05-20 21:18:04 +000084 # Enables the use of protocol buffers for debug recordings.
85 'enable_protobuf%': 1,
86
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000087 # Disable these to not build components which can be externally provided.
88 'build_libjpeg%': 1,
89 'build_libyuv%': 1,
90 'build_libvpx%': 1,
91
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +000092 # Enable to use the Mozilla internal settings.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000093 'build_with_mozilla%': 0,
94
95 'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
96
andrew@webrtc.org5140e242013-02-21 20:12:21 +000097 # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
98 # This may be subject to change in accordance to Chromium's MIPS flags
99 'mips_arch_variant%': 'mips32r1',
100 'mips_dsp_rev%': 0,
101 'mips_fpu%' : 1,
henrike@webrtc.org34c50c12013-09-27 22:34:35 +0000102 'enable_android_opensl%': 1,
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000103
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000104 'conditions': [
105 ['build_with_chromium==1', {
106 # Exclude pulse audio on Chromium since its prerequisites don't require
107 # pulse audio.
108 'include_pulse_audio%': 0,
109
110 # Exclude internal ADM since Chromium uses its own IO handling.
111 'include_internal_audio_device%': 0,
112
113 # Exclude internal VCM in Chromium build.
114 'include_internal_video_capture%': 0,
115
116 # Exclude internal video render module in Chromium build.
117 'include_internal_video_render%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000118 }, { # Settings for the standalone (not-in-Chromium) build.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000119 # TODO(andrew): For now, disable the Chrome plugins, which causes a
120 # flood of chromium-style warnings. Investigate enabling them:
121 # http://code.google.com/p/webrtc/issues/detail?id=163
122 'clang_use_chrome_plugins%': 0,
123
henrike@webrtc.org42581542013-07-16 16:37:22 +0000124 'include_pulse_audio%': 1,
125 'include_internal_audio_device%': 1,
126 'include_internal_video_capture%': 1,
127 'include_internal_video_render%': 1,
henrike@webrtc.org42581542013-07-16 16:37:22 +0000128 }],
129 ['build_with_libjingle==1', {
130 'include_tests%': 0,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000131 'restrict_webrtc_logging%': 1,
henrike@webrtc.org42581542013-07-16 16:37:22 +0000132 }, {
133 'include_tests%': 1,
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000134 'restrict_webrtc_logging%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000135 }],
136 ['OS=="ios"', {
fischman@webrtc.orgd0f4c212013-08-20 22:16:55 +0000137 'build_libjpeg%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000138 'enable_protobuf%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000139 'include_tests%': 0,
140 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000141 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000142 'prefer_fixed_point%': 1,
143 }],
144 ], # conditions
145 },
146 'target_defaults': {
147 'include_dirs': [
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000148 # Allow includes to be prefixed with webrtc/ in case it is not an
149 # immediate subdirectory of <(DEPTH).
andrew@webrtc.orgbe8ec382012-10-22 21:51:58 +0000150 '../..',
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000151 # To include the top-level directory when building in Chrome, so we can
152 # use full paths (e.g. headers inside testing/ or third_party/).
153 '<(DEPTH)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000154 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000155 'conditions': [
andrew@webrtc.orgf1a48172013-11-07 23:47:26 +0000156 ['restrict_webrtc_logging==1', {
157 'defines': ['WEBRTC_RESTRICT_LOGGING',],
andrew@webrtc.orgc3e5d342012-11-23 19:30:59 +0000158 }],
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.orgde7c9e82013-12-09 16:23:00 +0000165 ['enable_video==1', {
166 'defines': ['WEBRTC_MODULE_UTILITY_VIDEO',],
167 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000168 ['build_with_chromium==1', {
169 'defines': [
170 # Changes settings for Chromium build.
171 'WEBRTC_CHROMIUM_BUILD',
172 ],
173 }, {
174 'conditions': [
175 ['os_posix==1', {
176 'cflags': [
177 '-Wextra',
178 # We need to repeat some flags from Chromium's common.gypi here
179 # that get overridden by -Wextra.
180 '-Wno-unused-parameter',
181 '-Wno-missing-field-initializers',
kjellander@webrtc.orgf9bdbe32013-12-11 13:37:12 +0000182 '-Wno-strict-overflow',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000183 ],
184 'cflags_cc': [
pbos@webrtc.orgb3cc78d2013-11-21 11:42:02 +0000185 '-Wnon-virtual-dtor',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000186 # This is enabled for clang; enable for gcc as well.
187 '-Woverloaded-virtual',
188 ],
189 }],
andresp@webrtc.org7fb75ec2013-12-20 20:20:50 +0000190 ['clang==1', {
191 'cflags': [
192 '-Wthread-safety',
193 ],
194 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000195 ],
196 }],
fischman@webrtc.org31b4a5a2013-09-05 16:46:36 +0000197 ['target_arch=="arm" or target_arch=="armv7"', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000198 'defines': [
199 'WEBRTC_ARCH_ARM',
200 ],
201 'conditions': [
kjellander@webrtc.org917306d2013-12-10 09:26:07 +0000202 ['arm_version==7', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000203 'defines': ['WEBRTC_ARCH_ARM_V7',],
204 'conditions': [
205 ['arm_neon==1', {
206 'defines': ['WEBRTC_ARCH_ARM_NEON',],
207 }, {
208 'defines': ['WEBRTC_DETECT_ARM_NEON',],
209 }],
210 ],
211 }],
212 ],
213 }],
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000214 ['target_arch=="mipsel"', {
215 'defines': [
216 'MIPS32_LE',
217 ],
218 'conditions': [
219 ['mips_fpu==1', {
220 'defines': [
221 'MIPS_FPU_LE',
222 ],
223 'cflags': [
224 '-mhard-float',
225 ],
226 }, {
227 'cflags': [
228 '-msoft-float',
229 ],
230 }],
231 ['mips_arch_variant=="mips32r2"', {
232 'defines': [
233 'MIPS32_R2_LE',
234 ],
235 'cflags': [
236 '-mips32r2',
237 ],
238 'cflags_cc': [
239 '-mips32r2',
240 ],
241 }],
242 ['mips_dsp_rev==1', {
243 'defines': [
244 'MIPS_DSP_R1_LE',
245 ],
246 'cflags': [
247 '-mdsp',
248 ],
249 'cflags_cc': [
250 '-mdsp',
251 ],
252 }],
253 ['mips_dsp_rev==2', {
254 'defines': [
255 'MIPS_DSP_R1_LE',
256 'MIPS_DSP_R2_LE',
257 ],
258 'cflags': [
259 '-mdspr2',
260 ],
261 'cflags_cc': [
262 '-mdspr2',
263 ],
264 }],
265 ],
266 }],
kjellander@webrtc.org0aa04f92014-03-28 13:14:00 +0000267 ['coverage==1 and OS=="linux"', {
268 'cflags': [ '-ftest-coverage',
269 '-fprofile-arcs' ],
270 'link_settings': { 'libraries': [ '-lgcov' ] },
271 }],
henrike@webrtc.orgcc08e3f2014-03-07 15:30:21 +0000272 ['os_posix==1', {
273 # For access to standard POSIXish features, use WEBRTC_POSIX instead of
274 # a more specific macro.
275 'defines': [
276 'WEBRTC_POSIX',
277 ],
278 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000279 ['OS=="ios"', {
280 'defines': [
281 'WEBRTC_MAC',
282 'WEBRTC_IOS',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000283 ],
284 }],
285 ['OS=="linux"', {
286 'defines': [
287 'WEBRTC_LINUX',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000288 ],
289 }],
290 ['OS=="mac"', {
291 'defines': [
292 'WEBRTC_MAC',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000293 ],
294 }],
295 ['OS=="win"', {
296 'defines': [
297 'WEBRTC_WIN',
298 ],
299 # TODO(andrew): enable all warnings when possible.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000300 # TODO(phoglund): get rid of 4373 supression when
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000301 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000302 'msvs_disabled_warnings': [
303 4373, # legacy warning for ignoring const / volatile in signatures.
304 4389, # Signed/unsigned mismatch.
305 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000306 # Re-enable some warnings that Chromium disables.
307 'msvs_disabled_warnings!': [4189,],
308 }],
309 ['OS=="android"', {
310 'defines': [
311 'WEBRTC_LINUX',
312 'WEBRTC_ANDROID',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000313 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000314 'conditions': [
315 ['enable_android_opensl==1', {
316 'defines': [
317 'WEBRTC_ANDROID_OPENSLES',
318 ],
319 }],
wjia@webrtc.orgb1193692013-01-12 01:52:07 +0000320 ['clang!=1', {
321 # The Android NDK doesn't provide optimized versions of these
322 # functions. Ensure they are disabled for all compilers.
323 'cflags': [
324 '-fno-builtin-cos',
325 '-fno-builtin-sin',
326 '-fno-builtin-cosf',
327 '-fno-builtin-sinf',
328 ],
329 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000330 ],
331 }],
332 ], # conditions
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000333 'direct_dependent_settings': {
334 'include_dirs': [
335 '../..',
336 ],
337 'conditions': [
338 ['build_with_mozilla==1', {
339 'defines': [
340 # Changes settings for Mozilla build.
341 'WEBRTC_MOZILLA_BUILD',
342 ],
343 }],
344 ['build_with_chromium==1', {
345 'defines': [
346 # Changes settings for Chromium build.
347 'WEBRTC_CHROMIUM_BUILD',
348 ],
349 }],
350 ['OS=="mac"', {
351 'defines': [
352 'WEBRTC_MAC',
353 ],
354 }],
355 ['OS=="ios"', {
356 'defines': [
357 'WEBRTC_MAC',
358 'WEBRTC_IOS',
359 ],
360 }],
361 ['OS=="win"', {
362 'defines': [
363 'WEBRTC_WIN',
364 ],
365 }],
366 ['OS=="linux"', {
367 'defines': [
368 'WEBRTC_LINUX',
369 ],
370 }],
371 ['OS=="android"', {
372 'defines': [
373 'WEBRTC_LINUX',
374 'WEBRTC_ANDROID',
375 ],
376 'conditions': [
377 ['enable_android_opensl==1', {
378 'defines': [
379 'WEBRTC_ANDROID_OPENSLES',
380 ],
381 }]
382 ],
383 }],
384 ],
385 },
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000386 }, # target_defaults
387}
388