blob: b088b7a06df79f4570035f96fe118b132d92a51b [file] [log] [blame]
scroggo3e562272015-03-25 10:22:41 -07001# Copyright 2015 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
mtkleindee3df92015-03-26 05:30:44 -07005
seanpaul@google.com1134f982011-09-15 14:24:33 +00006# conditions used in both common.gypi and skia.gyp in chromium
7#
8{
chudy@google.combbad34d2012-08-13 14:26:36 +00009 'defines': [
10 'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
mtklein@google.comdad70702013-11-20 18:06:10 +000011 'SK_SUPPORT_GPU=<(skia_gpu)',
12 'SK_SUPPORT_OPENCL=<(skia_opencl)',
jvanverth4736e142014-11-07 07:12:46 -080013 'SK_FORCE_DISTANCE_FIELD_TEXT=<(skia_force_distance_field_text)',
chudy@google.combbad34d2012-08-13 14:26:36 +000014 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000015 'conditions' : [
scroggoc0bc9132014-07-22 12:09:30 -070016 ['skia_pic', {
17 'cflags': [
18 '-fPIC',
19 ],
20 'conditions' : [
21 # FIXME: The reason we don't do this on Android is due to the way
22 # we build the executables/skia_launcher on Android. See
23 # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
24 ['skia_os != "android"', {
25 'target_conditions': [
26 [ '_type == "executable"', {
27 'cflags': [ '-fPIE' ],
28 'ldflags': [ '-pie' ],
29 }],
30 ],
31 }],
32 ],
33 }],
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000034
commit-bot@chromium.org6a106ce2014-05-20 19:02:55 +000035 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
36 [ 'skia_arch_type == "x86"', {
37 'cflags': [
38 '-msse2',
39 '-mfpmath=sse',
40 ],
41 }],
42
borenet@google.coma72aef82013-03-22 13:16:06 +000043 [ 'skia_os == "win"',
seanpaul@google.com1134f982011-09-15 14:24:33 +000044 {
45 'defines': [
46 'SK_BUILD_FOR_WIN32',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000047 '_CRT_SECURE_NO_WARNINGS',
senorblanco@chromium.org5f47a392012-07-12 00:34:39 +000048 'GR_GL_FUNCTION_TYPE=__stdcall',
seanpaul@google.com1134f982011-09-15 14:24:33 +000049 ],
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000050 'msvs_disabled_warnings': [
bungemanf5484442014-09-10 07:49:05 -070051 4275, # An exported class was derived from a class that was not exported
52 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
53 4355, # 'this' used in base member initializer list. Off by default in newer compilers.
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000054 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000055 'msvs_cygwin_shell': 0,
56 'msvs_settings': {
57 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000058 'WarningLevel': '3',
59 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000060 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000061 'ExceptionHandling': '0',
62 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000063 },
64 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000065 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000066 'AdditionalDependencies': [
67 'OpenGL32.lib',
68 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000069
70 # Prior to gyp r1584, the following were included automatically.
71 'kernel32.lib',
72 'gdi32.lib',
73 'winspool.lib',
74 'comdlg32.lib',
75 'advapi32.lib',
76 'shell32.lib',
77 'ole32.lib',
78 'oleaut32.lib',
79 'user32.lib',
80 'uuid.lib',
81 'odbc32.lib',
82 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +000083 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +000084 ],
85 },
86 },
87 'configurations': {
88 'Debug': {
89 'msvs_settings': {
90 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000091 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +000092 'Optimization': '0', # optimizeDisabled (/Od)
93 'PreprocessorDefinitions': ['_DEBUG'],
94 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000095 '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
99 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +0000100 },
101 },
102 },
103 'Release': {
104 'msvs_settings': {
105 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000106 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000107 'Optimization': '<(skia_release_optimization_level)',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000108 # Changing the floating point model requires rebaseling gm images
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000109 #'FloatingPointModel': '2', # fast (/fp:fast)
110 'FavorSizeOrSpeed': '1', # speed (/Ot)
seanpaul@google.com1134f982011-09-15 14:24:33 +0000111 'PreprocessorDefinitions': ['NDEBUG'],
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000112 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000113 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
114 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000115 },
116 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000117 'GenerateDebugInformation': 'true', # /DEBUG
bungeman@google.com983297e2011-10-03 19:36:51 +0000118 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000119 },
120 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000121 },
122 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000123 # Gyp's ninja generator depends on these specially named
124 # configurations to build 64-bit on Windows.
125 # See http://skbug.com/2348
126 #
127 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
128 # OK for us to just make these inherit non-archwidth-specific
129 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000130 #
131 # See http://skbug.com/2442 : These targets cause problems in the
132 # MSVS build, so only include them if gyp is generating a ninja build.
133 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
134 'configurations': {
135 'Debug_x64': {
136 'inherit_from': ['Debug'],
bsalomon6740feb2014-11-13 13:47:06 -0800137 'msvs_settings': {
138 'VCCLCompilerTool': {
139 # /ZI is not supported on 64bit
140 'DebugInformationFormat': '3', # programDatabase (/Zi)
141 },
142 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000143 },
144 'Release_x64': {
145 'inherit_from': ['Release'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800146 'msvs_settings': {
147 'VCCLCompilerTool': {
148 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
149 'EnableEnhancedInstructionSet': '0', #
150 },
151 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000152 },
153 'Release_Developer_x64': {
154 'inherit_from': ['Release_Developer'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800155 'msvs_settings': {
156 'VCCLCompilerTool': {
157 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
158 'EnableEnhancedInstructionSet': '0', #
159 },
160 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000161 },
162 },
163 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000164 [ 'skia_arch_width == 64', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000165 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000166 }],
167 [ 'skia_arch_width == 32', {
168 'msvs_configuration_platform': 'Win32',
169 }],
170 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000171 'msvs_settings': {
172 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000173 'WarnAsError': 'true',
174 'AdditionalOptions': [
175 '/we4189', # initialized but unused var warning
176 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000177 },
178 },
borenet@google.comb7961192012-08-20 18:58:26 +0000179 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000180 [ 'skia_win_exceptions', {
181 'msvs_settings': {
182 'VCCLCompilerTool': {
183 'AdditionalOptions': [
184 '/EHsc',
185 ],
186 },
187 },
188 }],
bsalomonda07a082014-06-26 12:56:28 -0700189 [ 'skia_win_ltcg', {
190 'configurations': {
191 'Release': {
192 'msvs_settings': {
193 'VCCLCompilerTool': {
194 'WholeProgramOptimization': 'true', #/GL
195 },
196 'VCLinkerTool': {
197 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
198 },
199 'VCLibrarianTool': {
200 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
201 },
202 },
203 },
204 },
205 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000206 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000207 },
208 ],
209
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000210 # The following section is common to linux + derivatives and android
borenet48087572015-04-02 12:16:36 -0700211 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos", "android"]',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000212 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000213 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000214 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000215 '-fno-exceptions',
216 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000217
mtklein@google.comf1077f92013-11-20 15:13:49 +0000218 '-Wall',
219 '-Wextra',
220 '-Winit-self',
221 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800222 '-Wsign-compare',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000223
224 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000225 ],
226 'cflags_cc': [
mtkleinf3cdce72015-02-05 09:23:56 -0800227 '-std=c++11',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000228 '-fno-rtti',
229 '-Wnon-virtual-dtor',
mtklein24ad0962014-06-17 11:47:40 -0700230 '-Wno-invalid-offsetof', # GCC <4.6 is old-school strict about what is POD.
mtklein@google.comf1077f92013-11-20 15:13:49 +0000231 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000232 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700233 [ 'skia_fast', { 'cflags': [ '<@(skia_fast_flags)' ] }],
qiankun.miaod312a042014-07-07 09:47:24 -0700234 [ 'skia_os != "chromeos"', {
235 'conditions': [
scroggo7cd3f642015-02-12 13:27:40 -0800236 [ 'skia_arch_type == "x86_64" and not skia_android_framework', {
qiankun.miaod312a042014-07-07 09:47:24 -0700237 'cflags': [
238 '-m64',
239 ],
240 'ldflags': [
241 '-m64',
242 ],
243 }],
scroggo7cd3f642015-02-12 13:27:40 -0800244 [ 'skia_arch_type == "x86" and not skia_android_framework', {
qiankun.miaod312a042014-07-07 09:47:24 -0700245 'cflags': [
246 '-m32',
247 ],
248 'ldflags': [
249 '-m32',
250 ],
251 }],
252 ],
253 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000254 [ 'skia_warnings_as_errors', {
255 'cflags': [
256 '-Werror',
257 ],
258 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000259 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
260 [ 'skia_disable_inlining', {
261 'cflags': [
262 '-fno-inline',
263 '-fno-default-inline',
264 '-finline-limit=0',
265 '-fno-omit-frame-pointer',
266 ],
267 }],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000268 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000269 'cflags': [
270 '-march=armv7-a',
mtklein2d33a1d2015-04-02 10:47:57 -0700271 '-mthumb',
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 }],
mtklein19996ed2014-11-21 06:48:43 -0800290 [ 'skia_os != "chromeos" and skia_os != "linux"', {
borenet@google.come2b90372013-07-11 18:46:30 +0000291 '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',
djsollenf379ad32015-01-27 09:01:01 -0800345
346 # We can't use the skia_shared_library gyp setting because we need to
347 # isolate this define to Skia sources. CFLAGS are local to Android.mk
348 # and ensures that this define is not exported to clients of the library
349 '-DSKIA_IMPLEMENTATION=1',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000350 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000351 # Remove flags which are either unnecessary or problematic for the
352 # Android framework build. Many of these flags are removed simply because
353 # they were not previously in the Android framework makefile, and we did
354 # did not intend to add them when generating the makefile.
355 # TODO (scroggo): Investigate whether any of these flags are actually
356 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000357 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000358 # Android has one makefile, used for both debugging (after manual
359 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000360 '-g',
361 '-march=armv7-a',
362 '-mthumb',
363 '-mfpu=neon',
364 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000365 '-fno-exceptions',
366 '-fstrict-aliasing',
367 # Remove flags to turn on warnings, since most people building Android
368 # are not focused on Skia and do not need the extra warning info.
369 '-Wall',
370 '-Wextra',
371 '-Winit-self',
372 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800373 '-Wsign-compare',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000374 ],
375 'cflags_cc!': [
376 '-fno-rtti',
377 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000378 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000379 'defines': [
380 'DCT_IFAST_SUPPORTED',
381 # using freetype's embolden allows us to adjust fake bold settings at
382 # draw-time, at which point we know which SkTypeface is being drawn
383 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000384 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
385 # When built as part of the system image we can enable certian non-NDK
386 # compliant optimizations.
387 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000388 # Optimizations for chromium (m30)
389 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
390 'IGNORE_ROT_AA_RECT_OPT',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000391 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000392 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700393 'SK_IGNORE_ETC1_SUPPORT',
djsollenf379ad32015-01-27 09:01:01 -0800394 # We can't use the skia_shared_library gyp setting because we need expose
395 # this define globally and the the implemention define as a cflag.
396 'SKIA_DLL',
scroggo230d4ac2015-03-26 07:15:55 -0700397 'SK_PRINT_CODEC_MESSAGES',
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000398 # Defines from skia_for_android_framework_defines.gypi
399 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000400 ],
401 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000402
borenet48087572015-04-02 12:16:36 -0700403 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000404 {
405 'defines': [
406 'SK_SAMPLES_FOR_X',
407 'SK_BUILD_FOR_UNIX',
408 ],
409 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000410 'Coverage': {
borenet11271fe2015-07-06 07:43:58 -0700411 'conditions': [
412 [ 'skia_clang_build', {
413 'cflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
414 'ldflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
415 }, {
416 'cflags': ['--coverage'],
417 'ldflags': ['--coverage'],
418 }],
419 ],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000420 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000421 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000422 },
423 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000424 'cflags': [
425 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000426 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000427 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000428 },
429 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000430 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000431 [ 'skia_shared_lib', {
zachr@google.com28c27c82013-06-20 17:15:05 +0000432 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000433 'SKIA_DLL',
434 'SKIA_IMPLEMENTATION=1',
435 ],
436 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000437 # Enable asan, tsan, etc.
438 [ 'skia_sanitizer', {
borenet@google.com0d193092013-07-03 15:55:05 +0000439 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000440 '-fsanitize=<(skia_sanitizer)',
borenet@google.com0d193092013-07-03 15:55:05 +0000441 ],
442 'ldflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000443 '-fsanitize=<(skia_sanitizer)',
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000444 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000445 'conditions' : [
446 [ 'skia_sanitizer == "thread"', {
mtklein172b4552015-03-12 05:27:46 -0700447 'defines': [ 'THREAD_SANITIZER' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000448 }],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000449 [ 'skia_sanitizer == "undefined"', {
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000450 'cflags_cc!': ['-fno-rtti'],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000451 }],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000452 ],
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000453 }],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000454 [ 'skia_clang_build', {
mtklein170e00d2014-06-30 12:33:11 -0700455 'cflags_cc': [
mtklein170e00d2014-06-30 12:33:11 -0700456 '-Wno-unknown-warning-option', # Allows unknown warnings.
457 '-Wno-deprecated', # From Qt, via debugger (older Clang).
458 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
459 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000460 'cflags': [
mtklein170e00d2014-06-30 12:33:11 -0700461 # Extra warnings we like but that only Clang knows about.
462 '-Wstring-conversion',
borenet@google.com47ae4b02013-08-21 18:02:50 +0000463 ],
commit-bot@chromium.org815d3602014-05-20 19:42:03 +0000464 'cflags!': [
465 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
466 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000467 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000468 [ 'skia_keep_frame_pointer', {
469 'cflags': [ '-fno-omit-frame-pointer' ],
470 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000471 ],
472 },
473 ],
474
borenet@google.coma72aef82013-03-22 13:16:06 +0000475 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000476 {
mtkleina34633f2014-08-19 13:32:59 -0700477 'defines': [ 'SK_BUILD_FOR_MAC' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000478 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000479 'Coverage': {
480 'xcode_settings': {
481 'GCC_OPTIMIZATION_LEVEL': '0',
482 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
483 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
484 },
485 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000486 'Debug': {
mtkleina34633f2014-08-19 13:32:59 -0700487 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0' },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000488 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000489 'Release': {
mtkleina34633f2014-08-19 13:32:59 -0700490 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)', },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000491 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000492 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000493 },
494 'xcode_settings': {
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000495 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700496 [ 'skia_fast', { 'WARNING_CFLAGS': [ '<@(skia_fast_flags)' ] } ],
mtkleina34633f2014-08-19 13:32:59 -0700497 [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
498 [ 'skia_arch_width == 32', { 'ARCHS': ['i386'] }],
499 [ 'skia_arch_width == 64', { 'ARCHS': ['x86_64'] }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000500 [ 'skia_osx_deployment_target==""', {
mtkleina34633f2014-08-19 13:32:59 -0700501 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in env to ld.
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000502 }, {
503 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
504 }],
505 ],
mtklein65fd5992015-02-03 13:24:36 -0800506 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
mtklein94c41512014-09-12 17:07:34 -0700507 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
508 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
509 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
mtklein335a0ae2014-10-13 12:32:34 -0700510 'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks
511 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings
512 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
mtkleina34633f2014-08-19 13:32:59 -0700513 'WARNING_CFLAGS': [
514 '-Wall',
515 '-Wextra',
mtkleina07b2972015-01-23 07:01:26 -0800516 '-Winit-self',
517 '-Wpointer-arith',
518 '-Wsign-compare',
519
mtkleina34633f2014-08-19 13:32:59 -0700520 '-Wno-unused-parameter',
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',
mtkleinea6075e2015-04-16 13:29:58 -0700556 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer: Google Development (3F4Y5873JF)',
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',
mtklein335a0ae2014-10-13 12:32:34 -0700560 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
borenet@google.coma72aef82013-03-22 13:16:06 +0000561 'OTHER_CPLUSPLUSFLAGS': [
mtkleinf3cdce72015-02-05 09:23:56 -0800562 '-std=c++0x',
borenet@google.coma72aef82013-03-22 13:16:06 +0000563 '-fvisibility=hidden',
564 '-fvisibility-inlines-hidden',
565 ],
bsalomon@google.com89dec582012-09-28 18:33:11 +0000566 'GCC_THUMB_SUPPORT': 'NO',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000567 },
568 },
569 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000570
borenet@google.coma72aef82013-03-22 13:16:06 +0000571 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000572 {
573 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000574 'SK_BUILD_FOR_ANDROID',
djsollen@google.com968757e2014-04-11 13:09:21 +0000575
576 # Android Text Tuning
577 'SK_GAMMA_EXPONENT=1.4',
578 'SK_GAMMA_CONTRAST=0.0',
579 ],
580 # Android defines a fixed gamma exponent instead of using SRGB
581 'defines!': [
582 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000583 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000584 'configurations': {
585 'Debug': {
mtkleinc0591ca2014-11-21 14:42:35 -0800586 'cflags': ['-g']
scroggo@google.comeb629502014-02-04 16:08:48 +0000587 },
588 'Release': {
589 'cflags': ['-O2'],
scroggo@google.comeb629502014-02-04 16:08:48 +0000590 },
591 },
djsollen@google.com58629292011-11-03 13:08:29 +0000592 'libraries': [
djsollen@google.com318cf922011-11-08 19:03:43 +0000593 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000594 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000595 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000596 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000597 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000598 'conditions': [
scroggodf1c3372015-02-12 10:48:25 -0800599 [ '"x86" in skia_arch_type', {
djsollenbc893292014-07-24 13:53:56 -0700600 'cflags': [
601 '-mssse3',
602 ],
603 }],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000604 [ 'skia_android_framework', {
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000605 'cflags!': [
606 '-fuse-ld=gold',
scroggo7cd3f642015-02-12 13:27:40 -0800607 '-mssse3',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000608 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000609 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000610 [ 'skia_shared_lib', {
djsollen@google.com52f02972013-06-03 12:10:19 +0000611 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000612 'SKIA_DLL',
613 'SKIA_IMPLEMENTATION=1',
scroggoecce60b2014-07-09 07:26:40 -0700614 # Needed until we fix skbug.com/2440.
615 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
djsollen@google.com52f02972013-06-03 12:10:19 +0000616 ],
617 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000618 [ 'skia_profile_enabled == 1', {
619 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000620 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000621 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000622 },
623 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000624
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000625 [ 'skia_moz2d', {
626 'defines': [
reed6518eaa2014-06-18 14:05:22 -0700627 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000628 ],
629 }],
630
mtklein4abc1862015-07-14 05:52:52 -0700631 [ 'sknx_no_simd', {
632 'defines': [ 'SKNX_NO_SIMD' ],
633 }],
634
seanpaul@google.com1134f982011-09-15 14:24:33 +0000635 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000636 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
637 'xcode_settings': {
638 'SYMROOT': '<(DEPTH)/xcodebuild',
639 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000640}