blob: 65ef9ed8b7fd977c2fdaef56a1f232266b16efd3 [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)',
jvanverth4736e142014-11-07 07:12:46 -080012 'SK_FORCE_DISTANCE_FIELD_TEXT=<(skia_force_distance_field_text)',
mtklein8d7f5c32016-08-01 09:22:12 -070013
msarettad3a5c62016-05-06 07:21:26 -070014 # Indicate that all dependency libraries are present. Clients that
15 # are missing some of the required decoding libraries may choose
16 # not to define these. This will disable some decoder and encoder
17 # features.
18 'SK_HAS_GIF_LIBRARY',
19 'SK_HAS_JPEG_LIBRARY',
20 'SK_HAS_PNG_LIBRARY',
21 'SK_HAS_WEBP_LIBRARY',
chudy@google.combbad34d2012-08-13 14:26:36 +000022 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000023 'conditions' : [
bsalomonad514d02016-03-02 14:44:15 -080024 [ 'skia_is_bot', {
25 'defines': [ 'SK_IS_BOT' ],
26 }],
scroggo1497f9f2016-02-02 11:56:33 -080027 [ 'skia_codec_decodes_raw', {
28 'defines': [
29 'SK_CODEC_DECODES_RAW',
30 ],
31 }],
msarettff174032016-07-19 11:17:55 -070032 [ 'skia_android_framework == 0', {
33 'defines': [
34 # Temporarily test against the QCMS library.
35 'SK_TEST_QCMS',
36 ],
37 }],
scroggoc0bc9132014-07-22 12:09:30 -070038 ['skia_pic', {
39 'cflags': [
40 '-fPIC',
41 ],
42 'conditions' : [
43 # FIXME: The reason we don't do this on Android is due to the way
44 # we build the executables/skia_launcher on Android. See
45 # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
46 ['skia_os != "android"', {
47 'target_conditions': [
48 [ '_type == "executable"', {
49 'cflags': [ '-fPIE' ],
50 'ldflags': [ '-pie' ],
51 }],
52 ],
53 }],
54 ],
55 }],
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000056
commit-bot@chromium.org6a106ce2014-05-20 19:02:55 +000057 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
58 [ 'skia_arch_type == "x86"', {
59 'cflags': [
60 '-msse2',
61 '-mfpmath=sse',
62 ],
63 }],
64
borenet@google.coma72aef82013-03-22 13:16:06 +000065 [ 'skia_os == "win"',
seanpaul@google.com1134f982011-09-15 14:24:33 +000066 {
67 'defines': [
68 'SK_BUILD_FOR_WIN32',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000069 '_CRT_SECURE_NO_WARNINGS',
senorblanco@chromium.org5f47a392012-07-12 00:34:39 +000070 'GR_GL_FUNCTION_TYPE=__stdcall',
bungemanb7069e92015-07-21 14:14:30 -070071 '_HAS_EXCEPTIONS=0',
egdaniel5dfe7bb2016-06-10 06:42:45 -070072 'WIN32_LEAN_AND_MEAN',
73 'NOMINMAX',
seanpaul@google.com1134f982011-09-15 14:24:33 +000074 ],
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000075 'msvs_disabled_warnings': [
bungemanf5484442014-09-10 07:49:05 -070076 4275, # An exported class was derived from a class that was not exported
77 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
78 4355, # 'this' used in base member initializer list. Off by default in newer compilers.
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000079 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000080 'msvs_cygwin_shell': 0,
81 'msvs_settings': {
82 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000083 'WarningLevel': '3',
84 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000085 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000086 'ExceptionHandling': '0',
87 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000088 },
89 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000090 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000091 'AdditionalDependencies': [
92 'OpenGL32.lib',
93 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000094
95 # Prior to gyp r1584, the following were included automatically.
96 'kernel32.lib',
97 'gdi32.lib',
98 'winspool.lib',
99 'comdlg32.lib',
100 'advapi32.lib',
101 'shell32.lib',
102 'ole32.lib',
103 'oleaut32.lib',
104 'user32.lib',
105 'uuid.lib',
106 'odbc32.lib',
107 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +0000108 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000109 ],
110 },
111 },
112 'configurations': {
113 'Debug': {
114 'msvs_settings': {
115 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000116 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +0000117 'Optimization': '0', # optimizeDisabled (/Od)
118 'PreprocessorDefinitions': ['_DEBUG'],
119 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000120 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000121 },
122 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000123 'GenerateDebugInformation': 'true', # /DEBUG
124 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +0000125 },
126 },
127 },
128 'Release': {
129 'msvs_settings': {
130 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000131 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000132 'Optimization': '<(skia_release_optimization_level)',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000133 # Changing the floating point model requires rebaseling gm images
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000134 #'FloatingPointModel': '2', # fast (/fp:fast)
135 'FavorSizeOrSpeed': '1', # speed (/Ot)
seanpaul@google.com1134f982011-09-15 14:24:33 +0000136 'PreprocessorDefinitions': ['NDEBUG'],
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000137 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000138 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
139 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000140 },
141 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000142 'GenerateDebugInformation': 'true', # /DEBUG
bungeman@google.com983297e2011-10-03 19:36:51 +0000143 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000144 },
145 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000146 },
147 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000148 # Gyp's ninja generator depends on these specially named
149 # configurations to build 64-bit on Windows.
halcanary6950de62015-11-07 05:29:00 -0800150 # See https://bug.skia.org/2348
epoger@google.com58d69d82014-04-01 07:02:41 +0000151 #
152 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
153 # OK for us to just make these inherit non-archwidth-specific
154 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000155 #
halcanary6950de62015-11-07 05:29:00 -0800156 # See https://bug.skia.org/2442 : These targets cause problems in the
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000157 # MSVS build, so only include them if gyp is generating a ninja build.
158 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
159 'configurations': {
160 'Debug_x64': {
161 'inherit_from': ['Debug'],
bsalomon6740feb2014-11-13 13:47:06 -0800162 'msvs_settings': {
163 'VCCLCompilerTool': {
164 # /ZI is not supported on 64bit
165 'DebugInformationFormat': '3', # programDatabase (/Zi)
166 },
167 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000168 },
169 'Release_x64': {
170 'inherit_from': ['Release'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800171 'msvs_settings': {
172 'VCCLCompilerTool': {
173 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
174 'EnableEnhancedInstructionSet': '0', #
175 },
176 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000177 },
178 'Release_Developer_x64': {
179 'inherit_from': ['Release_Developer'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800180 'msvs_settings': {
181 'VCCLCompilerTool': {
182 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
183 'EnableEnhancedInstructionSet': '0', #
184 },
185 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000186 },
187 },
188 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400189 [ 'skia_arch_type == "x86_64"', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000190 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000191 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400192 [ 'skia_arch_type == "x86"', {
borenet@google.coma72aef82013-03-22 13:16:06 +0000193 'msvs_configuration_platform': 'Win32',
194 }],
195 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000196 'msvs_settings': {
197 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000198 'WarnAsError': 'true',
199 'AdditionalOptions': [
200 '/we4189', # initialized but unused var warning
bungeman918090c2016-02-09 09:14:28 -0800201 '/we4238', # taking address of rvalue
202 '/we4239', # assigning rvalues to non-const lvalues
borenet@google.coma72aef82013-03-22 13:16:06 +0000203 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000204 },
205 },
borenet@google.comb7961192012-08-20 18:58:26 +0000206 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000207 [ 'skia_win_exceptions', {
208 'msvs_settings': {
209 'VCCLCompilerTool': {
210 'AdditionalOptions': [
211 '/EHsc',
212 ],
213 },
214 },
215 }],
bsalomonda07a082014-06-26 12:56:28 -0700216 [ 'skia_win_ltcg', {
217 'configurations': {
218 'Release': {
219 'msvs_settings': {
220 'VCCLCompilerTool': {
221 'WholeProgramOptimization': 'true', #/GL
222 },
223 'VCLinkerTool': {
224 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
225 },
226 'VCLibrarianTool': {
227 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
228 },
229 },
230 },
231 },
232 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000233 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000234 },
235 ],
236
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000237 # The following section is common to linux + derivatives and android
borenet43bf5112016-04-29 14:01:34 -0700238 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android"]',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000239 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000240 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000241 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000242 '-fno-exceptions',
243 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000244
mtklein@google.comf1077f92013-11-20 15:13:49 +0000245 '-Wall',
246 '-Wextra',
247 '-Winit-self',
248 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800249 '-Wsign-compare',
dvonbeck115e9252016-06-15 09:13:50 -0700250 '-Wvla',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000251
252 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000253 ],
254 'cflags_cc': [
mtkleinf3cdce72015-02-05 09:23:56 -0800255 '-std=c++11',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000256 '-fno-rtti',
mtklein61a81e32015-09-09 10:46:20 -0700257 '-fno-threadsafe-statics',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000258 '-Wnon-virtual-dtor',
259 ],
mtklein673748a2016-03-07 11:05:15 -0800260 'ldflags': [ '-rdynamic' ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000261 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700262 [ 'skia_fast', { 'cflags': [ '<@(skia_fast_flags)' ] }],
borenet43bf5112016-04-29 14:01:34 -0700263 [ 'skia_arch_type == "x86_64" and not skia_android_framework', {
264 'cflags': [
265 '-m64',
266 ],
267 'ldflags': [
268 '-m64',
269 ],
270 }],
271 [ 'skia_arch_type == "x86" and not skia_android_framework', {
272 'cflags': [
273 '-m32',
274 ],
275 'ldflags': [
276 '-m32',
qiankun.miaod312a042014-07-07 09:47:24 -0700277 ],
278 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000279 [ 'skia_warnings_as_errors', {
280 'cflags': [
281 '-Werror',
282 ],
283 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000284 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
285 [ 'skia_disable_inlining', {
286 'cflags': [
287 '-fno-inline',
288 '-fno-default-inline',
289 '-finline-limit=0',
290 '-fno-omit-frame-pointer',
291 ],
292 }],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000293 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000294 'cflags': [
295 '-march=armv7-a',
mtklein2d33a1d2015-04-02 10:47:57 -0700296 '-mthumb',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000297 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000298 'ldflags': [
299 '-march=armv7-a',
300 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000301 'conditions': [
302 [ 'arm_neon == 1', {
303 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700304 'SK_ARM_HAS_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000305 ],
306 'cflags': [
307 '-mfpu=neon',
308 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000309 }],
borenet43bf5112016-04-29 14:01:34 -0700310 [ 'skia_os != "linux"', {
borenet@google.come2b90372013-07-11 18:46:30 +0000311 'cflags': [
312 '-mfloat-abi=softfp',
313 ],
314 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000315 ],
316 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400317 [ '"mips" in skia_arch_type', {
milko.leporis401e77c2016-06-05 13:14:21 -0700318 'target_conditions': [
319 [ '_toolset == "target"', {
320 'cflags' : ['-EL'],
321 'conditions' : [
322 [ 'mips_arch_variant == "mips32r2"', {
323 'cflags': [ '-march=mips32r2' ],
324 'conditions': [
325 [ 'mips_dsp == 1', { 'cflags': [ '-mdsp' ] }],
326 [ 'mips_dsp == 2', { 'cflags': [ '-mdspr2' ] }],
327 ],
328 }],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700329 ],
330 }],
331 ],
332 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000333 ],
334 },
335 ],
336
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000337 ['skia_android_framework', {
338 'cflags': [
339 # Skia does not enforce this usage pattern so we disable it here to avoid
340 # unecessary log spew when building
341 '-Wno-unused-parameter',
342
343 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
344 # Revert to -D_FORTIFY_SOURCE=1
345 '-U_FORTIFY_SOURCE',
346 '-D_FORTIFY_SOURCE=1',
djsollenf379ad32015-01-27 09:01:01 -0800347
mtklein9a106ba2015-08-14 10:03:45 -0700348 # We can't use the skia_shared_lib gyp setting because we need to
djsollenf379ad32015-01-27 09:01:01 -0800349 # isolate this define to Skia sources. CFLAGS are local to Android.mk
350 # and ensures that this define is not exported to clients of the library
351 '-DSKIA_IMPLEMENTATION=1',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000352 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000353 # Remove flags which are either unnecessary or problematic for the
354 # Android framework build. Many of these flags are removed simply because
355 # they were not previously in the Android framework makefile, and we did
356 # did not intend to add them when generating the makefile.
357 # TODO (scroggo): Investigate whether any of these flags are actually
358 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000359 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000360 # Android has one makefile, used for both debugging (after manual
361 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000362 '-g',
363 '-march=armv7-a',
364 '-mthumb',
365 '-mfpu=neon',
366 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000367 '-fno-exceptions',
368 '-fstrict-aliasing',
369 # Remove flags to turn on warnings, since most people building Android
370 # are not focused on Skia and do not need the extra warning info.
371 '-Wall',
372 '-Wextra',
373 '-Winit-self',
374 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800375 '-Wsign-compare',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000376 ],
377 'cflags_cc!': [
378 '-fno-rtti',
379 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000380 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000381 'defines': [
382 'DCT_IFAST_SUPPORTED',
383 # using freetype's embolden allows us to adjust fake bold settings at
384 # draw-time, at which point we know which SkTypeface is being drawn
385 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000386 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
387 # When built as part of the system image we can enable certian non-NDK
388 # compliant optimizations.
389 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000390 # Optimizations for chromium (m30)
391 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000392 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000393 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700394 'SK_IGNORE_ETC1_SUPPORT',
mtklein9a106ba2015-08-14 10:03:45 -0700395 # We can't use the skia_shared_lib gyp setting because we need expose
djsollenf379ad32015-01-27 09:01:01 -0800396 # this define globally and the the implemention define as a cflag.
397 'SKIA_DLL',
scroggo230d4ac2015-03-26 07:15:55 -0700398 'SK_PRINT_CODEC_MESSAGES',
borenet243406e2015-07-22 13:29:25 -0700399 ],
400 }],
401
402 ['skia_use_android_framework_defines', {
403 # Add these defines when building for the Android framework, or when
404 # specifically requested. These should be temporary staging defines. Any
405 # permanent defines should be moved into the skia_android_framework block
406 # above.
407 'includes' : [
408 'skia_for_android_framework_defines.gypi',
409 ],
410 'defines': [
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000411 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000412 ],
413 }],
mtkleind7b25c72015-11-12 08:41:40 -0800414
joshualitt47fdae92015-11-09 12:30:05 -0800415 [ 'skia_use_sdl == 1',
416 {
417 'defines': [ 'SK_USE_SDL' ],
418 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000419
joshualittf16f88b2015-12-02 13:00:37 -0800420 [ 'skia_dump_stats == 1',
421 {
422 'defines': [ 'SK_DUMP_STATS'],
423 }],
424
borenet43bf5112016-04-29 14:01:34 -0700425 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000426 {
427 'defines': [
428 'SK_SAMPLES_FOR_X',
429 'SK_BUILD_FOR_UNIX',
430 ],
431 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000432 'Coverage': {
borenet11271fe2015-07-06 07:43:58 -0700433 'conditions': [
434 [ 'skia_clang_build', {
435 'cflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
436 'ldflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
437 }, {
438 'cflags': ['--coverage'],
439 'ldflags': ['--coverage'],
440 }],
441 ],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000442 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000443 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000444 },
445 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000446 'cflags': [
447 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000448 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000449 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000450 },
451 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000452 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000453 [ 'skia_shared_lib', {
zachr@google.com28c27c82013-06-20 17:15:05 +0000454 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000455 'SKIA_DLL',
456 'SKIA_IMPLEMENTATION=1',
457 ],
458 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000459 # Enable asan, tsan, etc.
460 [ 'skia_sanitizer', {
mtklein632199e2015-12-09 12:39:01 -0800461 'cflags_cc!': [ '-fno-rtti' ], # vptr needs rtti
borenet@google.com0d193092013-07-03 15:55:05 +0000462 'cflags': [
mtkleinbb5b77d2015-12-08 14:26:17 -0800463 '-fsanitize=<(skia_sanitizer)', # Turn on sanitizers.
464 '-fno-sanitize-recover=<(skia_sanitizer)', # Make any failure fatal.
465 '-fsanitize-blacklist=<(skia_sanitizer_blacklist)', # Compile in our blacklist.
466 '-include <(skia_sanitizer_blacklist)', # Make every .cpp depend on it.
borenet@google.com0d193092013-07-03 15:55:05 +0000467 ],
mtklein632199e2015-12-09 12:39:01 -0800468 'ldflags': [ '-fsanitize=<(skia_sanitizer)' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000469 'conditions' : [
470 [ 'skia_sanitizer == "thread"', {
mtklein172b4552015-03-12 05:27:46 -0700471 'defines': [ 'THREAD_SANITIZER' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000472 }],
mtkleine721a8e2016-02-06 19:12:23 -0800473 [ 'skia_sanitizer == "memory"', {
mtkleina861c002016-02-07 09:12:29 -0800474 'cflags': [
475 '-O1',
476 '-fsanitize-memory-track-origins',
477 ],
mtkleine721a8e2016-02-06 19:12:23 -0800478 }],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000479 ],
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000480 }],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000481 [ 'skia_clang_build', {
mtklein170e00d2014-06-30 12:33:11 -0700482 'cflags_cc': [
mtklein170e00d2014-06-30 12:33:11 -0700483 '-Wno-unknown-warning-option', # Allows unknown warnings.
484 '-Wno-deprecated', # From Qt, via debugger (older Clang).
485 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
486 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000487 'cflags': [
mtklein170e00d2014-06-30 12:33:11 -0700488 # Extra warnings we like but that only Clang knows about.
489 '-Wstring-conversion',
borenet@google.com47ae4b02013-08-21 18:02:50 +0000490 ],
commit-bot@chromium.org815d3602014-05-20 19:42:03 +0000491 'cflags!': [
492 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
493 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000494 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000495 [ 'skia_keep_frame_pointer', {
496 'cflags': [ '-fno-omit-frame-pointer' ],
497 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000498 ],
499 },
500 ],
501
borenet@google.coma72aef82013-03-22 13:16:06 +0000502 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000503 {
mtkleina34633f2014-08-19 13:32:59 -0700504 'defines': [ 'SK_BUILD_FOR_MAC' ],
hendrikw9a740412015-10-28 08:42:29 -0700505 'conditions': [
506 # ANGLE for mac hits -Wunneeded-internal-declaration if this isn't set.
507 [ 'skia_angle', { 'defines': [ 'YY_NO_INPUT' ], } ],
508 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000509 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000510 'Coverage': {
511 'xcode_settings': {
512 'GCC_OPTIMIZATION_LEVEL': '0',
513 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
514 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
515 },
516 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000517 'Debug': {
mtkleina34633f2014-08-19 13:32:59 -0700518 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0' },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000519 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000520 'Release': {
mtkleina34633f2014-08-19 13:32:59 -0700521 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)', },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000522 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000523 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000524 },
525 'xcode_settings': {
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000526 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700527 [ 'skia_fast', { 'WARNING_CFLAGS': [ '<@(skia_fast_flags)' ] } ],
mtkleina34633f2014-08-19 13:32:59 -0700528 [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400529 [ 'skia_arch_type == "x86"', { 'ARCHS': ['i386'] }],
530 [ 'skia_arch_type == "x86_64"', { 'ARCHS': ['x86_64'] }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000531 [ 'skia_osx_deployment_target==""', {
mtkleind7b25c72015-11-12 08:41:40 -0800532 'MACOSX_DEPLOYMENT_TARGET': '10.7', # -mmacos-version-min, passed in env to ld.
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000533 }, {
534 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
535 }],
mtklein632199e2015-12-09 12:39:01 -0800536 [ 'skia_sanitizer', {
bungeman1aeac302016-02-03 13:06:28 -0800537 'GCC_ENABLE_CPP_RTTI': 'YES', # vptr needs rtti
mtklein632199e2015-12-09 12:39:01 -0800538 'OTHER_CFLAGS': [
539 '-fsanitize=<(skia_sanitizer)', # Turn on sanitizers.
540 '-fno-sanitize-recover=<(skia_sanitizer)', # Make any failure fatal.
541 '-fsanitize-blacklist=<(skia_sanitizer_blacklist)', # Compile in our blacklist.
542 '-include <(skia_sanitizer_blacklist)', # Make every .cpp depend on it.
543 ],
544 # We want to pass -fsanitize=... to our final link call,
545 # but not to libtool. OTHER_LDFLAGS is passed to both.
546 # To trick GYP into doing what we want, we'll piggyback on
547 # LIBRARY_SEARCH_PATHS, producing "-L/usr/lib -fsanitize=...".
548 # The -L/usr/lib is redundant but innocuous: it's a default path.
549 'LIBRARY_SEARCH_PATHS': [ '/usr/lib -fsanitize=<(skia_sanitizer)'],
550 }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000551 ],
mtkleind7b25c72015-11-12 08:41:40 -0800552 'CLANG_CXX_LIBRARY': 'libc++',
bungeman1aeac302016-02-03 13:06:28 -0800553 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
554 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
555 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
556 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
557 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
mtklein02b2f192016-03-28 12:43:39 -0700558 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
559 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', # -fvisibility-inlines-hidden
mtklein335a0ae2014-10-13 12:32:34 -0700560 'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks
561 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings
bungeman1aeac302016-02-03 13:06:28 -0800562 'WARNING_CFLAGS': [
563 '-Wall',
564 '-Wextra',
565 '-Winit-self',
566 '-Wpointer-arith',
567 '-Wsign-compare',
dvonbeck115e9252016-06-15 09:13:50 -0700568 '-Wvla',
bungeman1aeac302016-02-03 13:06:28 -0800569
570 '-Wno-unused-parameter',
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000571 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000572 },
573 },
574 ],
575
borenet@google.coma72aef82013-03-22 13:16:06 +0000576 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000577 {
578 'defines': [
sdefresnee3fa8112016-06-01 07:08:56 -0700579 # When targetting iOS and using gyp to generate the build files, it is
580 # not possible to select files to build depending on the architecture
581 # (i.e. it is not possible to use hand optimized assembly version). In
582 # that configuration, disable all optimisation.
seanpaul@google.com1134f982011-09-15 14:24:33 +0000583 'SK_BUILD_FOR_IOS',
sdefresnee3fa8112016-06-01 07:08:56 -0700584 'SK_BUILD_NO_OPTS',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000585 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000586 'conditions' : [
587 [ 'skia_warnings_as_errors', {
588 'xcode_settings': {
589 'OTHER_CPLUSPLUSFLAGS': [
590 '-Werror',
591 ],
592 },
593 }],
594 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000595 'configurations': {
596 'Debug': {
597 'xcode_settings': {
598 'GCC_OPTIMIZATION_LEVEL': '0',
599 },
600 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000601 'Release': {
602 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000603 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000604 },
605 'defines': [ 'NDEBUG' ],
606 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000607 },
608 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000609 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000610 'CODE_SIGNING_REQUIRED': 'NO',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000611 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000612 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000613 'TARGETED_DEVICE_FAMILY': '1,2',
mtklein1e5cbf22015-11-16 16:20:34 -0800614
615 'CLANG_CXX_LIBRARY': 'libc++',
616 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
617 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
618 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
619 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
mtklein02b2f192016-03-28 12:43:39 -0700620 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
621 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', # -fvisibility-inlines-hidden
mtklein1e5cbf22015-11-16 16:20:34 -0800622
623 'GCC_THUMB_SUPPORT': 'NO', # TODO(mtklein): why would we not want thumb?
seanpaul@google.com1134f982011-09-15 14:24:33 +0000624 },
625 },
626 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000627
borenet@google.coma72aef82013-03-22 13:16:06 +0000628 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000629 {
630 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000631 'SK_BUILD_FOR_ANDROID',
djsollen@google.com968757e2014-04-11 13:09:21 +0000632
mtklein8d7f5c32016-08-01 09:22:12 -0700633 # Android defines a fixed text gamma exponent instead of using SRGB
djsollen@google.com968757e2014-04-11 13:09:21 +0000634 'SK_GAMMA_EXPONENT=1.4',
635 'SK_GAMMA_CONTRAST=0.0',
636 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000637 'configurations': {
scroggo@google.comeb629502014-02-04 16:08:48 +0000638 'Release': {
639 'cflags': ['-O2'],
djsollen460f4052016-04-25 11:45:35 -0700640 'conditions': [
641 [ 'skia_clang_build', {
642 'cflags!': ['-g'],
643 'cflags': [ '-gline-tables-only' ],
644 }],
645 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000646 },
647 },
djsollen@google.com58629292011-11-03 13:08:29 +0000648 'libraries': [
djsollen@google.com318cf922011-11-08 19:03:43 +0000649 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000650 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000651 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000652 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000653 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000654 'conditions': [
scroggodf1c3372015-02-12 10:48:25 -0800655 [ '"x86" in skia_arch_type', {
djsollenbc893292014-07-24 13:53:56 -0700656 'cflags': [
657 '-mssse3',
658 ],
659 }],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000660 [ 'skia_android_framework', {
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000661 'cflags!': [
662 '-fuse-ld=gold',
scroggo7cd3f642015-02-12 13:27:40 -0800663 '-mssse3',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000664 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000665 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000666 [ 'skia_shared_lib', {
djsollen@google.com52f02972013-06-03 12:10:19 +0000667 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000668 'SKIA_DLL',
669 'SKIA_IMPLEMENTATION=1',
halcanary6950de62015-11-07 05:29:00 -0800670 # Needed until we fix https://bug.skia.org/2440 .
scroggoecce60b2014-07-09 07:26:40 -0700671 '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 }],
djsollenf9deeb62016-03-07 12:30:47 -0800677 [ 'skia_clang_build', {
678 'cflags': [
679 '-Wno-unknown-warning-option', # Allows unknown warnings
680 # These flags that are on by default for only the android
681 # toolchain and no other platforms.
682 '-Wno-tautological-compare',
683 '-Wno-unused-command-line-argument',
684 ],
685 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000686 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000687 },
688 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000689
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000690 [ 'skia_moz2d', {
691 'defines': [
reed6518eaa2014-06-18 14:05:22 -0700692 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000693 ],
694 }],
695
hendrikw855dc932015-10-27 10:04:34 -0700696 [ 'skia_command_buffer and skia_os == "linux"', {
hendrikwb1ac52f2015-10-01 18:29:34 -0700697 'ldflags': [
698 '-Wl,-rpath,\$$ORIGIN/lib',
699 ],
700 }],
701
hendrikw855dc932015-10-27 10:04:34 -0700702 [ 'skia_command_buffer and skia_os == "mac"', {
703 'xcode_settings': {
704 'LD_RUNPATH_SEARCH_PATHS': ['@executable_path/.'],
705 },
706 }],
707
seanpaul@google.com1134f982011-09-15 14:24:33 +0000708 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000709 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
710 'xcode_settings': {
711 'SYMROOT': '<(DEPTH)/xcodebuild',
712 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000713}