blob: 0c004e5ca51dc08cf388ec871eceb2ef87a8598e [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)',
chudy@google.combbad34d2012-08-13 14:26:36 +00009 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000010 'conditions' : [
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000011 [ 'skia_arch_type == "arm64"', {
12 'cflags': [
13 '-ffp-contract=off',
14 ],
15 }],
16
commit-bot@chromium.org6a106ce2014-05-20 19:02:55 +000017 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
18 [ 'skia_arch_type == "x86"', {
19 'cflags': [
20 '-msse2',
21 '-mfpmath=sse',
22 ],
23 }],
24
borenet@google.coma72aef82013-03-22 13:16:06 +000025 [ 'skia_os == "win"',
seanpaul@google.com1134f982011-09-15 14:24:33 +000026 {
27 'defines': [
28 'SK_BUILD_FOR_WIN32',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000029 '_CRT_SECURE_NO_WARNINGS',
senorblanco@chromium.org5f47a392012-07-12 00:34:39 +000030 'GR_GL_FUNCTION_TYPE=__stdcall',
seanpaul@google.com1134f982011-09-15 14:24:33 +000031 ],
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000032 'msvs_disabled_warnings': [
33 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
34 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000035 'msvs_cygwin_shell': 0,
36 'msvs_settings': {
37 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000038 'WarningLevel': '3',
39 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000040 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000041 'ExceptionHandling': '0',
42 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000043 },
44 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000045 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000046 'AdditionalDependencies': [
47 'OpenGL32.lib',
48 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000049
50 # Prior to gyp r1584, the following were included automatically.
51 'kernel32.lib',
52 'gdi32.lib',
53 'winspool.lib',
54 'comdlg32.lib',
55 'advapi32.lib',
56 'shell32.lib',
57 'ole32.lib',
58 'oleaut32.lib',
59 'user32.lib',
60 'uuid.lib',
61 'odbc32.lib',
62 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +000063 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +000064 ],
65 },
66 },
67 'configurations': {
68 'Debug': {
69 'msvs_settings': {
70 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000071 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +000072 'Optimization': '0', # optimizeDisabled (/Od)
73 'PreprocessorDefinitions': ['_DEBUG'],
74 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000075 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +000076 },
77 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000078 'GenerateDebugInformation': 'true', # /DEBUG
79 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +000080 },
81 },
82 },
83 'Release': {
84 'msvs_settings': {
85 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +000086 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +000087 'Optimization': '<(skia_release_optimization_level)',
bsalomon@google.comd9718692013-04-22 14:56:50 +000088 'WholeProgramOptimization': 'true', #/GL
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000089 # Changing the floating point model requires rebaseling gm images
bsalomon@google.com9aabfc72012-05-31 14:12:46 +000090 #'FloatingPointModel': '2', # fast (/fp:fast)
91 'FavorSizeOrSpeed': '1', # speed (/Ot)
seanpaul@google.com1134f982011-09-15 14:24:33 +000092 'PreprocessorDefinitions': ['NDEBUG'],
bsalomon@google.com9aabfc72012-05-31 14:12:46 +000093 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
bsalomon@google.com9aabfc72012-05-31 14:12:46 +000094 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
95 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +000096 },
97 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000098 'GenerateDebugInformation': 'true', # /DEBUG
bsalomon@google.comd9718692013-04-22 14:56:50 +000099 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
seanpaul@google.com1134f982011-09-15 14:24:33 +0000100 },
bungeman@google.com983297e2011-10-03 19:36:51 +0000101 'VCLibrarianTool': {
bsalomon@google.comd9718692013-04-22 14:56:50 +0000102 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
bungeman@google.com983297e2011-10-03 19:36:51 +0000103 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000104 },
105 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000106 },
107 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000108 # Gyp's ninja generator depends on these specially named
109 # configurations to build 64-bit on Windows.
110 # See http://skbug.com/2348
111 #
112 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
113 # OK for us to just make these inherit non-archwidth-specific
114 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000115 #
116 # See http://skbug.com/2442 : These targets cause problems in the
117 # MSVS build, so only include them if gyp is generating a ninja build.
118 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
119 'configurations': {
120 'Debug_x64': {
121 'inherit_from': ['Debug'],
122 },
123 'Release_x64': {
124 'inherit_from': ['Release'],
125 },
126 'Release_Developer_x64': {
127 'inherit_from': ['Release_Developer'],
128 },
129 },
130 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000131 [ 'skia_arch_width == 64', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000132 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000133 }],
134 [ 'skia_arch_width == 32', {
135 'msvs_configuration_platform': 'Win32',
136 }],
137 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000138 'msvs_settings': {
139 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000140 'WarnAsError': 'true',
141 'AdditionalOptions': [
142 '/we4189', # initialized but unused var warning
143 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000144 },
145 },
borenet@google.comb7961192012-08-20 18:58:26 +0000146 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000147 [ 'skia_win_exceptions', {
148 'msvs_settings': {
149 'VCCLCompilerTool': {
150 'AdditionalOptions': [
151 '/EHsc',
152 ],
153 },
154 },
155 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000156 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000157 },
158 ],
159
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000160 # The following section is common to linux + derivatives and android
161 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
162 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000163 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000164 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000165 '-fno-exceptions',
166 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000167
mtklein@google.comf1077f92013-11-20 15:13:49 +0000168 '-Wall',
169 '-Wextra',
170 '-Winit-self',
171 '-Wpointer-arith',
172
173 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000174 ],
175 'cflags_cc': [
176 '-fno-rtti',
177 '-Wnon-virtual-dtor',
178 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000179 'conditions': [
commit-bot@chromium.org93f5e512014-02-17 15:22:26 +0000180 [ 'skia_android_framework==0', {
181 'cflags': [
182 # This flag is not supported by Android build system.
183 '-Wno-c++11-extensions',
184 ],
185 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000186 [ 'skia_warnings_as_errors', {
187 'cflags': [
188 '-Werror',
189 ],
190 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000191 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
192 [ 'skia_disable_inlining', {
193 'cflags': [
194 '-fno-inline',
195 '-fno-default-inline',
196 '-finline-limit=0',
197 '-fno-omit-frame-pointer',
198 ],
199 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000200 [ 'skia_arch_type == "arm" and arm_thumb == 1', {
201 'cflags': [
202 '-mthumb',
203 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000204 # The --fix-cortex-a8 switch enables a link-time workaround for
205 # an erratum in certain Cortex-A8 processors. The workaround is
206 # enabled by default if you target the ARM v7-A arch profile.
207 # It can be enabled otherwise by specifying --fix-cortex-a8, or
208 # disabled unconditionally by specifying --no-fix-cortex-a8.
209 #
210 # The erratum only affects Thumb-2 code.
211 'conditions': [
212 [ 'arm_version < 7', {
213 'ldflags': [
214 '-Wl,--fix-cortex-a8',
215 ],
216 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000217 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000218 }],
219 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000220 'cflags': [
221 '-march=armv7-a',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000222 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000223 'ldflags': [
224 '-march=armv7-a',
225 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000226 'conditions': [
227 [ 'arm_neon == 1', {
228 'defines': [
229 '__ARM_HAVE_NEON',
230 ],
231 'cflags': [
232 '-mfpu=neon',
233 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000234 }],
235 [ 'arm_neon_optional == 1', {
236 'defines': [
237 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
238 ],
239 }],
borenet@google.come2b90372013-07-11 18:46:30 +0000240 [ 'skia_os != "chromeos"', {
241 'cflags': [
242 '-mfloat-abi=softfp',
243 ],
244 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000245 ],
246 }],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700247 [ 'skia_arch_type == "mips"', {
248 'cflags': [
249 '-EL',
250 ],
251 'conditions': [
252 [ 'mips_arch_variant == "mips32r2"', {
253 'cflags': [
254 '-march=mips32r2',
255 ],
256 'conditions': [
257 [ 'mips_dsp == 1', {
258 'cflags': [
259 '-mdsp',
260 ],
261 }],
262 [ 'mips_dsp == 2', {
263 'cflags': [
264 '-mdspr2',
265 ],
266 }],
267 ],
268 }],
269 ],
270 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000271 ],
272 },
273 ],
274
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000275 ['skia_android_framework', {
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000276 'includes' : [
277 'skia_for_android_framework_defines.gypi',
278 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000279 'cflags': [
280 # Skia does not enforce this usage pattern so we disable it here to avoid
281 # unecessary log spew when building
282 '-Wno-unused-parameter',
283
284 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
285 # Revert to -D_FORTIFY_SOURCE=1
286 '-U_FORTIFY_SOURCE',
287 '-D_FORTIFY_SOURCE=1',
288 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000289 # Remove flags which are either unnecessary or problematic for the
290 # Android framework build. Many of these flags are removed simply because
291 # they were not previously in the Android framework makefile, and we did
292 # did not intend to add them when generating the makefile.
293 # TODO (scroggo): Investigate whether any of these flags are actually
294 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000295 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000296 # Android has one makefile, used for both debugging (after manual
297 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000298 '-g',
299 '-march=armv7-a',
300 '-mthumb',
301 '-mfpu=neon',
302 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000303 # This flag is not supported by Android build system.
304 '-Wno-c++11-extensions',
305 '-fno-exceptions',
306 '-fstrict-aliasing',
307 # Remove flags to turn on warnings, since most people building Android
308 # are not focused on Skia and do not need the extra warning info.
309 '-Wall',
310 '-Wextra',
311 '-Winit-self',
312 '-Wpointer-arith',
313 ],
314 'cflags_cc!': [
315 '-fno-rtti',
316 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000317 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000318 'defines': [
319 'DCT_IFAST_SUPPORTED',
320 # using freetype's embolden allows us to adjust fake bold settings at
321 # draw-time, at which point we know which SkTypeface is being drawn
322 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000323 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
324 # When built as part of the system image we can enable certian non-NDK
325 # compliant optimizations.
326 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000327 # Optimizations for chromium (m30)
328 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
329 'IGNORE_ROT_AA_RECT_OPT',
330 # Disable this check because it is too strict for some chromium-specific
331 # subclasses of SkPixelRef. See bug: crbug.com/171776.
332 'SK_DISABLE_PIXELREF_LOCKCOUNT_BALANCE_CHECK',
333 'SkLONGLONG int64_t',
334 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
commit-bot@chromium.org64f6d152014-05-27 15:55:35 +0000335 'SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_sync.h"',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000336 'SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_pthread.h"',
commit-bot@chromium.org28fcae22014-04-11 17:15:40 +0000337 # Still need to switch Android to the new name for N32.
338 'kNative_8888_SkColorType kN32_SkColorType',
robertphillipsa2551ff2014-06-02 12:09:29 -0700339 'SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE',
340 # Needed until we fix skbug.com/2440.
341 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
342 # Transitional, for deprecated SkCanvas::SaveFlags methods.
343 'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
344 'SK_SUPPORT_LEGACY_SHADER_LOCALMATRIX',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000345 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700346 'SK_IGNORE_ETC1_SUPPORT',
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000347 # Defines from skia_for_android_framework_defines.gypi
348 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000349 ],
350 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000351
borenet@google.com05d550e2013-06-11 15:52:19 +0000352 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000353 {
354 'defines': [
355 'SK_SAMPLES_FOR_X',
356 'SK_BUILD_FOR_UNIX',
357 ],
358 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000359 'Coverage': {
mtklein@google.comdad70702013-11-20 18:06:10 +0000360 'cflags': ['--coverage'],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000361 'ldflags': ['--coverage'],
362 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000363 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000364 },
365 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000366 'cflags': [
367 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000368 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000369 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000370 },
371 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000372 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000373 [ 'skia_shared_lib', {
374 'cflags': [
375 '-fPIC',
376 ],
377 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000378 'SKIA_DLL',
379 'SKIA_IMPLEMENTATION=1',
380 ],
381 }],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000382 [ 'skia_os == "nacl"', {
383 'defines': [
384 'SK_BUILD_FOR_NACL',
385 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000386 'variables': {
commit-bot@chromium.org25595ed2014-04-04 18:16:04 +0000387 'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000388 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000389 'link_settings': {
390 'libraries': [
391 '-lppapi',
392 '-lppapi_cpp',
393 '-lnosys',
394 '-pthread',
395 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000396 'ldflags': [
397 '-L<(nacl_sdk_root)/lib/newlib_x86_<(skia_arch_width)/Release',
398 '-L<(nacl_sdk_root)/ports/lib/newlib_x86_<(skia_arch_width)/Release',
399 ],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000400 },
borenet@google.comcb9445d2013-08-19 18:26:04 +0000401 }, { # skia_os != "nacl"
402 'link_settings': {
403 'ldflags': [
404 '-lstdc++',
405 '-lm',
406 ],
407 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000408 }],
borenet@google.comcb9445d2013-08-19 18:26:04 +0000409 [ 'skia_os != "chromeos"', {
borenet@google.com05d550e2013-06-11 15:52:19 +0000410 'conditions': [
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000411 [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
borenet@google.com05d550e2013-06-11 15:52:19 +0000412 'cflags': [
413 '-m64',
414 ],
415 'ldflags': [
416 '-m64',
417 ],
418 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000419 [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
borenet@google.com05d550e2013-06-11 15:52:19 +0000420 'cflags': [
421 '-m32',
422 ],
423 'ldflags': [
424 '-m32',
425 ],
426 }],
427 ],
428 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000429 # Enable asan, tsan, etc.
430 [ 'skia_sanitizer', {
borenet@google.com0d193092013-07-03 15:55:05 +0000431 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000432 '-fsanitize=<(skia_sanitizer)',
borenet@google.com0d193092013-07-03 15:55:05 +0000433 ],
434 'ldflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000435 '-fsanitize=<(skia_sanitizer)',
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000436 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000437 'conditions' : [
438 [ 'skia_sanitizer == "thread"', {
439 'defines': [ 'DYNAMIC_ANNOTATIONS_ENABLED=1' ],
mtklein59ef7702014-06-02 19:34:19 -0700440 'cflags': [ '-fPIC' ],
bungeman@google.com27d4ffe2013-10-10 17:09:49 +0000441 'target_conditions': [
442 [ '_type == "executable"', {
443 'cflags': [ '-fPIE' ],
444 'ldflags': [ '-pie' ],
445 }],
446 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000447 }],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000448 [ 'skia_sanitizer == "undefined"', {
449 'cflags': [ '-fPIC' ],
450 'cflags_cc!': ['-fno-rtti'],
451 'target_conditions': [
452 [ '_type == "executable"', {
453 'cflags': [ '-fPIE' ],
454 'ldflags': [ '-pie' ],
455 }],
456 ],
457 }],
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', {
461 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000462 # Extra warnings we like but that only Clang knows about.
borenet@google.com47ae4b02013-08-21 18:02:50 +0000463 '-Wstring-conversion',
464 ],
commit-bot@chromium.org815d3602014-05-20 19:42:03 +0000465 'cflags!': [
466 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
467 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000468 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000469 [ 'skia_keep_frame_pointer', {
470 'cflags': [ '-fno-omit-frame-pointer' ],
471 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000472 ],
473 },
474 ],
475
borenet@google.coma72aef82013-03-22 13:16:06 +0000476 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000477 {
478 'defines': [
479 'SK_BUILD_FOR_MAC',
480 ],
djsollen@google.come341cb32012-06-28 16:08:05 +0000481 'conditions' : [
borenet@google.coma72aef82013-03-22 13:16:06 +0000482 [ 'skia_arch_width == 64', {
djsollen@google.come341cb32012-06-28 16:08:05 +0000483 'xcode_settings': {
commit-bot@chromium.org5d7ca952013-04-22 20:26:44 +0000484 'ARCHS': ['x86_64'],
djsollen@google.come341cb32012-06-28 16:08:05 +0000485 },
486 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000487 [ 'skia_arch_width == 32', {
djsollen@google.come341cb32012-06-28 16:08:05 +0000488 'xcode_settings': {
commit-bot@chromium.org5d7ca952013-04-22 20:26:44 +0000489 'ARCHS': ['i386'],
borenet@google.coma72aef82013-03-22 13:16:06 +0000490 },
491 }],
492 [ 'skia_warnings_as_errors', {
493 'xcode_settings': {
humper@google.comfe0d6802013-01-07 20:28:16 +0000494 'OTHER_CPLUSPLUSFLAGS': [
495 '-Werror',
commit-bot@chromium.orgfaa5ae42013-07-23 11:13:56 +0000496 '-Wall',
497 '-Wextra',
498 '-Wno-unused-parameter',
commit-bot@chromium.org6a180792014-01-15 21:39:18 +0000499 '-Wno-uninitialized', # Disabled because we think GCC 4.2 is bad at this.
mtklein@google.com8d725b22013-07-24 16:20:05 +0000500 ],
501 },
502 }],
djsollen@google.come341cb32012-06-28 16:08:05 +0000503 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000504 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000505 'Coverage': {
506 'xcode_settings': {
507 'GCC_OPTIMIZATION_LEVEL': '0',
508 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
509 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
510 },
511 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000512 'Debug': {
513 'xcode_settings': {
514 'GCC_OPTIMIZATION_LEVEL': '0',
515 },
516 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000517 'Release': {
518 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000519 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
reed@google.come05cc8e2011-10-10 14:19:40 +0000520 },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000521 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000522 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000523 },
524 'xcode_settings': {
robertphillips@google.com02297652012-04-05 19:29:04 +0000525 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000526 'conditions': [
527 [ 'skia_osx_deployment_target==""', {
528 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in environment to ld.
529 }, {
530 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
531 }],
532 ],
reed@google.com0069aa52011-11-17 15:35:47 +0000533# trying to get this to work, but it needs clang I think...
534# 'WARNING_CFLAGS': '-Wexit-time-destructors',
mike@reedtribe.orge51755f2011-12-10 19:36:56 +0000535 'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
caryclark@google.comb462a422012-06-06 12:12:28 +0000536 'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
537 'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'YES',
538 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'YES',
539 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
540 'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
541 'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
542 'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
543 'GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL': 'YES',
544 'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
545 'GCC_WARN_MISSING_PARENTHESES': 'YES',
546 'GCC_WARN_PROTOTYPE_CONVERSION': 'YES',
547 'GCC_WARN_SIGN_COMPARE': 'YES',
548 'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
549 'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
550 'GCC_WARN_UNUSED_FUNCTION': 'YES',
551 'GCC_WARN_UNUSED_LABEL': 'YES',
552 'GCC_WARN_UNUSED_VALUE': 'YES',
553 'GCC_WARN_UNUSED_VARIABLE': 'YES',
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000554 'OTHER_CPLUSPLUSFLAGS': [
555 '-mssse3',
556 '-fvisibility=hidden',
557 '-fvisibility-inlines-hidden',
558 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000559 },
560 },
561 ],
562
borenet@google.coma72aef82013-03-22 13:16:06 +0000563 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000564 {
565 'defines': [
566 'SK_BUILD_FOR_IOS',
567 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000568 'conditions' : [
569 [ 'skia_warnings_as_errors', {
570 'xcode_settings': {
571 'OTHER_CPLUSPLUSFLAGS': [
572 '-Werror',
573 ],
574 },
575 }],
576 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000577 'configurations': {
578 'Debug': {
579 'xcode_settings': {
580 'GCC_OPTIMIZATION_LEVEL': '0',
581 },
582 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000583 'Release': {
584 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000585 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000586 },
587 'defines': [ 'NDEBUG' ],
588 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000589 },
590 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000591 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000592 'CODE_SIGNING_REQUIRED': 'NO',
593 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000594 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000595 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000596 'TARGETED_DEVICE_FAMILY': '1,2',
borenet@google.coma72aef82013-03-22 13:16:06 +0000597 'OTHER_CPLUSPLUSFLAGS': [
598 '-fvisibility=hidden',
599 '-fvisibility-inlines-hidden',
600 ],
bsalomon@google.com89dec582012-09-28 18:33:11 +0000601 'GCC_THUMB_SUPPORT': 'NO',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000602 },
603 },
604 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000605
borenet@google.coma72aef82013-03-22 13:16:06 +0000606 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000607 {
608 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000609 'SK_BUILD_FOR_ANDROID',
bungeman@google.com451b5962013-11-11 18:36:46 +0000610 'SK_FONTHOST_DOES_NOT_USE_FONTMGR',
djsollen@google.com968757e2014-04-11 13:09:21 +0000611
612 # Android Text Tuning
613 'SK_GAMMA_EXPONENT=1.4',
614 'SK_GAMMA_CONTRAST=0.0',
615 ],
616 # Android defines a fixed gamma exponent instead of using SRGB
617 'defines!': [
618 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000619 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000620 'configurations': {
621 'Debug': {
622 'cflags': ['-g']
623 },
624 'Release': {
625 'cflags': ['-O2'],
626 'defines': [ 'NDEBUG' ],
627 },
628 },
djsollen@google.com58629292011-11-03 13:08:29 +0000629 'libraries': [
scroggo@google.comeb629502014-02-04 16:08:48 +0000630 '-lstdc++',
631 '-lm',
djsollen@google.com318cf922011-11-08 19:03:43 +0000632 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000633 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000634 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000635 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000636 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000637 'conditions': [
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000638 [ 'skia_android_framework', {
639 'libraries!': [
640 '-lstdc++',
641 '-lm',
642 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000643 'cflags!': [
644 '-fuse-ld=gold',
645 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000646 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000647 [ 'skia_shared_lib', {
648 'cflags': [
649 '-fPIC',
650 ],
651 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000652 'SKIA_DLL',
653 'SKIA_IMPLEMENTATION=1',
654 ],
655 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000656 [ 'skia_profile_enabled == 1', {
657 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000658 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000659 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000660 },
661 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000662
digit@google.com1771cbf2012-01-26 21:26:40 +0000663 # We can POD-style initialization of static mutexes to avoid generating
664 # static initializers if we're using a pthread-compatible thread interface.
665 [ 'skia_os != "win"', {
666 'defines': [
borenet@google.com7158e6a2012-11-01 17:43:44 +0000667 'SK_USE_POSIX_THREADS',
digit@google.com1771cbf2012-01-26 21:26:40 +0000668 ],
669 }],
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000670
671 [ 'skia_moz2d', {
672 'defines': [
673 'SK_SUPPORT_LEGACY_LAYERRASTERIZER_API=1',
674 'SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG=1',
675 'SK_SUPPORT_LEGACY_GETTOTALCLIP=1',
jvanverth1940df92014-06-02 12:27:25 -0700676 'SK_SUPPORT_LEGACY_DEVICE_CONFIG=1',
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000677 ],
678 }],
679
commit-bot@chromium.org61744ec2014-05-16 13:15:41 +0000680 [ 'skia_build_json_writer', {
681 'defines': [
682 'SK_BUILD_JSON_WRITER',
683 ]
684 }],
685
seanpaul@google.com1134f982011-09-15 14:24:33 +0000686 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000687 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
688 'xcode_settings': {
689 'SYMROOT': '<(DEPTH)/xcodebuild',
690 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000691}