blob: 32335f9416e25fa0f7b586ee6895cbd86538fad6 [file] [log] [blame]
seanpaul@google.com1134f982011-09-15 14:24:33 +00001# conditions used in both common.gypi and skia.gyp in chromium
2#
3{
chudy@google.combbad34d2012-08-13 14:26:36 +00004 'defines': [
5 'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
mtklein@google.comdad70702013-11-20 18:06:10 +00006 'SK_SUPPORT_GPU=<(skia_gpu)',
7 'SK_SUPPORT_OPENCL=<(skia_opencl)',
jvanverth4736e142014-11-07 07:12:46 -08008 'SK_FORCE_DISTANCE_FIELD_TEXT=<(skia_force_distance_field_text)',
chudy@google.combbad34d2012-08-13 14:26:36 +00009 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000010 'conditions' : [
scroggoc0bc9132014-07-22 12:09:30 -070011 ['skia_pic', {
12 'cflags': [
13 '-fPIC',
14 ],
15 'conditions' : [
16 # FIXME: The reason we don't do this on Android is due to the way
17 # we build the executables/skia_launcher on Android. See
18 # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
19 ['skia_os != "android"', {
20 'target_conditions': [
21 [ '_type == "executable"', {
22 'cflags': [ '-fPIE' ],
23 'ldflags': [ '-pie' ],
24 }],
25 ],
26 }],
27 ],
28 }],
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000029
commit-bot@chromium.org6a106ce2014-05-20 19:02:55 +000030 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
31 [ 'skia_arch_type == "x86"', {
32 'cflags': [
33 '-msse2',
34 '-mfpmath=sse',
35 ],
36 }],
37
borenet@google.coma72aef82013-03-22 13:16:06 +000038 [ 'skia_os == "win"',
seanpaul@google.com1134f982011-09-15 14:24:33 +000039 {
40 'defines': [
41 'SK_BUILD_FOR_WIN32',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000042 '_CRT_SECURE_NO_WARNINGS',
senorblanco@chromium.org5f47a392012-07-12 00:34:39 +000043 'GR_GL_FUNCTION_TYPE=__stdcall',
seanpaul@google.com1134f982011-09-15 14:24:33 +000044 ],
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000045 'msvs_disabled_warnings': [
bungemanf5484442014-09-10 07:49:05 -070046 4275, # An exported class was derived from a class that was not exported
47 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
48 4355, # 'this' used in base member initializer list. Off by default in newer compilers.
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000049 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000050 'msvs_cygwin_shell': 0,
51 'msvs_settings': {
52 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000053 'WarningLevel': '3',
54 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000055 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000056 'ExceptionHandling': '0',
57 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000058 },
59 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000060 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000061 'AdditionalDependencies': [
62 'OpenGL32.lib',
63 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000064
65 # Prior to gyp r1584, the following were included automatically.
66 'kernel32.lib',
67 'gdi32.lib',
68 'winspool.lib',
69 'comdlg32.lib',
70 'advapi32.lib',
71 'shell32.lib',
72 'ole32.lib',
73 'oleaut32.lib',
74 'user32.lib',
75 'uuid.lib',
76 'odbc32.lib',
77 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +000078 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +000079 ],
80 },
81 },
82 'configurations': {
83 'Debug': {
84 'msvs_settings': {
85 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000086 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +000087 'Optimization': '0', # optimizeDisabled (/Od)
88 'PreprocessorDefinitions': ['_DEBUG'],
89 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000090 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +000091 },
92 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000093 'GenerateDebugInformation': 'true', # /DEBUG
94 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +000095 },
96 },
97 },
98 'Release': {
99 'msvs_settings': {
100 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000101 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000102 'Optimization': '<(skia_release_optimization_level)',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000103 # Changing the floating point model requires rebaseling gm images
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000104 #'FloatingPointModel': '2', # fast (/fp:fast)
105 'FavorSizeOrSpeed': '1', # speed (/Ot)
seanpaul@google.com1134f982011-09-15 14:24:33 +0000106 'PreprocessorDefinitions': ['NDEBUG'],
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000107 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000108 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
109 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000110 },
111 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000112 'GenerateDebugInformation': 'true', # /DEBUG
bungeman@google.com983297e2011-10-03 19:36:51 +0000113 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000114 },
115 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000116 },
117 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000118 # Gyp's ninja generator depends on these specially named
119 # configurations to build 64-bit on Windows.
120 # See http://skbug.com/2348
121 #
122 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
123 # OK for us to just make these inherit non-archwidth-specific
124 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000125 #
126 # See http://skbug.com/2442 : These targets cause problems in the
127 # MSVS build, so only include them if gyp is generating a ninja build.
128 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
129 'configurations': {
130 'Debug_x64': {
131 'inherit_from': ['Debug'],
bsalomon6740feb2014-11-13 13:47:06 -0800132 'msvs_settings': {
133 'VCCLCompilerTool': {
134 # /ZI is not supported on 64bit
135 'DebugInformationFormat': '3', # programDatabase (/Zi)
136 },
137 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000138 },
139 'Release_x64': {
140 'inherit_from': ['Release'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800141 'msvs_settings': {
142 'VCCLCompilerTool': {
143 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
144 'EnableEnhancedInstructionSet': '0', #
145 },
146 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000147 },
148 'Release_Developer_x64': {
149 'inherit_from': ['Release_Developer'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800150 'msvs_settings': {
151 'VCCLCompilerTool': {
152 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
153 'EnableEnhancedInstructionSet': '0', #
154 },
155 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000156 },
157 },
158 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000159 [ 'skia_arch_width == 64', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000160 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000161 }],
162 [ 'skia_arch_width == 32', {
163 'msvs_configuration_platform': 'Win32',
164 }],
165 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000166 'msvs_settings': {
167 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000168 'WarnAsError': 'true',
169 'AdditionalOptions': [
170 '/we4189', # initialized but unused var warning
171 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000172 },
173 },
borenet@google.comb7961192012-08-20 18:58:26 +0000174 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000175 [ 'skia_win_exceptions', {
176 'msvs_settings': {
177 'VCCLCompilerTool': {
178 'AdditionalOptions': [
179 '/EHsc',
180 ],
181 },
182 },
183 }],
bsalomonda07a082014-06-26 12:56:28 -0700184 [ 'skia_win_ltcg', {
185 'configurations': {
186 'Release': {
187 'msvs_settings': {
188 'VCCLCompilerTool': {
189 'WholeProgramOptimization': 'true', #/GL
190 },
191 'VCLinkerTool': {
192 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
193 },
194 'VCLibrarianTool': {
195 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
196 },
197 },
198 },
199 },
200 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000201 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000202 },
203 ],
204
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000205 # The following section is common to linux + derivatives and android
206 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
207 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000208 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000209 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000210 '-fno-exceptions',
211 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000212
mtklein@google.comf1077f92013-11-20 15:13:49 +0000213 '-Wall',
214 '-Wextra',
215 '-Winit-self',
216 '-Wpointer-arith',
217
Derek Sollenberger122f9ec2014-07-16 15:20:01 -0400218 '-Wno-c++11-extensions',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000219 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000220 ],
221 'cflags_cc': [
222 '-fno-rtti',
223 '-Wnon-virtual-dtor',
mtklein24ad0962014-06-17 11:47:40 -0700224 '-Wno-invalid-offsetof', # GCC <4.6 is old-school strict about what is POD.
mtklein@google.comf1077f92013-11-20 15:13:49 +0000225 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000226 'conditions': [
qiankun.miaod312a042014-07-07 09:47:24 -0700227 [ 'skia_os != "chromeos"', {
228 'conditions': [
229 [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
230 'cflags': [
231 '-m64',
232 ],
233 'ldflags': [
234 '-m64',
235 ],
236 }],
237 [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
238 'cflags': [
239 '-m32',
240 ],
241 'ldflags': [
242 '-m32',
243 ],
244 }],
245 ],
246 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000247 [ 'skia_warnings_as_errors', {
248 'cflags': [
249 '-Werror',
250 ],
251 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000252 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
253 [ 'skia_disable_inlining', {
254 'cflags': [
255 '-fno-inline',
256 '-fno-default-inline',
257 '-finline-limit=0',
258 '-fno-omit-frame-pointer',
259 ],
260 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000261 [ 'skia_arch_type == "arm" and arm_thumb == 1', {
262 'cflags': [
263 '-mthumb',
264 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000265 # The --fix-cortex-a8 switch enables a link-time workaround for
266 # an erratum in certain Cortex-A8 processors. The workaround is
267 # enabled by default if you target the ARM v7-A arch profile.
268 # It can be enabled otherwise by specifying --fix-cortex-a8, or
269 # disabled unconditionally by specifying --no-fix-cortex-a8.
270 #
271 # The erratum only affects Thumb-2 code.
272 'conditions': [
273 [ 'arm_version < 7', {
274 'ldflags': [
275 '-Wl,--fix-cortex-a8',
276 ],
277 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000278 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000279 }],
280 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000281 'cflags': [
282 '-march=armv7-a',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000283 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000284 'ldflags': [
285 '-march=armv7-a',
286 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000287 'conditions': [
288 [ 'arm_neon == 1', {
289 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700290 'SK_ARM_HAS_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000291 ],
292 'cflags': [
293 '-mfpu=neon',
294 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000295 }],
296 [ 'arm_neon_optional == 1', {
297 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700298 'SK_ARM_HAS_OPTIONAL_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000299 ],
300 }],
mtklein19996ed2014-11-21 06:48:43 -0800301 [ 'skia_os != "chromeos" and skia_os != "linux"', {
borenet@google.come2b90372013-07-11 18:46:30 +0000302 'cflags': [
303 '-mfloat-abi=softfp',
304 ],
305 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000306 ],
307 }],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700308 [ 'skia_arch_type == "mips"', {
309 'cflags': [
310 '-EL',
311 ],
312 'conditions': [
313 [ 'mips_arch_variant == "mips32r2"', {
314 'cflags': [
315 '-march=mips32r2',
316 ],
317 'conditions': [
318 [ 'mips_dsp == 1', {
319 'cflags': [
320 '-mdsp',
321 ],
djordje.pesut6336f7c2014-07-14 07:48:11 -0700322 'defines': [
323 'SK_MIPS_HAS_DSP',
324 ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700325 }],
326 [ 'mips_dsp == 2', {
327 'cflags': [
328 '-mdspr2',
329 ],
djordje.pesut632a4542014-06-11 06:56:10 -0700330 'defines': [
djordje.pesut6336f7c2014-07-14 07:48:11 -0700331 'SK_MIPS_HAS_DSP',
332 'SK_MIPS_HAS_DSPR2',
djordje.pesut632a4542014-06-11 06:56:10 -0700333 ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700334 }],
335 ],
336 }],
337 ],
338 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000339 ],
340 },
341 ],
342
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000343 ['skia_android_framework', {
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000344 'includes' : [
345 'skia_for_android_framework_defines.gypi',
346 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000347 'cflags': [
348 # Skia does not enforce this usage pattern so we disable it here to avoid
349 # unecessary log spew when building
350 '-Wno-unused-parameter',
351
352 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
353 # Revert to -D_FORTIFY_SOURCE=1
354 '-U_FORTIFY_SOURCE',
355 '-D_FORTIFY_SOURCE=1',
356 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000357 # Remove flags which are either unnecessary or problematic for the
358 # Android framework build. Many of these flags are removed simply because
359 # they were not previously in the Android framework makefile, and we did
360 # did not intend to add them when generating the makefile.
361 # TODO (scroggo): Investigate whether any of these flags are actually
362 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000363 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000364 # Android has one makefile, used for both debugging (after manual
365 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000366 '-g',
367 '-march=armv7-a',
368 '-mthumb',
369 '-mfpu=neon',
370 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000371 '-fno-exceptions',
372 '-fstrict-aliasing',
373 # Remove flags to turn on warnings, since most people building Android
374 # are not focused on Skia and do not need the extra warning info.
375 '-Wall',
376 '-Wextra',
377 '-Winit-self',
378 '-Wpointer-arith',
379 ],
380 'cflags_cc!': [
381 '-fno-rtti',
382 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000383 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000384 'defines': [
385 'DCT_IFAST_SUPPORTED',
386 # using freetype's embolden allows us to adjust fake bold settings at
387 # draw-time, at which point we know which SkTypeface is being drawn
388 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000389 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
390 # When built as part of the system image we can enable certian non-NDK
391 # compliant optimizations.
392 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000393 # Optimizations for chromium (m30)
394 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
395 'IGNORE_ROT_AA_RECT_OPT',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000396 'SkLONGLONG int64_t',
397 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000398 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700399 'SK_IGNORE_ETC1_SUPPORT',
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000400 # Defines from skia_for_android_framework_defines.gypi
401 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000402 ],
403 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000404
borenet@google.com05d550e2013-06-11 15:52:19 +0000405 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000406 {
407 'defines': [
408 'SK_SAMPLES_FOR_X',
409 'SK_BUILD_FOR_UNIX',
410 ],
411 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000412 'Coverage': {
mtklein@google.comdad70702013-11-20 18:06:10 +0000413 'cflags': ['--coverage'],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000414 'ldflags': ['--coverage'],
415 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000416 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000417 },
418 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000419 'cflags': [
420 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000421 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000422 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000423 },
424 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000425 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000426 [ 'skia_shared_lib', {
zachr@google.com28c27c82013-06-20 17:15:05 +0000427 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000428 'SKIA_DLL',
429 'SKIA_IMPLEMENTATION=1',
430 ],
431 }],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000432 [ 'skia_os == "nacl"', {
433 'defines': [
434 'SK_BUILD_FOR_NACL',
435 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000436 'variables': {
commit-bot@chromium.org25595ed2014-04-04 18:16:04 +0000437 'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000438 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000439 'link_settings': {
440 'libraries': [
441 '-lppapi',
442 '-lppapi_cpp',
443 '-lnosys',
444 '-pthread',
445 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000446 'ldflags': [
447 '-L<(nacl_sdk_root)/lib/newlib_x86_<(skia_arch_width)/Release',
448 '-L<(nacl_sdk_root)/ports/lib/newlib_x86_<(skia_arch_width)/Release',
449 ],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000450 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000451 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000452 # Enable asan, tsan, etc.
453 [ 'skia_sanitizer', {
borenet@google.com0d193092013-07-03 15:55:05 +0000454 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000455 '-fsanitize=<(skia_sanitizer)',
borenet@google.com0d193092013-07-03 15:55:05 +0000456 ],
457 'ldflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000458 '-fsanitize=<(skia_sanitizer)',
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000459 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000460 'conditions' : [
461 [ 'skia_sanitizer == "thread"', {
mtklein0faaac62014-12-15 13:38:07 -0800462 'defines': [ 'DYNAMIC_ANNOTATIONS_ENABLED=1' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000463 }],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000464 [ 'skia_sanitizer == "undefined"', {
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000465 'cflags_cc!': ['-fno-rtti'],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000466 }],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000467 ],
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000468 }],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000469 [ 'skia_clang_build', {
mtklein170e00d2014-06-30 12:33:11 -0700470 'cflags_cc': [
mtklein94c41512014-09-12 17:07:34 -0700471 # Build in C++11 mode to make sure we'll have an easy time switching.
472 '-std=c++11',
mtklein170e00d2014-06-30 12:33:11 -0700473 '-Wno-unknown-warning-option', # Allows unknown warnings.
474 '-Wno-deprecated', # From Qt, via debugger (older Clang).
475 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
476 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000477 'cflags': [
mtklein170e00d2014-06-30 12:33:11 -0700478 # Extra warnings we like but that only Clang knows about.
479 '-Wstring-conversion',
borenet@google.com47ae4b02013-08-21 18:02:50 +0000480 ],
commit-bot@chromium.org815d3602014-05-20 19:42:03 +0000481 'cflags!': [
482 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
483 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000484 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000485 [ 'skia_keep_frame_pointer', {
486 'cflags': [ '-fno-omit-frame-pointer' ],
487 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000488 ],
489 },
490 ],
491
borenet@google.coma72aef82013-03-22 13:16:06 +0000492 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000493 {
mtkleina34633f2014-08-19 13:32:59 -0700494 'defines': [ 'SK_BUILD_FOR_MAC' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000495 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000496 'Coverage': {
497 'xcode_settings': {
498 'GCC_OPTIMIZATION_LEVEL': '0',
499 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
500 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
501 },
502 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000503 'Debug': {
mtkleina34633f2014-08-19 13:32:59 -0700504 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0' },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000505 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000506 'Release': {
mtkleina34633f2014-08-19 13:32:59 -0700507 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)', },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000508 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000509 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000510 },
511 'xcode_settings': {
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000512 'conditions': [
mtkleina34633f2014-08-19 13:32:59 -0700513 [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
514 [ 'skia_arch_width == 32', { 'ARCHS': ['i386'] }],
515 [ 'skia_arch_width == 64', { 'ARCHS': ['x86_64'] }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000516 [ 'skia_osx_deployment_target==""', {
mtkleina34633f2014-08-19 13:32:59 -0700517 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in env to ld.
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000518 }, {
519 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
520 }],
521 ],
mtklein94c41512014-09-12 17:07:34 -0700522 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
523 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
524 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
mtklein335a0ae2014-10-13 12:32:34 -0700525 'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks
526 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings
527 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
mtkleina34633f2014-08-19 13:32:59 -0700528 'WARNING_CFLAGS': [
529 '-Wall',
530 '-Wextra',
531 '-Wno-unused-parameter',
532 '-Wno-uninitialized', # Disabled because we think GCC 4.2 is bad at this.
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000533 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000534 },
535 },
536 ],
537
borenet@google.coma72aef82013-03-22 13:16:06 +0000538 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000539 {
540 'defines': [
541 'SK_BUILD_FOR_IOS',
542 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000543 'conditions' : [
544 [ 'skia_warnings_as_errors', {
545 'xcode_settings': {
546 'OTHER_CPLUSPLUSFLAGS': [
547 '-Werror',
548 ],
549 },
550 }],
551 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000552 'configurations': {
553 'Debug': {
554 'xcode_settings': {
555 'GCC_OPTIMIZATION_LEVEL': '0',
556 },
557 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000558 'Release': {
559 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000560 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000561 },
562 'defines': [ 'NDEBUG' ],
563 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000564 },
565 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000566 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000567 'CODE_SIGNING_REQUIRED': 'NO',
568 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000569 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000570 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000571 'TARGETED_DEVICE_FAMILY': '1,2',
mtklein335a0ae2014-10-13 12:32:34 -0700572 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
borenet@google.coma72aef82013-03-22 13:16:06 +0000573 'OTHER_CPLUSPLUSFLAGS': [
574 '-fvisibility=hidden',
575 '-fvisibility-inlines-hidden',
576 ],
bsalomon@google.com89dec582012-09-28 18:33:11 +0000577 'GCC_THUMB_SUPPORT': 'NO',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000578 },
579 },
580 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000581
borenet@google.coma72aef82013-03-22 13:16:06 +0000582 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000583 {
584 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000585 'SK_BUILD_FOR_ANDROID',
djsollen@google.com968757e2014-04-11 13:09:21 +0000586
587 # Android Text Tuning
588 'SK_GAMMA_EXPONENT=1.4',
589 'SK_GAMMA_CONTRAST=0.0',
590 ],
591 # Android defines a fixed gamma exponent instead of using SRGB
592 'defines!': [
593 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000594 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000595 'configurations': {
596 'Debug': {
mtkleinc0591ca2014-11-21 14:42:35 -0800597 'cflags': ['-g']
scroggo@google.comeb629502014-02-04 16:08:48 +0000598 },
599 'Release': {
600 'cflags': ['-O2'],
scroggo@google.comeb629502014-02-04 16:08:48 +0000601 },
602 },
djsollen@google.com58629292011-11-03 13:08:29 +0000603 'libraries': [
djsollen@google.com318cf922011-11-08 19:03:43 +0000604 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000605 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000606 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000607 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000608 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000609 'conditions': [
djsollenbc893292014-07-24 13:53:56 -0700610 [ 'skia_arch_type == "x86"', {
611 'cflags': [
612 '-mssse3',
613 ],
614 }],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000615 [ 'skia_android_framework', {
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000616 'cflags!': [
617 '-fuse-ld=gold',
618 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000619 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000620 [ 'skia_shared_lib', {
djsollen@google.com52f02972013-06-03 12:10:19 +0000621 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000622 'SKIA_DLL',
623 'SKIA_IMPLEMENTATION=1',
scroggoecce60b2014-07-09 07:26:40 -0700624 # Needed until we fix skbug.com/2440.
625 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
djsollen@google.com52f02972013-06-03 12:10:19 +0000626 ],
627 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000628 [ 'skia_profile_enabled == 1', {
629 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000630 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000631 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000632 },
633 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000634
digit@google.com1771cbf2012-01-26 21:26:40 +0000635 # We can POD-style initialization of static mutexes to avoid generating
636 # static initializers if we're using a pthread-compatible thread interface.
637 [ 'skia_os != "win"', {
638 'defines': [
borenet@google.com7158e6a2012-11-01 17:43:44 +0000639 'SK_USE_POSIX_THREADS',
digit@google.com1771cbf2012-01-26 21:26:40 +0000640 ],
641 }],
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000642
643 [ 'skia_moz2d', {
644 'defines': [
reed6518eaa2014-06-18 14:05:22 -0700645 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000646 ],
647 }],
648
mtkleina7e930f2014-08-06 10:08:42 -0700649 [ 'skia_is_bot', {
mtklein4d1605a2014-07-10 14:16:04 -0700650 'defines': [ 'SK_CRASH_HANDLER' ],
651 }],
652
seanpaul@google.com1134f982011-09-15 14:24:33 +0000653 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000654 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
655 'xcode_settings': {
656 'SYMROOT': '<(DEPTH)/xcodebuild',
657 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000658}