blob: b1ce5fca6fedcd75564fb5769d4dc26023eba533 [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,
Brian Salomon08fe0132014-06-17 17:28:17 -040036 'msvs_disabled_warnings': [4275],
seanpaul@google.com1134f982011-09-15 14:24:33 +000037 'msvs_settings': {
38 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000039 'WarningLevel': '3',
40 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000041 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000042 'ExceptionHandling': '0',
43 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000044 },
45 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000046 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000047 'AdditionalDependencies': [
48 'OpenGL32.lib',
49 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000050
51 # Prior to gyp r1584, the following were included automatically.
52 'kernel32.lib',
53 'gdi32.lib',
54 'winspool.lib',
55 'comdlg32.lib',
56 'advapi32.lib',
57 'shell32.lib',
58 'ole32.lib',
59 'oleaut32.lib',
60 'user32.lib',
61 'uuid.lib',
62 'odbc32.lib',
63 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +000064 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +000065 ],
66 },
67 },
68 'configurations': {
69 'Debug': {
70 'msvs_settings': {
71 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000072 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +000073 'Optimization': '0', # optimizeDisabled (/Od)
74 'PreprocessorDefinitions': ['_DEBUG'],
75 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000076 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +000077 },
78 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000079 'GenerateDebugInformation': 'true', # /DEBUG
80 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +000081 },
82 },
83 },
84 'Release': {
85 'msvs_settings': {
86 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +000087 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +000088 'Optimization': '<(skia_release_optimization_level)',
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
bungeman@google.com983297e2011-10-03 19:36:51 +000099 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000100 },
101 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000102 },
103 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000104 # Gyp's ninja generator depends on these specially named
105 # configurations to build 64-bit on Windows.
106 # See http://skbug.com/2348
107 #
108 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
109 # OK for us to just make these inherit non-archwidth-specific
110 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000111 #
112 # See http://skbug.com/2442 : These targets cause problems in the
113 # MSVS build, so only include them if gyp is generating a ninja build.
114 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
115 'configurations': {
116 'Debug_x64': {
117 'inherit_from': ['Debug'],
118 },
119 'Release_x64': {
120 'inherit_from': ['Release'],
121 },
122 'Release_Developer_x64': {
123 'inherit_from': ['Release_Developer'],
124 },
125 },
126 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000127 [ 'skia_arch_width == 64', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000128 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000129 }],
130 [ 'skia_arch_width == 32', {
131 'msvs_configuration_platform': 'Win32',
132 }],
133 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000134 'msvs_settings': {
135 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000136 'WarnAsError': 'true',
137 'AdditionalOptions': [
138 '/we4189', # initialized but unused var warning
139 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000140 },
141 },
borenet@google.comb7961192012-08-20 18:58:26 +0000142 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000143 [ 'skia_win_exceptions', {
144 'msvs_settings': {
145 'VCCLCompilerTool': {
146 'AdditionalOptions': [
147 '/EHsc',
148 ],
149 },
150 },
151 }],
bsalomonda07a082014-06-26 12:56:28 -0700152 [ 'skia_win_ltcg', {
153 'configurations': {
154 'Release': {
155 'msvs_settings': {
156 'VCCLCompilerTool': {
157 'WholeProgramOptimization': 'true', #/GL
158 },
159 'VCLinkerTool': {
160 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
161 },
162 'VCLibrarianTool': {
163 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
164 },
165 },
166 },
167 },
168 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000169 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000170 },
171 ],
172
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000173 # The following section is common to linux + derivatives and android
174 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
175 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000176 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000177 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000178 '-fno-exceptions',
179 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000180
mtklein@google.comf1077f92013-11-20 15:13:49 +0000181 '-Wall',
182 '-Wextra',
183 '-Winit-self',
184 '-Wpointer-arith',
185
186 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000187 ],
188 'cflags_cc': [
189 '-fno-rtti',
190 '-Wnon-virtual-dtor',
mtklein24ad0962014-06-17 11:47:40 -0700191 '-Wno-invalid-offsetof', # GCC <4.6 is old-school strict about what is POD.
mtklein@google.comf1077f92013-11-20 15:13:49 +0000192 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000193 'conditions': [
qiankun.miaod312a042014-07-07 09:47:24 -0700194 [ 'skia_os != "chromeos"', {
195 'conditions': [
196 [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
197 'cflags': [
198 '-m64',
199 ],
200 'ldflags': [
201 '-m64',
202 ],
203 }],
204 [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
205 'cflags': [
206 '-m32',
207 ],
208 'ldflags': [
209 '-m32',
210 ],
211 }],
212 ],
213 }],
commit-bot@chromium.org93f5e512014-02-17 15:22:26 +0000214 [ 'skia_android_framework==0', {
215 'cflags': [
216 # This flag is not supported by Android build system.
217 '-Wno-c++11-extensions',
218 ],
219 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000220 [ 'skia_warnings_as_errors', {
221 'cflags': [
222 '-Werror',
223 ],
224 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000225 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
226 [ 'skia_disable_inlining', {
227 'cflags': [
228 '-fno-inline',
229 '-fno-default-inline',
230 '-finline-limit=0',
231 '-fno-omit-frame-pointer',
232 ],
233 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000234 [ 'skia_arch_type == "arm" and arm_thumb == 1', {
235 'cflags': [
236 '-mthumb',
237 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000238 # The --fix-cortex-a8 switch enables a link-time workaround for
239 # an erratum in certain Cortex-A8 processors. The workaround is
240 # enabled by default if you target the ARM v7-A arch profile.
241 # It can be enabled otherwise by specifying --fix-cortex-a8, or
242 # disabled unconditionally by specifying --no-fix-cortex-a8.
243 #
244 # The erratum only affects Thumb-2 code.
245 'conditions': [
246 [ 'arm_version < 7', {
247 'ldflags': [
248 '-Wl,--fix-cortex-a8',
249 ],
250 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000251 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000252 }],
253 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000254 'cflags': [
255 '-march=armv7-a',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000256 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000257 'ldflags': [
258 '-march=armv7-a',
259 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000260 'conditions': [
261 [ 'arm_neon == 1', {
262 'defines': [
263 '__ARM_HAVE_NEON',
264 ],
265 'cflags': [
266 '-mfpu=neon',
267 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000268 }],
269 [ 'arm_neon_optional == 1', {
270 'defines': [
271 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
272 ],
273 }],
borenet@google.come2b90372013-07-11 18:46:30 +0000274 [ 'skia_os != "chromeos"', {
275 'cflags': [
276 '-mfloat-abi=softfp',
277 ],
278 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000279 ],
280 }],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700281 [ 'skia_arch_type == "mips"', {
282 'cflags': [
283 '-EL',
284 ],
285 'conditions': [
286 [ 'mips_arch_variant == "mips32r2"', {
287 'cflags': [
288 '-march=mips32r2',
289 ],
290 'conditions': [
291 [ 'mips_dsp == 1', {
292 'cflags': [
293 '-mdsp',
294 ],
295 }],
296 [ 'mips_dsp == 2', {
297 'cflags': [
298 '-mdspr2',
299 ],
djordje.pesut632a4542014-06-11 06:56:10 -0700300 'defines': [
301 '__MIPS_HAVE_DSPR2',
302 ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700303 }],
304 ],
305 }],
306 ],
307 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000308 ],
309 },
310 ],
311
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000312 ['skia_android_framework', {
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000313 'includes' : [
314 'skia_for_android_framework_defines.gypi',
315 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000316 'cflags': [
317 # Skia does not enforce this usage pattern so we disable it here to avoid
318 # unecessary log spew when building
319 '-Wno-unused-parameter',
320
321 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
322 # Revert to -D_FORTIFY_SOURCE=1
323 '-U_FORTIFY_SOURCE',
324 '-D_FORTIFY_SOURCE=1',
325 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000326 # Remove flags which are either unnecessary or problematic for the
327 # Android framework build. Many of these flags are removed simply because
328 # they were not previously in the Android framework makefile, and we did
329 # did not intend to add them when generating the makefile.
330 # TODO (scroggo): Investigate whether any of these flags are actually
331 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000332 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000333 # Android has one makefile, used for both debugging (after manual
334 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000335 '-g',
336 '-march=armv7-a',
337 '-mthumb',
338 '-mfpu=neon',
339 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000340 # This flag is not supported by Android build system.
341 '-Wno-c++11-extensions',
342 '-fno-exceptions',
343 '-fstrict-aliasing',
344 # Remove flags to turn on warnings, since most people building Android
345 # are not focused on Skia and do not need the extra warning info.
346 '-Wall',
347 '-Wextra',
348 '-Winit-self',
349 '-Wpointer-arith',
350 ],
351 'cflags_cc!': [
352 '-fno-rtti',
353 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000354 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000355 'defines': [
356 'DCT_IFAST_SUPPORTED',
357 # using freetype's embolden allows us to adjust fake bold settings at
358 # draw-time, at which point we know which SkTypeface is being drawn
359 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000360 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
361 # When built as part of the system image we can enable certian non-NDK
362 # compliant optimizations.
363 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000364 # Optimizations for chromium (m30)
365 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
366 'IGNORE_ROT_AA_RECT_OPT',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000367 'SkLONGLONG int64_t',
368 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
commit-bot@chromium.org64f6d152014-05-27 15:55:35 +0000369 'SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_sync.h"',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000370 'SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_pthread.h"',
robertphillipsa2551ff2014-06-02 12:09:29 -0700371 # Transitional, for deprecated SkCanvas::SaveFlags methods.
372 'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
373 'SK_SUPPORT_LEGACY_SHADER_LOCALMATRIX',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000374 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700375 'SK_IGNORE_ETC1_SUPPORT',
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000376 # Defines from skia_for_android_framework_defines.gypi
377 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000378 ],
379 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000380
borenet@google.com05d550e2013-06-11 15:52:19 +0000381 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000382 {
383 'defines': [
384 'SK_SAMPLES_FOR_X',
385 'SK_BUILD_FOR_UNIX',
386 ],
387 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000388 'Coverage': {
mtklein@google.comdad70702013-11-20 18:06:10 +0000389 'cflags': ['--coverage'],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000390 'ldflags': ['--coverage'],
391 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000392 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000393 },
394 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000395 'cflags': [
396 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000397 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000398 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000399 },
400 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000401 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000402 [ 'skia_shared_lib', {
403 'cflags': [
404 '-fPIC',
405 ],
406 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000407 'SKIA_DLL',
408 'SKIA_IMPLEMENTATION=1',
409 ],
410 }],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000411 [ 'skia_os == "nacl"', {
412 'defines': [
413 'SK_BUILD_FOR_NACL',
414 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000415 'variables': {
commit-bot@chromium.org25595ed2014-04-04 18:16:04 +0000416 'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000417 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000418 'link_settings': {
419 'libraries': [
420 '-lppapi',
421 '-lppapi_cpp',
422 '-lnosys',
423 '-pthread',
424 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000425 'ldflags': [
426 '-L<(nacl_sdk_root)/lib/newlib_x86_<(skia_arch_width)/Release',
427 '-L<(nacl_sdk_root)/ports/lib/newlib_x86_<(skia_arch_width)/Release',
428 ],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000429 },
borenet@google.comcb9445d2013-08-19 18:26:04 +0000430 }, { # skia_os != "nacl"
431 'link_settings': {
432 'ldflags': [
433 '-lstdc++',
434 '-lm',
435 ],
436 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000437 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000438 # Enable asan, tsan, etc.
439 [ 'skia_sanitizer', {
borenet@google.com0d193092013-07-03 15:55:05 +0000440 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000441 '-fsanitize=<(skia_sanitizer)',
borenet@google.com0d193092013-07-03 15:55:05 +0000442 ],
443 'ldflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000444 '-fsanitize=<(skia_sanitizer)',
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000445 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000446 'conditions' : [
447 [ 'skia_sanitizer == "thread"', {
mtklein0b544ae2014-07-08 19:37:47 -0700448 'defines': [ 'SK_DYNAMIC_ANNOTATIONS_ENABLED=1' ],
mtklein59ef7702014-06-02 19:34:19 -0700449 'cflags': [ '-fPIC' ],
bungeman@google.com27d4ffe2013-10-10 17:09:49 +0000450 'target_conditions': [
451 [ '_type == "executable"', {
452 'cflags': [ '-fPIE' ],
453 'ldflags': [ '-pie' ],
454 }],
455 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000456 }],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000457 [ 'skia_sanitizer == "undefined"', {
458 'cflags': [ '-fPIC' ],
459 'cflags_cc!': ['-fno-rtti'],
460 'target_conditions': [
461 [ '_type == "executable"', {
462 'cflags': [ '-fPIE' ],
463 'ldflags': [ '-pie' ],
464 }],
465 ],
466 }],
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': [
471 # Build in C++11 mode to make sure we'll have an easy time switching.
472 '-std=c++11',
473 '-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 {
494 'defines': [
495 'SK_BUILD_FOR_MAC',
496 ],
djsollen@google.come341cb32012-06-28 16:08:05 +0000497 'conditions' : [
borenet@google.coma72aef82013-03-22 13:16:06 +0000498 [ 'skia_arch_width == 64', {
djsollen@google.come341cb32012-06-28 16:08:05 +0000499 'xcode_settings': {
commit-bot@chromium.org5d7ca952013-04-22 20:26:44 +0000500 'ARCHS': ['x86_64'],
djsollen@google.come341cb32012-06-28 16:08:05 +0000501 },
502 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000503 [ 'skia_arch_width == 32', {
djsollen@google.come341cb32012-06-28 16:08:05 +0000504 'xcode_settings': {
commit-bot@chromium.org5d7ca952013-04-22 20:26:44 +0000505 'ARCHS': ['i386'],
borenet@google.coma72aef82013-03-22 13:16:06 +0000506 },
507 }],
508 [ 'skia_warnings_as_errors', {
509 'xcode_settings': {
humper@google.comfe0d6802013-01-07 20:28:16 +0000510 'OTHER_CPLUSPLUSFLAGS': [
511 '-Werror',
commit-bot@chromium.orgfaa5ae42013-07-23 11:13:56 +0000512 '-Wall',
513 '-Wextra',
514 '-Wno-unused-parameter',
commit-bot@chromium.org6a180792014-01-15 21:39:18 +0000515 '-Wno-uninitialized', # Disabled because we think GCC 4.2 is bad at this.
mtklein@google.com8d725b22013-07-24 16:20:05 +0000516 ],
517 },
518 }],
djsollen@google.come341cb32012-06-28 16:08:05 +0000519 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000520 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000521 'Coverage': {
522 'xcode_settings': {
523 'GCC_OPTIMIZATION_LEVEL': '0',
524 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
525 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
526 },
527 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000528 'Debug': {
529 'xcode_settings': {
530 'GCC_OPTIMIZATION_LEVEL': '0',
531 },
532 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000533 'Release': {
534 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000535 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
reed@google.come05cc8e2011-10-10 14:19:40 +0000536 },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000537 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000538 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000539 },
540 'xcode_settings': {
robertphillips@google.com02297652012-04-05 19:29:04 +0000541 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000542 'conditions': [
543 [ 'skia_osx_deployment_target==""', {
544 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in environment to ld.
545 }, {
546 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
547 }],
548 ],
reed@google.com0069aa52011-11-17 15:35:47 +0000549# trying to get this to work, but it needs clang I think...
550# 'WARNING_CFLAGS': '-Wexit-time-destructors',
mike@reedtribe.orge51755f2011-12-10 19:36:56 +0000551 'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
caryclark@google.comb462a422012-06-06 12:12:28 +0000552 'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
553 'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'YES',
554 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'YES',
555 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
556 'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
557 'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
558 'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
559 'GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL': 'YES',
560 'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
561 'GCC_WARN_MISSING_PARENTHESES': 'YES',
562 'GCC_WARN_PROTOTYPE_CONVERSION': 'YES',
563 'GCC_WARN_SIGN_COMPARE': 'YES',
564 'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
565 'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
566 'GCC_WARN_UNUSED_FUNCTION': 'YES',
567 'GCC_WARN_UNUSED_LABEL': 'YES',
568 'GCC_WARN_UNUSED_VALUE': 'YES',
569 'GCC_WARN_UNUSED_VARIABLE': 'YES',
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000570 'OTHER_CPLUSPLUSFLAGS': [
571 '-mssse3',
572 '-fvisibility=hidden',
573 '-fvisibility-inlines-hidden',
574 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000575 },
576 },
577 ],
578
borenet@google.coma72aef82013-03-22 13:16:06 +0000579 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000580 {
581 'defines': [
582 'SK_BUILD_FOR_IOS',
583 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000584 'conditions' : [
585 [ 'skia_warnings_as_errors', {
586 'xcode_settings': {
587 'OTHER_CPLUSPLUSFLAGS': [
588 '-Werror',
589 ],
590 },
591 }],
592 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000593 'configurations': {
594 'Debug': {
595 'xcode_settings': {
596 'GCC_OPTIMIZATION_LEVEL': '0',
597 },
598 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000599 'Release': {
600 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000601 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000602 },
603 'defines': [ 'NDEBUG' ],
604 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000605 },
606 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000607 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000608 'CODE_SIGNING_REQUIRED': 'NO',
609 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000610 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000611 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000612 'TARGETED_DEVICE_FAMILY': '1,2',
borenet@google.coma72aef82013-03-22 13:16:06 +0000613 'OTHER_CPLUSPLUSFLAGS': [
614 '-fvisibility=hidden',
615 '-fvisibility-inlines-hidden',
616 ],
bsalomon@google.com89dec582012-09-28 18:33:11 +0000617 'GCC_THUMB_SUPPORT': 'NO',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000618 },
619 },
620 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000621
borenet@google.coma72aef82013-03-22 13:16:06 +0000622 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000623 {
624 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000625 'SK_BUILD_FOR_ANDROID',
bungeman@google.com451b5962013-11-11 18:36:46 +0000626 'SK_FONTHOST_DOES_NOT_USE_FONTMGR',
djsollen@google.com968757e2014-04-11 13:09:21 +0000627
628 # Android Text Tuning
629 'SK_GAMMA_EXPONENT=1.4',
630 'SK_GAMMA_CONTRAST=0.0',
631 ],
632 # Android defines a fixed gamma exponent instead of using SRGB
633 'defines!': [
634 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000635 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000636 'configurations': {
637 'Debug': {
638 'cflags': ['-g']
639 },
640 'Release': {
641 'cflags': ['-O2'],
642 'defines': [ 'NDEBUG' ],
643 },
644 },
djsollen@google.com58629292011-11-03 13:08:29 +0000645 'libraries': [
scroggo@google.comeb629502014-02-04 16:08:48 +0000646 '-lstdc++',
647 '-lm',
djsollen@google.com318cf922011-11-08 19:03:43 +0000648 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000649 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000650 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000651 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000652 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000653 'conditions': [
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000654 [ 'skia_android_framework', {
655 'libraries!': [
656 '-lstdc++',
657 '-lm',
658 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000659 'cflags!': [
660 '-fuse-ld=gold',
661 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000662 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000663 [ 'skia_shared_lib', {
664 'cflags': [
665 '-fPIC',
666 ],
667 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000668 'SKIA_DLL',
669 'SKIA_IMPLEMENTATION=1',
scroggoecce60b2014-07-09 07:26:40 -0700670 # Needed until we fix skbug.com/2440.
671 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
djsollen@google.com52f02972013-06-03 12:10:19 +0000672 ],
673 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000674 [ 'skia_profile_enabled == 1', {
675 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000676 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000677 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000678 },
679 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000680
digit@google.com1771cbf2012-01-26 21:26:40 +0000681 # We can POD-style initialization of static mutexes to avoid generating
682 # static initializers if we're using a pthread-compatible thread interface.
683 [ 'skia_os != "win"', {
684 'defines': [
borenet@google.com7158e6a2012-11-01 17:43:44 +0000685 'SK_USE_POSIX_THREADS',
digit@google.com1771cbf2012-01-26 21:26:40 +0000686 ],
687 }],
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000688
689 [ 'skia_moz2d', {
690 'defines': [
reed6518eaa2014-06-18 14:05:22 -0700691 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000692 ],
693 }],
694
mtklein4d1605a2014-07-10 14:16:04 -0700695 [ 'skia_crash_handler', {
696 'defines': [ 'SK_CRASH_HANDLER' ],
697 }],
698
seanpaul@google.com1134f982011-09-15 14:24:33 +0000699 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000700 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
701 'xcode_settings': {
702 'SYMROOT': '<(DEPTH)/xcodebuild',
703 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000704}