blob: 9642f3d3f999b6df76887803424154ff7b51d6fa [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',
mtklein1e4e8142015-02-17 13:10:43 -080042 'SK_NO_FLATE', # Too much of a pain to set up zlib on our bots.
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': [
bungemanf5484442014-09-10 07:49:05 -070047 4275, # An exported class was derived from a class that was not exported
48 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
49 4355, # 'this' used in base member initializer list. Off by default in newer compilers.
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000050 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000051 'msvs_cygwin_shell': 0,
52 'msvs_settings': {
53 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000054 'WarningLevel': '3',
55 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000056 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000057 'ExceptionHandling': '0',
58 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000059 },
60 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000061 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000062 'AdditionalDependencies': [
63 'OpenGL32.lib',
64 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000065
66 # Prior to gyp r1584, the following were included automatically.
67 'kernel32.lib',
68 'gdi32.lib',
69 'winspool.lib',
70 'comdlg32.lib',
71 'advapi32.lib',
72 'shell32.lib',
73 'ole32.lib',
74 'oleaut32.lib',
75 'user32.lib',
76 'uuid.lib',
77 'odbc32.lib',
78 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +000079 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +000080 ],
81 },
82 },
83 'configurations': {
84 'Debug': {
85 'msvs_settings': {
86 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000087 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +000088 'Optimization': '0', # optimizeDisabled (/Od)
89 'PreprocessorDefinitions': ['_DEBUG'],
90 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000091 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +000092 },
93 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000094 'GenerateDebugInformation': 'true', # /DEBUG
95 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +000096 },
97 },
98 },
99 'Release': {
100 'msvs_settings': {
101 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000102 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000103 'Optimization': '<(skia_release_optimization_level)',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000104 # Changing the floating point model requires rebaseling gm images
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000105 #'FloatingPointModel': '2', # fast (/fp:fast)
106 'FavorSizeOrSpeed': '1', # speed (/Ot)
seanpaul@google.com1134f982011-09-15 14:24:33 +0000107 'PreprocessorDefinitions': ['NDEBUG'],
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000108 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000109 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
110 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000111 },
112 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000113 'GenerateDebugInformation': 'true', # /DEBUG
bungeman@google.com983297e2011-10-03 19:36:51 +0000114 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000115 },
116 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000117 },
118 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000119 # Gyp's ninja generator depends on these specially named
120 # configurations to build 64-bit on Windows.
121 # See http://skbug.com/2348
122 #
123 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
124 # OK for us to just make these inherit non-archwidth-specific
125 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000126 #
127 # See http://skbug.com/2442 : These targets cause problems in the
128 # MSVS build, so only include them if gyp is generating a ninja build.
129 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
130 'configurations': {
131 'Debug_x64': {
132 'inherit_from': ['Debug'],
bsalomon6740feb2014-11-13 13:47:06 -0800133 'msvs_settings': {
134 'VCCLCompilerTool': {
135 # /ZI is not supported on 64bit
136 'DebugInformationFormat': '3', # programDatabase (/Zi)
137 },
138 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000139 },
140 'Release_x64': {
141 'inherit_from': ['Release'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800142 'msvs_settings': {
143 'VCCLCompilerTool': {
144 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
145 'EnableEnhancedInstructionSet': '0', #
146 },
147 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000148 },
149 'Release_Developer_x64': {
150 'inherit_from': ['Release_Developer'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800151 'msvs_settings': {
152 'VCCLCompilerTool': {
153 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
154 'EnableEnhancedInstructionSet': '0', #
155 },
156 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000157 },
158 },
159 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000160 [ 'skia_arch_width == 64', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000161 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000162 }],
163 [ 'skia_arch_width == 32', {
164 'msvs_configuration_platform': 'Win32',
165 }],
166 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000167 'msvs_settings': {
168 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000169 'WarnAsError': 'true',
170 'AdditionalOptions': [
171 '/we4189', # initialized but unused var warning
172 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000173 },
174 },
borenet@google.comb7961192012-08-20 18:58:26 +0000175 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000176 [ 'skia_win_exceptions', {
177 'msvs_settings': {
178 'VCCLCompilerTool': {
179 'AdditionalOptions': [
180 '/EHsc',
181 ],
182 },
183 },
184 }],
bsalomonda07a082014-06-26 12:56:28 -0700185 [ 'skia_win_ltcg', {
186 'configurations': {
187 'Release': {
188 'msvs_settings': {
189 'VCCLCompilerTool': {
190 'WholeProgramOptimization': 'true', #/GL
191 },
192 'VCLinkerTool': {
193 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
194 },
195 'VCLibrarianTool': {
196 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
197 },
198 },
199 },
200 },
201 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000202 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000203 },
204 ],
205
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000206 # The following section is common to linux + derivatives and android
207 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
208 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000209 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000210 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000211 '-fno-exceptions',
212 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000213
mtklein@google.comf1077f92013-11-20 15:13:49 +0000214 '-Wall',
215 '-Wextra',
216 '-Winit-self',
217 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800218 '-Wsign-compare',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000219
220 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000221 ],
222 'cflags_cc': [
mtkleinf3cdce72015-02-05 09:23:56 -0800223 '-std=c++11',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000224 '-fno-rtti',
225 '-Wnon-virtual-dtor',
mtklein24ad0962014-06-17 11:47:40 -0700226 '-Wno-invalid-offsetof', # GCC <4.6 is old-school strict about what is POD.
mtklein@google.comf1077f92013-11-20 15:13:49 +0000227 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000228 'conditions': [
qiankun.miaod312a042014-07-07 09:47:24 -0700229 [ 'skia_os != "chromeos"', {
230 'conditions': [
scroggo7cd3f642015-02-12 13:27:40 -0800231 [ 'skia_arch_type == "x86_64" and not skia_android_framework', {
qiankun.miaod312a042014-07-07 09:47:24 -0700232 'cflags': [
233 '-m64',
234 ],
235 'ldflags': [
236 '-m64',
237 ],
238 }],
scroggo7cd3f642015-02-12 13:27:40 -0800239 [ 'skia_arch_type == "x86" and not skia_android_framework', {
qiankun.miaod312a042014-07-07 09:47:24 -0700240 'cflags': [
241 '-m32',
242 ],
243 'ldflags': [
244 '-m32',
245 ],
246 }],
247 ],
248 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000249 [ 'skia_warnings_as_errors', {
250 'cflags': [
251 '-Werror',
252 ],
253 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000254 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
255 [ 'skia_disable_inlining', {
256 'cflags': [
257 '-fno-inline',
258 '-fno-default-inline',
259 '-finline-limit=0',
260 '-fno-omit-frame-pointer',
261 ],
262 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000263 [ 'skia_arch_type == "arm" and arm_thumb == 1', {
264 'cflags': [
265 '-mthumb',
266 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000267 # The --fix-cortex-a8 switch enables a link-time workaround for
268 # an erratum in certain Cortex-A8 processors. The workaround is
269 # enabled by default if you target the ARM v7-A arch profile.
270 # It can be enabled otherwise by specifying --fix-cortex-a8, or
271 # disabled unconditionally by specifying --no-fix-cortex-a8.
272 #
273 # The erratum only affects Thumb-2 code.
274 'conditions': [
275 [ 'arm_version < 7', {
276 'ldflags': [
277 '-Wl,--fix-cortex-a8',
278 ],
279 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000280 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000281 }],
282 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000283 'cflags': [
284 '-march=armv7-a',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000285 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000286 'ldflags': [
287 '-march=armv7-a',
288 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000289 'conditions': [
290 [ 'arm_neon == 1', {
291 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700292 'SK_ARM_HAS_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000293 ],
294 'cflags': [
295 '-mfpu=neon',
296 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000297 }],
298 [ 'arm_neon_optional == 1', {
299 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700300 'SK_ARM_HAS_OPTIONAL_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000301 ],
302 }],
mtklein19996ed2014-11-21 06:48:43 -0800303 [ 'skia_os != "chromeos" and skia_os != "linux"', {
borenet@google.come2b90372013-07-11 18:46:30 +0000304 'cflags': [
305 '-mfloat-abi=softfp',
306 ],
307 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000308 ],
309 }],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700310 [ 'skia_arch_type == "mips"', {
311 'cflags': [
312 '-EL',
313 ],
314 'conditions': [
315 [ 'mips_arch_variant == "mips32r2"', {
316 'cflags': [
317 '-march=mips32r2',
318 ],
319 'conditions': [
320 [ 'mips_dsp == 1', {
321 'cflags': [
322 '-mdsp',
323 ],
djordje.pesut6336f7c2014-07-14 07:48:11 -0700324 'defines': [
325 'SK_MIPS_HAS_DSP',
326 ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700327 }],
328 [ 'mips_dsp == 2', {
329 'cflags': [
330 '-mdspr2',
331 ],
djordje.pesut632a4542014-06-11 06:56:10 -0700332 'defines': [
djordje.pesut6336f7c2014-07-14 07:48:11 -0700333 'SK_MIPS_HAS_DSP',
334 'SK_MIPS_HAS_DSPR2',
djordje.pesut632a4542014-06-11 06:56:10 -0700335 ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700336 }],
337 ],
338 }],
339 ],
340 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000341 ],
342 },
343 ],
344
mtkleinf3cdce72015-02-05 09:23:56 -0800345 [ 'skia_os == "nacl"', {
346 # NaCl compiler is GCC 4.4, which is too old to understand 'c++11', so call it '0x'.
347 # NaCl's newlib needs gnu++ mode to see snprintf, vsnprintf, etc in C++11 mode.
348 'cflags_cc!': [ '-std=c++11' ],
349 'cflags_cc' : [ '-std=gnu++0x' ],
350 }],
351
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000352 ['skia_android_framework', {
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000353 'includes' : [
354 'skia_for_android_framework_defines.gypi',
355 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000356 'cflags': [
357 # Skia does not enforce this usage pattern so we disable it here to avoid
358 # unecessary log spew when building
359 '-Wno-unused-parameter',
360
361 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
362 # Revert to -D_FORTIFY_SOURCE=1
363 '-U_FORTIFY_SOURCE',
364 '-D_FORTIFY_SOURCE=1',
djsollenf379ad32015-01-27 09:01:01 -0800365
366 # We can't use the skia_shared_library gyp setting because we need to
367 # isolate this define to Skia sources. CFLAGS are local to Android.mk
368 # and ensures that this define is not exported to clients of the library
369 '-DSKIA_IMPLEMENTATION=1',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000370 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000371 # Remove flags which are either unnecessary or problematic for the
372 # Android framework build. Many of these flags are removed simply because
373 # they were not previously in the Android framework makefile, and we did
374 # did not intend to add them when generating the makefile.
375 # TODO (scroggo): Investigate whether any of these flags are actually
376 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000377 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000378 # Android has one makefile, used for both debugging (after manual
379 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000380 '-g',
381 '-march=armv7-a',
382 '-mthumb',
383 '-mfpu=neon',
384 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000385 '-fno-exceptions',
386 '-fstrict-aliasing',
387 # Remove flags to turn on warnings, since most people building Android
388 # are not focused on Skia and do not need the extra warning info.
389 '-Wall',
390 '-Wextra',
391 '-Winit-self',
392 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800393 '-Wsign-compare',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000394 ],
395 'cflags_cc!': [
396 '-fno-rtti',
397 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000398 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000399 'defines': [
400 'DCT_IFAST_SUPPORTED',
401 # using freetype's embolden allows us to adjust fake bold settings at
402 # draw-time, at which point we know which SkTypeface is being drawn
403 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000404 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
405 # When built as part of the system image we can enable certian non-NDK
406 # compliant optimizations.
407 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000408 # Optimizations for chromium (m30)
409 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
410 'IGNORE_ROT_AA_RECT_OPT',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000411 'SkLONGLONG int64_t',
412 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000413 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700414 'SK_IGNORE_ETC1_SUPPORT',
djsollenf379ad32015-01-27 09:01:01 -0800415 # We can't use the skia_shared_library gyp setting because we need expose
416 # this define globally and the the implemention define as a cflag.
417 'SKIA_DLL',
scroggo803a49d2015-01-30 06:19:44 -0800418 'SK_OVERRIDE override',
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000419 # Defines from skia_for_android_framework_defines.gypi
420 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000421 ],
422 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000423
borenet@google.com05d550e2013-06-11 15:52:19 +0000424 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000425 {
426 'defines': [
427 'SK_SAMPLES_FOR_X',
428 'SK_BUILD_FOR_UNIX',
429 ],
430 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000431 'Coverage': {
mtklein@google.comdad70702013-11-20 18:06:10 +0000432 'cflags': ['--coverage'],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000433 'ldflags': ['--coverage'],
434 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000435 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000436 },
437 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000438 'cflags': [
439 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000440 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000441 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000442 },
443 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000444 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000445 [ 'skia_shared_lib', {
zachr@google.com28c27c82013-06-20 17:15:05 +0000446 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000447 'SKIA_DLL',
448 'SKIA_IMPLEMENTATION=1',
449 ],
450 }],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000451 [ 'skia_os == "nacl"', {
452 'defines': [
453 'SK_BUILD_FOR_NACL',
454 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000455 'variables': {
commit-bot@chromium.org25595ed2014-04-04 18:16:04 +0000456 'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000457 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000458 'link_settings': {
459 'libraries': [
460 '-lppapi',
461 '-lppapi_cpp',
462 '-lnosys',
463 '-pthread',
464 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000465 'ldflags': [
466 '-L<(nacl_sdk_root)/lib/newlib_x86_<(skia_arch_width)/Release',
467 '-L<(nacl_sdk_root)/ports/lib/newlib_x86_<(skia_arch_width)/Release',
468 ],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000469 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000470 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000471 # Enable asan, tsan, etc.
472 [ 'skia_sanitizer', {
borenet@google.com0d193092013-07-03 15:55:05 +0000473 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000474 '-fsanitize=<(skia_sanitizer)',
borenet@google.com0d193092013-07-03 15:55:05 +0000475 ],
476 'ldflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000477 '-fsanitize=<(skia_sanitizer)',
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000478 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000479 'conditions' : [
480 [ 'skia_sanitizer == "thread"', {
mtklein0faaac62014-12-15 13:38:07 -0800481 'defines': [ 'DYNAMIC_ANNOTATIONS_ENABLED=1' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000482 }],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000483 [ 'skia_sanitizer == "undefined"', {
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000484 'cflags_cc!': ['-fno-rtti'],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000485 }],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000486 ],
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000487 }],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000488 [ 'skia_clang_build', {
mtklein170e00d2014-06-30 12:33:11 -0700489 'cflags_cc': [
mtklein170e00d2014-06-30 12:33:11 -0700490 '-Wno-unknown-warning-option', # Allows unknown warnings.
491 '-Wno-deprecated', # From Qt, via debugger (older Clang).
492 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
493 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000494 'cflags': [
mtklein170e00d2014-06-30 12:33:11 -0700495 # Extra warnings we like but that only Clang knows about.
496 '-Wstring-conversion',
borenet@google.com47ae4b02013-08-21 18:02:50 +0000497 ],
commit-bot@chromium.org815d3602014-05-20 19:42:03 +0000498 'cflags!': [
499 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
500 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000501 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000502 [ 'skia_keep_frame_pointer', {
503 'cflags': [ '-fno-omit-frame-pointer' ],
504 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000505 ],
506 },
507 ],
508
borenet@google.coma72aef82013-03-22 13:16:06 +0000509 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000510 {
mtkleina34633f2014-08-19 13:32:59 -0700511 'defines': [ 'SK_BUILD_FOR_MAC' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000512 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000513 'Coverage': {
514 'xcode_settings': {
515 'GCC_OPTIMIZATION_LEVEL': '0',
516 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
517 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
518 },
519 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000520 'Debug': {
mtkleina34633f2014-08-19 13:32:59 -0700521 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0' },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000522 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000523 'Release': {
mtkleina34633f2014-08-19 13:32:59 -0700524 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)', },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000525 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000526 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000527 },
528 'xcode_settings': {
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000529 'conditions': [
mtkleina34633f2014-08-19 13:32:59 -0700530 [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
531 [ 'skia_arch_width == 32', { 'ARCHS': ['i386'] }],
532 [ 'skia_arch_width == 64', { 'ARCHS': ['x86_64'] }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000533 [ 'skia_osx_deployment_target==""', {
mtkleina34633f2014-08-19 13:32:59 -0700534 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in env to ld.
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000535 }, {
536 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
537 }],
538 ],
mtklein65fd5992015-02-03 13:24:36 -0800539 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
mtklein94c41512014-09-12 17:07:34 -0700540 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
541 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
542 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
mtklein335a0ae2014-10-13 12:32:34 -0700543 'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks
544 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings
545 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
mtkleina34633f2014-08-19 13:32:59 -0700546 'WARNING_CFLAGS': [
547 '-Wall',
548 '-Wextra',
mtkleina07b2972015-01-23 07:01:26 -0800549 '-Winit-self',
550 '-Wpointer-arith',
551 '-Wsign-compare',
552
mtkleina34633f2014-08-19 13:32:59 -0700553 '-Wno-unused-parameter',
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000554 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000555 },
556 },
557 ],
558
borenet@google.coma72aef82013-03-22 13:16:06 +0000559 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000560 {
561 'defines': [
562 'SK_BUILD_FOR_IOS',
563 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000564 'conditions' : [
565 [ 'skia_warnings_as_errors', {
566 'xcode_settings': {
567 'OTHER_CPLUSPLUSFLAGS': [
568 '-Werror',
569 ],
570 },
571 }],
572 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000573 'configurations': {
574 'Debug': {
575 'xcode_settings': {
576 'GCC_OPTIMIZATION_LEVEL': '0',
577 },
578 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000579 'Release': {
580 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000581 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000582 },
583 'defines': [ 'NDEBUG' ],
584 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000585 },
586 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000587 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000588 'CODE_SIGNING_REQUIRED': 'NO',
589 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000590 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000591 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000592 'TARGETED_DEVICE_FAMILY': '1,2',
mtklein335a0ae2014-10-13 12:32:34 -0700593 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
borenet@google.coma72aef82013-03-22 13:16:06 +0000594 'OTHER_CPLUSPLUSFLAGS': [
mtkleinf3cdce72015-02-05 09:23:56 -0800595 '-std=c++0x',
borenet@google.coma72aef82013-03-22 13:16:06 +0000596 '-fvisibility=hidden',
597 '-fvisibility-inlines-hidden',
598 ],
bsalomon@google.com89dec582012-09-28 18:33:11 +0000599 'GCC_THUMB_SUPPORT': 'NO',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000600 },
601 },
602 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000603
borenet@google.coma72aef82013-03-22 13:16:06 +0000604 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000605 {
606 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000607 'SK_BUILD_FOR_ANDROID',
djsollen@google.com968757e2014-04-11 13:09:21 +0000608
609 # Android Text Tuning
610 'SK_GAMMA_EXPONENT=1.4',
611 'SK_GAMMA_CONTRAST=0.0',
612 ],
613 # Android defines a fixed gamma exponent instead of using SRGB
614 'defines!': [
615 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000616 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000617 'configurations': {
618 'Debug': {
mtkleinc0591ca2014-11-21 14:42:35 -0800619 'cflags': ['-g']
scroggo@google.comeb629502014-02-04 16:08:48 +0000620 },
621 'Release': {
622 'cflags': ['-O2'],
scroggo@google.comeb629502014-02-04 16:08:48 +0000623 },
624 },
djsollen@google.com58629292011-11-03 13:08:29 +0000625 'libraries': [
djsollen@google.com318cf922011-11-08 19:03:43 +0000626 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000627 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000628 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000629 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000630 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000631 'conditions': [
scroggodf1c3372015-02-12 10:48:25 -0800632 [ '"x86" in skia_arch_type', {
djsollenbc893292014-07-24 13:53:56 -0700633 'cflags': [
634 '-mssse3',
635 ],
636 }],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000637 [ 'skia_android_framework', {
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000638 'cflags!': [
639 '-fuse-ld=gold',
scroggo7cd3f642015-02-12 13:27:40 -0800640 '-mssse3',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000641 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000642 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000643 [ 'skia_shared_lib', {
djsollen@google.com52f02972013-06-03 12:10:19 +0000644 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000645 'SKIA_DLL',
646 'SKIA_IMPLEMENTATION=1',
scroggoecce60b2014-07-09 07:26:40 -0700647 # Needed until we fix skbug.com/2440.
648 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
djsollen@google.com52f02972013-06-03 12:10:19 +0000649 ],
650 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000651 [ 'skia_profile_enabled == 1', {
652 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000653 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000654 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000655 },
656 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000657
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000658 [ 'skia_moz2d', {
659 'defines': [
reed6518eaa2014-06-18 14:05:22 -0700660 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000661 ],
662 }],
663
seanpaul@google.com1134f982011-09-15 14:24:33 +0000664 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000665 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
666 'xcode_settings': {
667 'SYMROOT': '<(DEPTH)/xcodebuild',
668 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000669}