blob: b9ef9b20826a42bd021189a30f3bfd381d070678 [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,
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000020 'build_with_libjingle%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000021 },
22 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000023 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000024
25 'conditions': [
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000026 ['build_with_chromium==1 or build_with_libjingle==1', {
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000027 'webrtc_root%': '<(DEPTH)/third_party/webrtc',
28 }, {
29 'webrtc_root%': '<(DEPTH)/webrtc',
30 }],
31 ],
32 },
33 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000034 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000035 'webrtc_root%': '<(webrtc_root)',
36
37 'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
leozwang@webrtc.org6f19b1b2012-10-27 17:46:55 +000038 'include_opus%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000039 },
40 'build_with_chromium%': '<(build_with_chromium)',
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +000041 'build_with_libjingle%': '<(build_with_libjingle)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000042 'webrtc_root%': '<(webrtc_root)',
43 'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
44 'include_opus%': '<(include_opus)',
45
46 # The Chromium common.gypi we use treats all gyp files without
47 # chromium_code==1 as third party code. This disables many of the
48 # preferred warning settings.
49 #
50 # We can set this here to have WebRTC code treated as Chromium code. Our
51 # third party code will still have the reduced warning settings.
52 'chromium_code': 1,
53
54 # Adds video support to dependencies shared by voice and video engine.
55 # This should normally be enabled; the intended use is to disable only
56 # when building voice engine exclusively.
57 'enable_video%': 1,
58
59 # Selects fixed-point code where possible.
60 'prefer_fixed_point%': 0,
61
62 # Enable data logging. Produces text files with data logged within engines
63 # which can be easily parsed for offline processing.
64 'enable_data_logging%': 0,
65
66 # Disable these to not build components which can be externally provided.
67 'build_libjpeg%': 1,
68 'build_libyuv%': 1,
69 'build_libvpx%': 1,
70
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +000071 # Enable to use the Mozilla internal settings.
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000072 'build_with_mozilla%': 0,
73
74 'libyuv_dir%': '<(DEPTH)/third_party/libyuv',
75
andrew@webrtc.org5140e242013-02-21 20:12:21 +000076 # Define MIPS architecture variant, MIPS DSP variant and MIPS FPU
77 # This may be subject to change in accordance to Chromium's MIPS flags
78 'mips_arch_variant%': 'mips32r1',
79 'mips_dsp_rev%': 0,
80 'mips_fpu%' : 1,
81
andrew@webrtc.org14b43be2012-10-22 18:19:23 +000082 'conditions': [
83 ['build_with_chromium==1', {
84 # Exclude pulse audio on Chromium since its prerequisites don't require
85 # pulse audio.
86 'include_pulse_audio%': 0,
87
88 # Exclude internal ADM since Chromium uses its own IO handling.
89 'include_internal_audio_device%': 0,
90
91 # Exclude internal VCM in Chromium build.
92 'include_internal_video_capture%': 0,
93
94 # Exclude internal video render module in Chromium build.
95 'include_internal_video_render%': 0,
96
97 'include_video_engine_file_api%': 0,
98
99 'include_tests%': 0,
100
101 # Disable the use of protocol buffers in production code.
102 'enable_protobuf%': 0,
103
andrew@webrtc.org50419b02012-11-14 19:07:54 +0000104 'enable_tracing%': 0,
105
wjia@webrtc.org5c38d902012-11-19 01:41:59 +0000106 'enable_android_opensl%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000107 }, { # Settings for the standalone (not-in-Chromium) build.
108 'include_pulse_audio%': 1,
109 'include_internal_audio_device%': 1,
110 'include_internal_video_capture%': 1,
111 'include_internal_video_render%': 1,
112 'include_video_engine_file_api%': 1,
113 'enable_protobuf%': 1,
andrew@webrtc.org50419b02012-11-14 19:07:54 +0000114 'enable_tracing%': 1,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000115 'include_tests%': 1,
116
117 # 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
122 # Switch between Android audio device OpenSL ES implementation
123 # and Java Implementation
leozwang@webrtc.org56a1c2c2012-11-29 03:13:00 +0000124 'enable_android_opensl%': 0,
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000125 }],
126 ['OS=="ios"', {
127 'enable_video%': 0,
128 'enable_protobuf%': 0,
129 'build_libjpeg%': 0,
130 'build_libyuv%': 0,
131 'build_libvpx%': 0,
132 'include_tests%': 0,
133 }],
fischman@webrtc.orgf61e02c2013-02-20 23:13:46 +0000134 ['build_with_libjingle==1', {
135 'include_tests%': 0,
136 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000137 ['target_arch=="arm"', {
138 'prefer_fixed_point%': 1,
139 }],
140 ], # conditions
141 },
142 'target_defaults': {
143 'include_dirs': [
andrew@webrtc.orgbe8ec382012-10-22 21:51:58 +0000144 # TODO(andrew): Remove '..' when we've added webrtc/ to include paths.
145 '..',
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000146 # Allow includes to be prefixed with webrtc/ in case it is not an
147 # immediate subdirectory of <(DEPTH).
andrew@webrtc.orgbe8ec382012-10-22 21:51:58 +0000148 '../..',
kjellander@webrtc.orge1888af2013-01-28 20:00:03 +0000149 # To include the top-level directory when building in Chrome, so we can
150 # use full paths (e.g. headers inside testing/ or third_party/).
151 '<(DEPTH)',
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000152 ],
153 'defines': [
154 # TODO(leozwang): Run this as a gclient hook rather than at build-time:
155 # http://code.google.com/p/webrtc/issues/detail?id=687
156 'WEBRTC_SVNREVISION="Unavailable(issue687)"',
157 #'WEBRTC_SVNREVISION="<!(python <(webrtc_root)/build/version.py)"',
158 ],
159 'conditions': [
andrew@webrtc.orgc3e5d342012-11-23 19:30:59 +0000160 ['enable_tracing==1', {
161 'defines': ['WEBRTC_LOGGING',],
162 }],
tina.legrand@webrtc.org1f8c02a2012-10-25 12:37:08 +0000163 ['build_with_mozilla==1', {
164 'defines': [
165 # Changes settings for Mozilla build.
166 'WEBRTC_MOZILLA_BUILD',
167 ],
168 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000169 ['build_with_chromium==1', {
170 'defines': [
171 # Changes settings for Chromium build.
172 'WEBRTC_CHROMIUM_BUILD',
173 ],
174 }, {
175 'conditions': [
176 ['os_posix==1', {
177 'cflags': [
178 '-Wextra',
179 # We need to repeat some flags from Chromium's common.gypi here
180 # that get overridden by -Wextra.
181 '-Wno-unused-parameter',
182 '-Wno-missing-field-initializers',
183 ],
184 'cflags_cc': [
185 # This is enabled for clang; enable for gcc as well.
186 '-Woverloaded-virtual',
187 ],
188 }],
189 ],
190 }],
191 ['target_arch=="arm"', {
192 'defines': [
193 'WEBRTC_ARCH_ARM',
194 ],
195 'conditions': [
196 ['armv7==1', {
197 'defines': ['WEBRTC_ARCH_ARM_V7',],
198 'conditions': [
199 ['arm_neon==1', {
200 'defines': ['WEBRTC_ARCH_ARM_NEON',],
201 }, {
202 'defines': ['WEBRTC_DETECT_ARM_NEON',],
203 }],
204 ],
205 }],
206 ],
207 }],
andrew@webrtc.org5140e242013-02-21 20:12:21 +0000208 ['target_arch=="mipsel"', {
209 'defines': [
210 'MIPS32_LE',
211 ],
212 'conditions': [
213 ['mips_fpu==1', {
214 'defines': [
215 'MIPS_FPU_LE',
216 ],
217 'cflags': [
218 '-mhard-float',
219 ],
220 }, {
221 'cflags': [
222 '-msoft-float',
223 ],
224 }],
225 ['mips_arch_variant=="mips32r2"', {
226 'defines': [
227 'MIPS32_R2_LE',
228 ],
229 'cflags': [
230 '-mips32r2',
231 ],
232 'cflags_cc': [
233 '-mips32r2',
234 ],
235 }],
236 ['mips_dsp_rev==1', {
237 'defines': [
238 'MIPS_DSP_R1_LE',
239 ],
240 'cflags': [
241 '-mdsp',
242 ],
243 'cflags_cc': [
244 '-mdsp',
245 ],
246 }],
247 ['mips_dsp_rev==2', {
248 'defines': [
249 'MIPS_DSP_R1_LE',
250 'MIPS_DSP_R2_LE',
251 ],
252 'cflags': [
253 '-mdspr2',
254 ],
255 'cflags_cc': [
256 '-mdspr2',
257 ],
258 }],
259 ],
260 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000261 ['OS=="ios"', {
262 'defines': [
263 'WEBRTC_MAC',
264 'WEBRTC_IOS',
265 'WEBRTC_THREAD_RR',
266 'WEBRTC_CLOCK_TYPE_REALTIME',
267 ],
268 }],
269 ['OS=="linux"', {
270 'defines': [
271 'WEBRTC_LINUX',
272 'WEBRTC_THREAD_RR',
273 # TODO(andrew): can we select this automatically?
274 # Define this if the Linux system does not support CLOCK_MONOTONIC.
275 #'WEBRTC_CLOCK_TYPE_REALTIME',
276 ],
277 }],
278 ['OS=="mac"', {
279 'defines': [
280 'WEBRTC_MAC',
281 'WEBRTC_THREAD_RR',
282 'WEBRTC_CLOCK_TYPE_REALTIME',
283 ],
284 }],
285 ['OS=="win"', {
286 'defines': [
287 'WEBRTC_WIN',
288 ],
289 # TODO(andrew): enable all warnings when possible.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000290 # TODO(phoglund): get rid of 4373 supression when
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000291 # http://code.google.com/p/webrtc/issues/detail?id=261 is solved.
kjellander@webrtc.orgfa53d872013-02-04 10:07:17 +0000292 'msvs_disabled_warnings': [
293 4373, # legacy warning for ignoring const / volatile in signatures.
294 4389, # Signed/unsigned mismatch.
295 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000296 # Re-enable some warnings that Chromium disables.
297 'msvs_disabled_warnings!': [4189,],
298 }],
299 ['OS=="android"', {
300 'defines': [
301 'WEBRTC_LINUX',
302 'WEBRTC_ANDROID',
303 # TODO(leozwang): Investigate CLOCK_REALTIME and CLOCK_MONOTONIC
304 # support on Android. Keep WEBRTC_CLOCK_TYPE_REALTIME for now,
305 # remove it after I verify that CLOCK_MONOTONIC is fully functional
306 # with condition and event functions in system_wrappers.
307 'WEBRTC_CLOCK_TYPE_REALTIME',
308 'WEBRTC_THREAD_RR',
309 ],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000310 'conditions': [
311 ['enable_android_opensl==1', {
312 'defines': [
313 'WEBRTC_ANDROID_OPENSLES',
314 ],
315 }],
wjia@webrtc.orgb1193692013-01-12 01:52:07 +0000316 ['clang!=1', {
317 # The Android NDK doesn't provide optimized versions of these
318 # functions. Ensure they are disabled for all compilers.
319 'cflags': [
320 '-fno-builtin-cos',
321 '-fno-builtin-sin',
322 '-fno-builtin-cosf',
323 '-fno-builtin-sinf',
324 ],
325 }],
andrew@webrtc.org14b43be2012-10-22 18:19:23 +0000326 ],
327 }],
328 ], # conditions
329 }, # target_defaults
330}
331