blob: 0075b250ea6a95a3c53ff8fd4c90d78e57c8c731 [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)',
commit-bot@chromium.orgae796122014-03-12 17:05:46 +00008 'SK_FORCE_DISTANCEFIELD_FONTS=<(skia_force_distancefield_fonts)',
mtkleinc92e5502014-08-21 13:07:27 -07009 'SK_PICTURE_USE_SK_RECORD',
chudy@google.combbad34d2012-08-13 14:26:36 +000010 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000011 'conditions' : [
scroggoc0bc9132014-07-22 12:09:30 -070012 ['skia_pic', {
13 'cflags': [
14 '-fPIC',
15 ],
16 'conditions' : [
17 # FIXME: The reason we don't do this on Android is due to the way
18 # we build the executables/skia_launcher on Android. See
19 # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
20 ['skia_os != "android"', {
21 'target_conditions': [
22 [ '_type == "executable"', {
23 'cflags': [ '-fPIE' ],
24 'ldflags': [ '-pie' ],
25 }],
26 ],
27 }],
28 ],
29 }],
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000030
commit-bot@chromium.org6a106ce2014-05-20 19:02:55 +000031 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
32 [ 'skia_arch_type == "x86"', {
33 'cflags': [
34 '-msse2',
35 '-mfpmath=sse',
36 ],
37 }],
38
borenet@google.coma72aef82013-03-22 13:16:06 +000039 [ 'skia_os == "win"',
seanpaul@google.com1134f982011-09-15 14:24:33 +000040 {
41 'defines': [
42 'SK_BUILD_FOR_WIN32',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000043 '_CRT_SECURE_NO_WARNINGS',
senorblanco@chromium.org5f47a392012-07-12 00:34:39 +000044 'GR_GL_FUNCTION_TYPE=__stdcall',
seanpaul@google.com1134f982011-09-15 14:24:33 +000045 ],
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000046 'msvs_disabled_warnings': [
47 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
48 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000049 'msvs_cygwin_shell': 0,
Brian Salomon08fe0132014-06-17 17:28:17 -040050 'msvs_disabled_warnings': [4275],
seanpaul@google.com1134f982011-09-15 14:24:33 +000051 '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'],
132 },
133 'Release_x64': {
134 'inherit_from': ['Release'],
135 },
136 'Release_Developer_x64': {
137 'inherit_from': ['Release_Developer'],
138 },
139 },
140 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000141 [ 'skia_arch_width == 64', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000142 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000143 }],
144 [ 'skia_arch_width == 32', {
145 'msvs_configuration_platform': 'Win32',
146 }],
147 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000148 'msvs_settings': {
149 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000150 'WarnAsError': 'true',
151 'AdditionalOptions': [
152 '/we4189', # initialized but unused var warning
153 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000154 },
155 },
borenet@google.comb7961192012-08-20 18:58:26 +0000156 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000157 [ 'skia_win_exceptions', {
158 'msvs_settings': {
159 'VCCLCompilerTool': {
160 'AdditionalOptions': [
161 '/EHsc',
162 ],
163 },
164 },
165 }],
bsalomonda07a082014-06-26 12:56:28 -0700166 [ 'skia_win_ltcg', {
167 'configurations': {
168 'Release': {
169 'msvs_settings': {
170 'VCCLCompilerTool': {
171 'WholeProgramOptimization': 'true', #/GL
172 },
173 'VCLinkerTool': {
174 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
175 },
176 'VCLibrarianTool': {
177 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
178 },
179 },
180 },
181 },
182 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000183 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000184 },
185 ],
186
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000187 # The following section is common to linux + derivatives and android
188 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
189 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000190 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000191 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000192 '-fno-exceptions',
193 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000194
mtklein@google.comf1077f92013-11-20 15:13:49 +0000195 '-Wall',
196 '-Wextra',
197 '-Winit-self',
198 '-Wpointer-arith',
199
Derek Sollenberger122f9ec2014-07-16 15:20:01 -0400200 '-Wno-c++11-extensions',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000201 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000202 ],
203 'cflags_cc': [
204 '-fno-rtti',
205 '-Wnon-virtual-dtor',
mtklein24ad0962014-06-17 11:47:40 -0700206 '-Wno-invalid-offsetof', # GCC <4.6 is old-school strict about what is POD.
mtklein@google.comf1077f92013-11-20 15:13:49 +0000207 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000208 'conditions': [
qiankun.miaod312a042014-07-07 09:47:24 -0700209 [ 'skia_os != "chromeos"', {
210 'conditions': [
211 [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
212 'cflags': [
213 '-m64',
214 ],
215 'ldflags': [
216 '-m64',
217 ],
218 }],
219 [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
220 'cflags': [
221 '-m32',
222 ],
223 'ldflags': [
224 '-m32',
225 ],
226 }],
227 ],
228 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000229 [ 'skia_warnings_as_errors', {
230 'cflags': [
231 '-Werror',
232 ],
233 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000234 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
235 [ 'skia_disable_inlining', {
236 'cflags': [
237 '-fno-inline',
238 '-fno-default-inline',
239 '-finline-limit=0',
240 '-fno-omit-frame-pointer',
241 ],
242 }],
djsollen74364c92014-09-03 10:44:00 -0700243 [ 'skia_arch_type == "arm64"', {
244 # this flag causes tiling errors with GCC 4.9 (pre-release) toolchain
245 # see skbug.com/
246 'cflags': [
247 '-fno-expensive-optimizations'
248 ],
249 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000250 [ 'skia_arch_type == "arm" and arm_thumb == 1', {
251 'cflags': [
252 '-mthumb',
253 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000254 # The --fix-cortex-a8 switch enables a link-time workaround for
255 # an erratum in certain Cortex-A8 processors. The workaround is
256 # enabled by default if you target the ARM v7-A arch profile.
257 # It can be enabled otherwise by specifying --fix-cortex-a8, or
258 # disabled unconditionally by specifying --no-fix-cortex-a8.
259 #
260 # The erratum only affects Thumb-2 code.
261 'conditions': [
262 [ 'arm_version < 7', {
263 'ldflags': [
264 '-Wl,--fix-cortex-a8',
265 ],
266 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000267 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000268 }],
269 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000270 'cflags': [
271 '-march=armv7-a',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000272 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000273 'ldflags': [
274 '-march=armv7-a',
275 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000276 'conditions': [
277 [ 'arm_neon == 1', {
278 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700279 'SK_ARM_HAS_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000280 ],
281 'cflags': [
282 '-mfpu=neon',
283 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000284 }],
285 [ 'arm_neon_optional == 1', {
286 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700287 'SK_ARM_HAS_OPTIONAL_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000288 ],
289 }],
borenet@google.come2b90372013-07-11 18:46:30 +0000290 [ 'skia_os != "chromeos"', {
291 'cflags': [
292 '-mfloat-abi=softfp',
293 ],
294 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000295 ],
296 }],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700297 [ 'skia_arch_type == "mips"', {
298 'cflags': [
299 '-EL',
300 ],
301 'conditions': [
302 [ 'mips_arch_variant == "mips32r2"', {
303 'cflags': [
304 '-march=mips32r2',
305 ],
306 'conditions': [
307 [ 'mips_dsp == 1', {
308 'cflags': [
309 '-mdsp',
310 ],
djordje.pesut6336f7c2014-07-14 07:48:11 -0700311 'defines': [
312 'SK_MIPS_HAS_DSP',
313 ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700314 }],
315 [ 'mips_dsp == 2', {
316 'cflags': [
317 '-mdspr2',
318 ],
djordje.pesut632a4542014-06-11 06:56:10 -0700319 'defines': [
djordje.pesut6336f7c2014-07-14 07:48:11 -0700320 'SK_MIPS_HAS_DSP',
321 'SK_MIPS_HAS_DSPR2',
djordje.pesut632a4542014-06-11 06:56:10 -0700322 ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700323 }],
324 ],
325 }],
326 ],
327 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000328 ],
329 },
330 ],
331
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000332 ['skia_android_framework', {
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000333 'includes' : [
334 'skia_for_android_framework_defines.gypi',
335 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000336 'cflags': [
337 # Skia does not enforce this usage pattern so we disable it here to avoid
338 # unecessary log spew when building
339 '-Wno-unused-parameter',
340
341 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
342 # Revert to -D_FORTIFY_SOURCE=1
343 '-U_FORTIFY_SOURCE',
344 '-D_FORTIFY_SOURCE=1',
345 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000346 # Remove flags which are either unnecessary or problematic for the
347 # Android framework build. Many of these flags are removed simply because
348 # they were not previously in the Android framework makefile, and we did
349 # did not intend to add them when generating the makefile.
350 # TODO (scroggo): Investigate whether any of these flags are actually
351 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000352 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000353 # Android has one makefile, used for both debugging (after manual
354 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000355 '-g',
356 '-march=armv7-a',
357 '-mthumb',
358 '-mfpu=neon',
359 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000360 '-fno-exceptions',
361 '-fstrict-aliasing',
362 # Remove flags to turn on warnings, since most people building Android
363 # are not focused on Skia and do not need the extra warning info.
364 '-Wall',
365 '-Wextra',
366 '-Winit-self',
367 '-Wpointer-arith',
368 ],
369 'cflags_cc!': [
370 '-fno-rtti',
371 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000372 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000373 'defines': [
374 'DCT_IFAST_SUPPORTED',
375 # using freetype's embolden allows us to adjust fake bold settings at
376 # draw-time, at which point we know which SkTypeface is being drawn
377 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000378 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
379 # When built as part of the system image we can enable certian non-NDK
380 # compliant optimizations.
381 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000382 # Optimizations for chromium (m30)
383 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
384 'IGNORE_ROT_AA_RECT_OPT',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000385 'SkLONGLONG int64_t',
386 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
robertphillipsa2551ff2014-06-02 12:09:29 -0700387 # Transitional, for deprecated SkCanvas::SaveFlags methods.
388 'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000389 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700390 'SK_IGNORE_ETC1_SUPPORT',
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000391 # Defines from skia_for_android_framework_defines.gypi
392 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000393 ],
394 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000395
borenet@google.com05d550e2013-06-11 15:52:19 +0000396 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000397 {
398 'defines': [
399 'SK_SAMPLES_FOR_X',
400 'SK_BUILD_FOR_UNIX',
401 ],
402 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000403 'Coverage': {
mtklein@google.comdad70702013-11-20 18:06:10 +0000404 'cflags': ['--coverage'],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000405 'ldflags': ['--coverage'],
406 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000407 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000408 },
409 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000410 'cflags': [
411 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000412 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000413 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000414 },
415 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000416 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000417 [ 'skia_shared_lib', {
zachr@google.com28c27c82013-06-20 17:15:05 +0000418 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000419 'SKIA_DLL',
420 'SKIA_IMPLEMENTATION=1',
421 ],
422 }],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000423 [ 'skia_os == "nacl"', {
424 'defines': [
425 'SK_BUILD_FOR_NACL',
426 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000427 'variables': {
commit-bot@chromium.org25595ed2014-04-04 18:16:04 +0000428 'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000429 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000430 'link_settings': {
431 'libraries': [
432 '-lppapi',
433 '-lppapi_cpp',
434 '-lnosys',
435 '-pthread',
436 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000437 'ldflags': [
438 '-L<(nacl_sdk_root)/lib/newlib_x86_<(skia_arch_width)/Release',
439 '-L<(nacl_sdk_root)/ports/lib/newlib_x86_<(skia_arch_width)/Release',
440 ],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000441 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000442 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000443 # Enable asan, tsan, etc.
444 [ 'skia_sanitizer', {
borenet@google.com0d193092013-07-03 15:55:05 +0000445 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000446 '-fsanitize=<(skia_sanitizer)',
borenet@google.com0d193092013-07-03 15:55:05 +0000447 ],
448 'ldflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000449 '-fsanitize=<(skia_sanitizer)',
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000450 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000451 'conditions' : [
452 [ 'skia_sanitizer == "thread"', {
mtklein0b544ae2014-07-08 19:37:47 -0700453 'defines': [ 'SK_DYNAMIC_ANNOTATIONS_ENABLED=1' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000454 }],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000455 [ 'skia_sanitizer == "undefined"', {
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000456 'cflags_cc!': ['-fno-rtti'],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000457 }],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000458 ],
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000459 }],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000460 [ 'skia_clang_build', {
mtklein170e00d2014-06-30 12:33:11 -0700461 'cflags_cc': [
462 # Build in C++11 mode to make sure we'll have an easy time switching.
463 '-std=c++11',
464 '-Wno-unknown-warning-option', # Allows unknown warnings.
465 '-Wno-deprecated', # From Qt, via debugger (older Clang).
466 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
467 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000468 'cflags': [
mtklein170e00d2014-06-30 12:33:11 -0700469 # Extra warnings we like but that only Clang knows about.
470 '-Wstring-conversion',
borenet@google.com47ae4b02013-08-21 18:02:50 +0000471 ],
commit-bot@chromium.org815d3602014-05-20 19:42:03 +0000472 'cflags!': [
473 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
474 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000475 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000476 [ 'skia_keep_frame_pointer', {
477 'cflags': [ '-fno-omit-frame-pointer' ],
478 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000479 ],
480 },
481 ],
482
borenet@google.coma72aef82013-03-22 13:16:06 +0000483 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000484 {
mtkleina34633f2014-08-19 13:32:59 -0700485 'defines': [ 'SK_BUILD_FOR_MAC' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000486 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000487 'Coverage': {
488 'xcode_settings': {
489 'GCC_OPTIMIZATION_LEVEL': '0',
490 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
491 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
492 },
493 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000494 'Debug': {
mtkleina34633f2014-08-19 13:32:59 -0700495 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0' },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000496 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000497 'Release': {
mtkleina34633f2014-08-19 13:32:59 -0700498 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)', },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000499 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000500 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000501 },
502 'xcode_settings': {
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000503 'conditions': [
mtkleina34633f2014-08-19 13:32:59 -0700504 [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
505 [ 'skia_arch_width == 32', { 'ARCHS': ['i386'] }],
506 [ 'skia_arch_width == 64', { 'ARCHS': ['x86_64'] }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000507 [ 'skia_osx_deployment_target==""', {
mtkleina34633f2014-08-19 13:32:59 -0700508 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in env to ld.
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000509 }, {
510 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
511 }],
512 ],
mtkleina34633f2014-08-19 13:32:59 -0700513 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
514 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
515 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
516 'WARNING_CFLAGS': [
517 '-Wall',
518 '-Wextra',
519 '-Wno-unused-parameter',
520 '-Wno-uninitialized', # Disabled because we think GCC 4.2 is bad at this.
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000521 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000522 },
523 },
524 ],
525
borenet@google.coma72aef82013-03-22 13:16:06 +0000526 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000527 {
528 'defines': [
529 'SK_BUILD_FOR_IOS',
530 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000531 'conditions' : [
532 [ 'skia_warnings_as_errors', {
533 'xcode_settings': {
534 'OTHER_CPLUSPLUSFLAGS': [
535 '-Werror',
536 ],
537 },
538 }],
539 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000540 'configurations': {
541 'Debug': {
542 'xcode_settings': {
543 'GCC_OPTIMIZATION_LEVEL': '0',
544 },
545 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000546 'Release': {
547 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000548 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000549 },
550 'defines': [ 'NDEBUG' ],
551 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000552 },
553 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000554 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000555 'CODE_SIGNING_REQUIRED': 'NO',
556 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000557 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000558 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000559 'TARGETED_DEVICE_FAMILY': '1,2',
borenet@google.coma72aef82013-03-22 13:16:06 +0000560 'OTHER_CPLUSPLUSFLAGS': [
561 '-fvisibility=hidden',
562 '-fvisibility-inlines-hidden',
563 ],
bsalomon@google.com89dec582012-09-28 18:33:11 +0000564 'GCC_THUMB_SUPPORT': 'NO',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000565 },
566 },
567 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000568
borenet@google.coma72aef82013-03-22 13:16:06 +0000569 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000570 {
571 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000572 'SK_BUILD_FOR_ANDROID',
djsollen@google.com968757e2014-04-11 13:09:21 +0000573
574 # Android Text Tuning
575 'SK_GAMMA_EXPONENT=1.4',
576 'SK_GAMMA_CONTRAST=0.0',
577 ],
578 # Android defines a fixed gamma exponent instead of using SRGB
579 'defines!': [
580 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000581 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000582 'configurations': {
583 'Debug': {
584 'cflags': ['-g']
585 },
586 'Release': {
587 'cflags': ['-O2'],
scroggo@google.comeb629502014-02-04 16:08:48 +0000588 },
589 },
djsollen@google.com58629292011-11-03 13:08:29 +0000590 'libraries': [
djsollen@google.com318cf922011-11-08 19:03:43 +0000591 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000592 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000593 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000594 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000595 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000596 'conditions': [
djsollenbc893292014-07-24 13:53:56 -0700597 [ 'skia_arch_type == "x86"', {
598 'cflags': [
599 '-mssse3',
600 ],
601 }],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000602 [ 'skia_android_framework', {
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000603 'cflags!': [
604 '-fuse-ld=gold',
605 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000606 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000607 [ 'skia_shared_lib', {
djsollen@google.com52f02972013-06-03 12:10:19 +0000608 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000609 'SKIA_DLL',
610 'SKIA_IMPLEMENTATION=1',
scroggoecce60b2014-07-09 07:26:40 -0700611 # Needed until we fix skbug.com/2440.
612 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
djsollen@google.com52f02972013-06-03 12:10:19 +0000613 ],
614 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000615 [ 'skia_profile_enabled == 1', {
616 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000617 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000618 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000619 },
620 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000621
digit@google.com1771cbf2012-01-26 21:26:40 +0000622 # We can POD-style initialization of static mutexes to avoid generating
623 # static initializers if we're using a pthread-compatible thread interface.
624 [ 'skia_os != "win"', {
625 'defines': [
borenet@google.com7158e6a2012-11-01 17:43:44 +0000626 'SK_USE_POSIX_THREADS',
digit@google.com1771cbf2012-01-26 21:26:40 +0000627 ],
628 }],
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000629
630 [ 'skia_moz2d', {
631 'defines': [
reed6518eaa2014-06-18 14:05:22 -0700632 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000633 ],
634 }],
635
mtkleina7e930f2014-08-06 10:08:42 -0700636 [ 'skia_is_bot', {
mtklein4d1605a2014-07-10 14:16:04 -0700637 'defines': [ 'SK_CRASH_HANDLER' ],
638 }],
639
seanpaul@google.com1134f982011-09-15 14:24:33 +0000640 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000641 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
642 'xcode_settings': {
643 'SYMROOT': '<(DEPTH)/xcodebuild',
644 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000645}