blob: 5572b2ae52966048970b22b2924ff47e9cb1fae6 [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
64 # Adds video support to dependencies shared by voice and video engine.
65 # This should normally be enabled; the intended use is to disable only
66 # when building voice engine exclusively.
67 'enable_video%': 1,
68
69 # Selects fixed-point code where possible.
70 'prefer_fixed_point%': 0,
71
72 # Enable data logging. Produces text files with data logged within engines
73 # which can be easily parsed for offline processing.
74 'enable_data_logging%': 0,
75
andrew@webrtc.orgf9825e52013-05-20 21:18:04 +000076 # Enables the use of protocol buffers for debug recordings.
77 'enable_protobuf%': 1,
78
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000079 # Disable these to not build components which can be externally provided.
80 'build_libjpeg%': 1,
81 'build_libyuv%': 1,
82 'build_libvpx%': 1,
83
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +000084 # Enable to use the Mozilla internal settings.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000085 'build_with_mozilla%': 0,
86
87 'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
88
andrew@webrtc.org5140e242013-02-21 20:12:21 +000089 # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
90 # This may be subject to change in accordance to Chromium's MIPS flags
91 'mips_arch_variant%': 'mips32r1',
92 'mips_dsp_rev%': 0,
93 'mips_fpu%' : 1,
94
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000095 'conditions': [
96 ['build_with_chromium==1', {
henrike@webrtc.org42581542013-07-16 16:37:22 +000097 # clang_use_chrome_plugins must not be disabled when building Chromium.
98 'clang_use_chrome_plugins': 1,
99
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000100 # 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,
112
henrike@webrtc.org42581542013-07-16 16:37:22 +0000113 # Include ndk cpu features in Chromium build.
114 'include_ndk_cpu_features%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000115 }, { # Settings for the standalone (not-in-Chromium) build.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000116 # TODO(andrew): For now, disable the Chrome plugins, which causes a
117 # flood of chromium-style warnings. Investigate enabling them:
118 # http://code.google.com/p/webrtc/issues/detail?id=163
119 'clang_use_chrome_plugins%': 0,
120
henrike@webrtc.org42581542013-07-16 16:37:22 +0000121 'include_pulse_audio%': 1,
122 'include_internal_audio_device%': 1,
123 'include_internal_video_capture%': 1,
124 'include_internal_video_render%': 1,
125 'include_ndk_cpu_features%': 0,
126 }],
127 ['build_with_libjingle==1', {
128 'include_tests%': 0,
129 'enable_tracing%': 0,
130 'enable_android_opensl%': 0,
131 }, {
132 'include_tests%': 1,
133 'enable_tracing%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000134 # Switch between Android audio device OpenSL ES implementation
135 # and Java Implementation
leozwang@webrtc.org56a1c2c2012-11-29 03:13:00 +0000136 'enable_android_opensl%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000137 }],
138 ['OS=="ios"', {
139 'enable_video%': 0,
140 'enable_protobuf%': 0,
141 'build_libjpeg%': 0,
142 'build_libyuv%': 0,
143 'build_libvpx%': 0,
144 'include_tests%': 0,
145 }],
146 ['target_arch=="arm"', {
147 'prefer_fixed_point%': 1,
148 }],
149 ], # conditions
150 },
151 'target_defaults': {
152 'include_dirs': [
andrew@webrtc.orgbe8ec382012-10-22 21:51:58 +0000153 # TODO(andrew): Remove '..' when we've added webrtc/ to include paths.
154 '..',
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000155 # Allow includes to be prefixed with webrtc/ in case it is not an
156 # immediate subdirectory of <(DEPTH).
andrew@webrtc.orgbe8ec382012-10-22 21:51:58 +0000157 '../..',
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 ],
162 'defines': [
163 # TODO(leozwang): Run this as a gclient hook rather than at build-time:
164 # http://code.google.com/p/webrtc/issues/detail?id=687
165 'WEBRTC_SVNREVISION="Unavailable(issue687)"',
166 #'WEBRTC_SVNREVISION="<!(python <(webrtc_root)/build/version.py)"',
167 ],
168 'conditions': [
andrew@webrtc.orgc3e5d342012-11-23 19:30:59 +0000169 ['enable_tracing==1', {
170 'defines': ['WEBRTC_LOGGING',],
171 }],
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +0000172 ['build_with_mozilla==1', {
173 'defines': [
174 # Changes settings for Mozilla build.
175 'WEBRTC_MOZILLA_BUILD',
176 ],
177 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000178 ['build_with_chromium==1', {
179 'defines': [
180 # Changes settings for Chromium build.
181 'WEBRTC_CHROMIUM_BUILD',
182 ],
183 }, {
184 'conditions': [
185 ['os_posix==1', {
186 'cflags': [
187 '-Wextra',
188 # We need to repeat some flags from Chromium's common.gypi here
189 # that get overridden by -Wextra.
190 '-Wno-unused-parameter',
191 '-Wno-missing-field-initializers',
192 ],
193 'cflags_cc': [
194 # This is enabled for clang; enable for gcc as well.
195 '-Woverloaded-virtual',
196 ],
197 }],
198 ],
199 }],
200 ['target_arch=="arm"', {
201 'defines': [
202 'WEBRTC_ARCH_ARM',
203 ],
204 'conditions': [
205 ['armv7==1', {
206 'defines': ['WEBRTC_ARCH_ARM_V7',],
207 'conditions': [
208 ['arm_neon==1', {
209 'defines': ['WEBRTC_ARCH_ARM_NEON',],
210 }, {
211 'defines': ['WEBRTC_DETECT_ARM_NEON',],
212 }],
213 ],
214 }],
215 ],
216 }],
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000217 ['target_arch=="mipsel"', {
218 'defines': [
219 'MIPS32_LE',
220 ],
221 'conditions': [
222 ['mips_fpu==1', {
223 'defines': [
224 'MIPS_FPU_LE',
225 ],
226 'cflags': [
227 '-mhard-float',
228 ],
229 }, {
230 'cflags': [
231 '-msoft-float',
232 ],
233 }],
234 ['mips_arch_variant=="mips32r2"', {
235 'defines': [
236 'MIPS32_R2_LE',
237 ],
238 'cflags': [
239 '-mips32r2',
240 ],
241 'cflags_cc': [
242 '-mips32r2',
243 ],
244 }],
245 ['mips_dsp_rev==1', {
246 'defines': [
247 'MIPS_DSP_R1_LE',
248 ],
249 'cflags': [
250 '-mdsp',
251 ],
252 'cflags_cc': [
253 '-mdsp',
254 ],
255 }],
256 ['mips_dsp_rev==2', {
257 'defines': [
258 'MIPS_DSP_R1_LE',
259 'MIPS_DSP_R2_LE',
260 ],
261 'cflags': [
262 '-mdspr2',
263 ],
264 'cflags_cc': [
265 '-mdspr2',
266 ],
267 }],
268 ],
269 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000270 ['OS=="ios"', {
271 'defines': [
272 'WEBRTC_MAC',
273 'WEBRTC_IOS',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000274 ],
275 }],
276 ['OS=="linux"', {
277 'defines': [
278 'WEBRTC_LINUX',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000279 ],
280 }],
281 ['OS=="mac"', {
282 'defines': [
283 'WEBRTC_MAC',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000284 ],
285 }],
286 ['OS=="win"', {
287 'defines': [
288 'WEBRTC_WIN',
289 ],
290 # TODO(andrew): enable all warnings when possible.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000291 # TODO(phoglund): get rid of 4373 supression when
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000292 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000293 'msvs_disabled_warnings': [
294 4373, # legacy warning for ignoring const / volatile in signatures.
295 4389, # Signed/unsigned mismatch.
296 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000297 # Re-enable some warnings that Chromium disables.
298 'msvs_disabled_warnings!': [4189,],
299 }],
300 ['OS=="android"', {
301 'defines': [
302 'WEBRTC_LINUX',
303 'WEBRTC_ANDROID',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000304 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000305 'conditions': [
306 ['enable_android_opensl==1', {
307 'defines': [
308 'WEBRTC_ANDROID_OPENSLES',
309 ],
310 }],
wjia@webrtc.orgb1193692013-01-12 01:52:07 +0000311 ['clang!=1', {
312 # The Android NDK doesn't provide optimized versions of these
313 # functions. Ensure they are disabled for all compilers.
314 'cflags': [
315 '-fno-builtin-cos',
316 '-fno-builtin-sin',
317 '-fno-builtin-cosf',
318 '-fno-builtin-sinf',
319 ],
320 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000321 ],
322 }],
323 ], # conditions
sergeyu@chromium.org6ebfd342013-05-22 18:22:21 +0000324 'direct_dependent_settings': {
325 'include_dirs': [
326 '../..',
327 ],
328 'conditions': [
329 ['build_with_mozilla==1', {
330 'defines': [
331 # Changes settings for Mozilla build.
332 'WEBRTC_MOZILLA_BUILD',
333 ],
334 }],
335 ['build_with_chromium==1', {
336 'defines': [
337 # Changes settings for Chromium build.
338 'WEBRTC_CHROMIUM_BUILD',
339 ],
340 }],
341 ['OS=="mac"', {
342 'defines': [
343 'WEBRTC_MAC',
344 ],
345 }],
346 ['OS=="ios"', {
347 'defines': [
348 'WEBRTC_MAC',
349 'WEBRTC_IOS',
350 ],
351 }],
352 ['OS=="win"', {
353 'defines': [
354 'WEBRTC_WIN',
355 ],
356 }],
357 ['OS=="linux"', {
358 'defines': [
359 'WEBRTC_LINUX',
360 ],
361 }],
362 ['OS=="android"', {
363 'defines': [
364 'WEBRTC_LINUX',
365 'WEBRTC_ANDROID',
366 ],
367 'conditions': [
368 ['enable_android_opensl==1', {
369 'defines': [
370 'WEBRTC_ANDROID_OPENSLES',
371 ],
372 }]
373 ],
374 }],
375 ],
376 },
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000377 }, # target_defaults
378}
379