blob: 85f3e20376d12d7a137171b3fb70c937f5474dd0 [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)',
chudy@google.combbad34d2012-08-13 14:26:36 +000013 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000014 'conditions' : [
scroggo1497f9f2016-02-02 11:56:33 -080015 [ 'skia_codec_decodes_raw', {
16 'defines': [
17 'SK_CODEC_DECODES_RAW',
18 ],
19 }],
scroggoc0bc9132014-07-22 12:09:30 -070020 ['skia_pic', {
21 'cflags': [
22 '-fPIC',
23 ],
24 'conditions' : [
25 # FIXME: The reason we don't do this on Android is due to the way
26 # we build the executables/skia_launcher on Android. See
27 # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
28 ['skia_os != "android"', {
29 'target_conditions': [
30 [ '_type == "executable"', {
31 'cflags': [ '-fPIE' ],
32 'ldflags': [ '-pie' ],
33 }],
34 ],
35 }],
36 ],
37 }],
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000038
commit-bot@chromium.org6a106ce2014-05-20 19:02:55 +000039 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
40 [ 'skia_arch_type == "x86"', {
41 'cflags': [
42 '-msse2',
43 '-mfpmath=sse',
44 ],
45 }],
46
borenet@google.coma72aef82013-03-22 13:16:06 +000047 [ 'skia_os == "win"',
seanpaul@google.com1134f982011-09-15 14:24:33 +000048 {
49 'defines': [
50 'SK_BUILD_FOR_WIN32',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000051 '_CRT_SECURE_NO_WARNINGS',
senorblanco@chromium.org5f47a392012-07-12 00:34:39 +000052 'GR_GL_FUNCTION_TYPE=__stdcall',
bungemanb7069e92015-07-21 14:14:30 -070053 '_HAS_EXCEPTIONS=0',
seanpaul@google.com1134f982011-09-15 14:24:33 +000054 ],
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000055 'msvs_disabled_warnings': [
bungemanf5484442014-09-10 07:49:05 -070056 4275, # An exported class was derived from a class that was not exported
57 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
58 4355, # 'this' used in base member initializer list. Off by default in newer compilers.
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000059 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000060 'msvs_cygwin_shell': 0,
61 'msvs_settings': {
62 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000063 'WarningLevel': '3',
64 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000065 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000066 'ExceptionHandling': '0',
67 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000068 },
69 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000070 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000071 'AdditionalDependencies': [
72 'OpenGL32.lib',
73 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000074
75 # Prior to gyp r1584, the following were included automatically.
76 'kernel32.lib',
77 'gdi32.lib',
78 'winspool.lib',
79 'comdlg32.lib',
80 'advapi32.lib',
81 'shell32.lib',
82 'ole32.lib',
83 'oleaut32.lib',
84 'user32.lib',
85 'uuid.lib',
86 'odbc32.lib',
87 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +000088 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +000089 ],
90 },
91 },
92 'configurations': {
93 'Debug': {
94 'msvs_settings': {
95 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000096 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +000097 'Optimization': '0', # optimizeDisabled (/Od)
98 'PreprocessorDefinitions': ['_DEBUG'],
99 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000100 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000101 },
102 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000103 'GenerateDebugInformation': 'true', # /DEBUG
104 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +0000105 },
106 },
107 },
108 'Release': {
109 'msvs_settings': {
110 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000111 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000112 'Optimization': '<(skia_release_optimization_level)',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000113 # Changing the floating point model requires rebaseling gm images
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000114 #'FloatingPointModel': '2', # fast (/fp:fast)
115 'FavorSizeOrSpeed': '1', # speed (/Ot)
seanpaul@google.com1134f982011-09-15 14:24:33 +0000116 'PreprocessorDefinitions': ['NDEBUG'],
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000117 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000118 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
119 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000120 },
121 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000122 'GenerateDebugInformation': 'true', # /DEBUG
bungeman@google.com983297e2011-10-03 19:36:51 +0000123 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000124 },
125 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000126 },
127 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000128 # Gyp's ninja generator depends on these specially named
129 # configurations to build 64-bit on Windows.
halcanary6950de62015-11-07 05:29:00 -0800130 # See https://bug.skia.org/2348
epoger@google.com58d69d82014-04-01 07:02:41 +0000131 #
132 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
133 # OK for us to just make these inherit non-archwidth-specific
134 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000135 #
halcanary6950de62015-11-07 05:29:00 -0800136 # See https://bug.skia.org/2442 : These targets cause problems in the
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000137 # MSVS build, so only include them if gyp is generating a ninja build.
138 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
139 'configurations': {
140 'Debug_x64': {
141 'inherit_from': ['Debug'],
bsalomon6740feb2014-11-13 13:47:06 -0800142 'msvs_settings': {
143 'VCCLCompilerTool': {
144 # /ZI is not supported on 64bit
145 'DebugInformationFormat': '3', # programDatabase (/Zi)
146 },
147 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000148 },
149 'Release_x64': {
150 'inherit_from': ['Release'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800151 'msvs_settings': {
152 'VCCLCompilerTool': {
153 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
154 'EnableEnhancedInstructionSet': '0', #
155 },
156 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000157 },
158 'Release_Developer_x64': {
159 'inherit_from': ['Release_Developer'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800160 'msvs_settings': {
161 'VCCLCompilerTool': {
162 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
163 'EnableEnhancedInstructionSet': '0', #
164 },
165 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000166 },
167 },
168 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400169 [ 'skia_arch_type == "x86_64"', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000170 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000171 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400172 [ 'skia_arch_type == "x86"', {
borenet@google.coma72aef82013-03-22 13:16:06 +0000173 'msvs_configuration_platform': 'Win32',
174 }],
175 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000176 'msvs_settings': {
177 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000178 'WarnAsError': 'true',
179 'AdditionalOptions': [
180 '/we4189', # initialized but unused var warning
bungeman918090c2016-02-09 09:14:28 -0800181 '/we4238', # taking address of rvalue
182 '/we4239', # assigning rvalues to non-const lvalues
borenet@google.coma72aef82013-03-22 13:16:06 +0000183 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000184 },
185 },
borenet@google.comb7961192012-08-20 18:58:26 +0000186 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000187 [ 'skia_win_exceptions', {
188 'msvs_settings': {
189 'VCCLCompilerTool': {
190 'AdditionalOptions': [
191 '/EHsc',
192 ],
193 },
194 },
195 }],
bsalomonda07a082014-06-26 12:56:28 -0700196 [ 'skia_win_ltcg', {
197 'configurations': {
198 'Release': {
199 'msvs_settings': {
200 'VCCLCompilerTool': {
201 'WholeProgramOptimization': 'true', #/GL
202 },
203 'VCLinkerTool': {
204 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
205 },
206 'VCLibrarianTool': {
207 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
208 },
209 },
210 },
211 },
212 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000213 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000214 },
215 ],
216
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000217 # The following section is common to linux + derivatives and android
borenet48087572015-04-02 12:16:36 -0700218 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos", "android"]',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000219 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000220 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000221 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000222 '-fno-exceptions',
223 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000224
mtklein@google.comf1077f92013-11-20 15:13:49 +0000225 '-Wall',
226 '-Wextra',
227 '-Winit-self',
228 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800229 '-Wsign-compare',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000230
231 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000232 ],
233 'cflags_cc': [
mtkleinf3cdce72015-02-05 09:23:56 -0800234 '-std=c++11',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000235 '-fno-rtti',
mtklein61a81e32015-09-09 10:46:20 -0700236 '-fno-threadsafe-statics',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000237 '-Wnon-virtual-dtor',
238 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000239 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700240 [ 'skia_fast', { 'cflags': [ '<@(skia_fast_flags)' ] }],
qiankun.miaod312a042014-07-07 09:47:24 -0700241 [ 'skia_os != "chromeos"', {
242 'conditions': [
scroggo7cd3f642015-02-12 13:27:40 -0800243 [ 'skia_arch_type == "x86_64" and not skia_android_framework', {
qiankun.miaod312a042014-07-07 09:47:24 -0700244 'cflags': [
245 '-m64',
246 ],
247 'ldflags': [
248 '-m64',
249 ],
250 }],
scroggo7cd3f642015-02-12 13:27:40 -0800251 [ 'skia_arch_type == "x86" and not skia_android_framework', {
qiankun.miaod312a042014-07-07 09:47:24 -0700252 'cflags': [
253 '-m32',
254 ],
255 'ldflags': [
256 '-m32',
257 ],
258 }],
259 ],
260 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000261 [ 'skia_warnings_as_errors', {
262 'cflags': [
263 '-Werror',
264 ],
265 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000266 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
267 [ 'skia_disable_inlining', {
268 'cflags': [
269 '-fno-inline',
270 '-fno-default-inline',
271 '-finline-limit=0',
272 '-fno-omit-frame-pointer',
273 ],
274 }],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000275 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000276 'cflags': [
277 '-march=armv7-a',
mtklein2d33a1d2015-04-02 10:47:57 -0700278 '-mthumb',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000279 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000280 'ldflags': [
281 '-march=armv7-a',
282 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000283 'conditions': [
284 [ 'arm_neon == 1', {
285 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700286 'SK_ARM_HAS_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000287 ],
288 'cflags': [
289 '-mfpu=neon',
290 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000291 }],
292 [ 'arm_neon_optional == 1', {
293 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700294 'SK_ARM_HAS_OPTIONAL_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000295 ],
296 }],
mtklein19996ed2014-11-21 06:48:43 -0800297 [ 'skia_os != "chromeos" and skia_os != "linux"', {
borenet@google.come2b90372013-07-11 18:46:30 +0000298 'cflags': [
299 '-mfloat-abi=softfp',
300 ],
301 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000302 ],
303 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400304 [ '"mips" in skia_arch_type', {
mtkleinf62833d2015-08-05 14:17:32 -0700305 'cflags': [ '-EL' ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700306 'conditions': [
307 [ 'mips_arch_variant == "mips32r2"', {
mtkleinf62833d2015-08-05 14:17:32 -0700308 'cflags': [ '-march=mips32r2' ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700309 'conditions': [
mtkleinf62833d2015-08-05 14:17:32 -0700310 [ 'mips_dsp == 1', { 'cflags': [ '-mdsp' ] }],
311 [ 'mips_dsp == 2', { 'cflags': [ '-mdspr2' ] }],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700312 ],
313 }],
314 ],
315 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000316 ],
317 },
318 ],
319
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000320 ['skia_android_framework', {
321 'cflags': [
322 # Skia does not enforce this usage pattern so we disable it here to avoid
323 # unecessary log spew when building
324 '-Wno-unused-parameter',
325
326 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
327 # Revert to -D_FORTIFY_SOURCE=1
328 '-U_FORTIFY_SOURCE',
329 '-D_FORTIFY_SOURCE=1',
djsollenf379ad32015-01-27 09:01:01 -0800330
mtklein9a106ba2015-08-14 10:03:45 -0700331 # We can't use the skia_shared_lib gyp setting because we need to
djsollenf379ad32015-01-27 09:01:01 -0800332 # isolate this define to Skia sources. CFLAGS are local to Android.mk
333 # and ensures that this define is not exported to clients of the library
334 '-DSKIA_IMPLEMENTATION=1',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000335 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000336 # Remove flags which are either unnecessary or problematic for the
337 # Android framework build. Many of these flags are removed simply because
338 # they were not previously in the Android framework makefile, and we did
339 # did not intend to add them when generating the makefile.
340 # TODO (scroggo): Investigate whether any of these flags are actually
341 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000342 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000343 # Android has one makefile, used for both debugging (after manual
344 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000345 '-g',
346 '-march=armv7-a',
347 '-mthumb',
348 '-mfpu=neon',
349 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000350 '-fno-exceptions',
351 '-fstrict-aliasing',
352 # Remove flags to turn on warnings, since most people building Android
353 # are not focused on Skia and do not need the extra warning info.
354 '-Wall',
355 '-Wextra',
356 '-Winit-self',
357 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800358 '-Wsign-compare',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000359 ],
360 'cflags_cc!': [
361 '-fno-rtti',
362 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000363 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000364 'defines': [
365 'DCT_IFAST_SUPPORTED',
366 # using freetype's embolden allows us to adjust fake bold settings at
367 # draw-time, at which point we know which SkTypeface is being drawn
368 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000369 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
370 # When built as part of the system image we can enable certian non-NDK
371 # compliant optimizations.
372 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000373 # Optimizations for chromium (m30)
374 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000375 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000376 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700377 'SK_IGNORE_ETC1_SUPPORT',
mtklein9a106ba2015-08-14 10:03:45 -0700378 # We can't use the skia_shared_lib gyp setting because we need expose
djsollenf379ad32015-01-27 09:01:01 -0800379 # this define globally and the the implemention define as a cflag.
380 'SKIA_DLL',
scroggo230d4ac2015-03-26 07:15:55 -0700381 'SK_PRINT_CODEC_MESSAGES',
borenet243406e2015-07-22 13:29:25 -0700382 ],
383 }],
384
385 ['skia_use_android_framework_defines', {
386 # Add these defines when building for the Android framework, or when
387 # specifically requested. These should be temporary staging defines. Any
388 # permanent defines should be moved into the skia_android_framework block
389 # above.
390 'includes' : [
391 'skia_for_android_framework_defines.gypi',
392 ],
393 'defines': [
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000394 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000395 ],
396 }],
mtkleind7b25c72015-11-12 08:41:40 -0800397
joshualitt47fdae92015-11-09 12:30:05 -0800398 [ 'skia_use_sdl == 1',
399 {
400 'defines': [ 'SK_USE_SDL' ],
401 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000402
joshualittf16f88b2015-12-02 13:00:37 -0800403 [ 'skia_dump_stats == 1',
404 {
405 'defines': [ 'SK_DUMP_STATS'],
406 }],
407
borenet48087572015-04-02 12:16:36 -0700408 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000409 {
410 'defines': [
411 'SK_SAMPLES_FOR_X',
412 'SK_BUILD_FOR_UNIX',
413 ],
414 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000415 'Coverage': {
borenet11271fe2015-07-06 07:43:58 -0700416 'conditions': [
417 [ 'skia_clang_build', {
418 'cflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
419 'ldflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
420 }, {
421 'cflags': ['--coverage'],
422 'ldflags': ['--coverage'],
423 }],
424 ],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000425 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000426 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000427 },
428 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000429 'cflags': [
430 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000431 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000432 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000433 },
434 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000435 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000436 [ 'skia_shared_lib', {
zachr@google.com28c27c82013-06-20 17:15:05 +0000437 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000438 'SKIA_DLL',
439 'SKIA_IMPLEMENTATION=1',
440 ],
441 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000442 # Enable asan, tsan, etc.
443 [ 'skia_sanitizer', {
mtklein632199e2015-12-09 12:39:01 -0800444 'cflags_cc!': [ '-fno-rtti' ], # vptr needs rtti
borenet@google.com0d193092013-07-03 15:55:05 +0000445 'cflags': [
mtkleinbb5b77d2015-12-08 14:26:17 -0800446 '-fsanitize=<(skia_sanitizer)', # Turn on sanitizers.
447 '-fno-sanitize-recover=<(skia_sanitizer)', # Make any failure fatal.
448 '-fsanitize-blacklist=<(skia_sanitizer_blacklist)', # Compile in our blacklist.
449 '-include <(skia_sanitizer_blacklist)', # Make every .cpp depend on it.
borenet@google.com0d193092013-07-03 15:55:05 +0000450 ],
mtklein632199e2015-12-09 12:39:01 -0800451 'ldflags': [ '-fsanitize=<(skia_sanitizer)' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000452 'conditions' : [
453 [ 'skia_sanitizer == "thread"', {
mtklein172b4552015-03-12 05:27:46 -0700454 'defines': [ 'THREAD_SANITIZER' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000455 }],
mtkleine721a8e2016-02-06 19:12:23 -0800456 [ 'skia_sanitizer == "memory"', {
mtkleina861c002016-02-07 09:12:29 -0800457 'cflags': [
458 '-O1',
459 '-fsanitize-memory-track-origins',
460 ],
mtkleine721a8e2016-02-06 19:12:23 -0800461 }],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000462 ],
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000463 }],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000464 [ 'skia_clang_build', {
mtklein170e00d2014-06-30 12:33:11 -0700465 'cflags_cc': [
mtklein170e00d2014-06-30 12:33:11 -0700466 '-Wno-unknown-warning-option', # Allows unknown warnings.
467 '-Wno-deprecated', # From Qt, via debugger (older Clang).
468 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
469 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000470 'cflags': [
mtklein170e00d2014-06-30 12:33:11 -0700471 # Extra warnings we like but that only Clang knows about.
472 '-Wstring-conversion',
borenet@google.com47ae4b02013-08-21 18:02:50 +0000473 ],
commit-bot@chromium.org815d3602014-05-20 19:42:03 +0000474 'cflags!': [
475 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
476 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000477 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000478 [ 'skia_keep_frame_pointer', {
479 'cflags': [ '-fno-omit-frame-pointer' ],
480 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000481 ],
482 },
483 ],
484
borenet@google.coma72aef82013-03-22 13:16:06 +0000485 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000486 {
mtkleina34633f2014-08-19 13:32:59 -0700487 'defines': [ 'SK_BUILD_FOR_MAC' ],
hendrikw9a740412015-10-28 08:42:29 -0700488 'conditions': [
489 # ANGLE for mac hits -Wunneeded-internal-declaration if this isn't set.
490 [ 'skia_angle', { 'defines': [ 'YY_NO_INPUT' ], } ],
491 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000492 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000493 'Coverage': {
494 'xcode_settings': {
495 'GCC_OPTIMIZATION_LEVEL': '0',
496 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
497 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
498 },
499 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000500 'Debug': {
mtkleina34633f2014-08-19 13:32:59 -0700501 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0' },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000502 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000503 'Release': {
mtkleina34633f2014-08-19 13:32:59 -0700504 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)', },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000505 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000506 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000507 },
508 'xcode_settings': {
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000509 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700510 [ 'skia_fast', { 'WARNING_CFLAGS': [ '<@(skia_fast_flags)' ] } ],
mtkleina34633f2014-08-19 13:32:59 -0700511 [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400512 [ 'skia_arch_type == "x86"', { 'ARCHS': ['i386'] }],
513 [ 'skia_arch_type == "x86_64"', { 'ARCHS': ['x86_64'] }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000514 [ 'skia_osx_deployment_target==""', {
mtkleind7b25c72015-11-12 08:41:40 -0800515 'MACOSX_DEPLOYMENT_TARGET': '10.7', # -mmacos-version-min, passed in env to ld.
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000516 }, {
517 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
518 }],
mtklein632199e2015-12-09 12:39:01 -0800519 [ 'skia_sanitizer', {
bungeman1aeac302016-02-03 13:06:28 -0800520 'GCC_ENABLE_CPP_RTTI': 'YES', # vptr needs rtti
mtklein632199e2015-12-09 12:39:01 -0800521 'OTHER_CFLAGS': [
522 '-fsanitize=<(skia_sanitizer)', # Turn on sanitizers.
523 '-fno-sanitize-recover=<(skia_sanitizer)', # Make any failure fatal.
524 '-fsanitize-blacklist=<(skia_sanitizer_blacklist)', # Compile in our blacklist.
525 '-include <(skia_sanitizer_blacklist)', # Make every .cpp depend on it.
526 ],
527 # We want to pass -fsanitize=... to our final link call,
528 # but not to libtool. OTHER_LDFLAGS is passed to both.
529 # To trick GYP into doing what we want, we'll piggyback on
530 # LIBRARY_SEARCH_PATHS, producing "-L/usr/lib -fsanitize=...".
531 # The -L/usr/lib is redundant but innocuous: it's a default path.
532 'LIBRARY_SEARCH_PATHS': [ '/usr/lib -fsanitize=<(skia_sanitizer)'],
533 }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000534 ],
mtkleind7b25c72015-11-12 08:41:40 -0800535 'CLANG_CXX_LIBRARY': 'libc++',
bungeman1aeac302016-02-03 13:06:28 -0800536 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
537 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
538 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
539 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
540 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
541 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
542 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
mtklein335a0ae2014-10-13 12:32:34 -0700543 'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks
544 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings
bungeman1aeac302016-02-03 13:06:28 -0800545 'WARNING_CFLAGS': [
546 '-Wall',
547 '-Wextra',
548 '-Winit-self',
549 '-Wpointer-arith',
550 '-Wsign-compare',
551
552 '-Wno-unused-parameter',
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000553 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000554 },
555 },
556 ],
557
borenet@google.coma72aef82013-03-22 13:16:06 +0000558 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000559 {
560 'defines': [
561 'SK_BUILD_FOR_IOS',
562 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000563 'conditions' : [
564 [ 'skia_warnings_as_errors', {
565 'xcode_settings': {
566 'OTHER_CPLUSPLUSFLAGS': [
567 '-Werror',
568 ],
569 },
570 }],
571 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000572 'configurations': {
573 'Debug': {
574 'xcode_settings': {
575 'GCC_OPTIMIZATION_LEVEL': '0',
576 },
577 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000578 'Release': {
579 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000580 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000581 },
582 'defines': [ 'NDEBUG' ],
583 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000584 },
585 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000586 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000587 'CODE_SIGNING_REQUIRED': 'NO',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000588 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000589 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000590 'TARGETED_DEVICE_FAMILY': '1,2',
mtklein1e5cbf22015-11-16 16:20:34 -0800591
592 'CLANG_CXX_LIBRARY': 'libc++',
593 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
594 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
595 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
596 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
597 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
598 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
599
600 'GCC_THUMB_SUPPORT': 'NO', # TODO(mtklein): why would we not want thumb?
seanpaul@google.com1134f982011-09-15 14:24:33 +0000601 },
602 },
603 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000604
borenet@google.coma72aef82013-03-22 13:16:06 +0000605 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000606 {
607 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000608 'SK_BUILD_FOR_ANDROID',
djsollen@google.com968757e2014-04-11 13:09:21 +0000609
610 # Android Text Tuning
611 'SK_GAMMA_EXPONENT=1.4',
612 'SK_GAMMA_CONTRAST=0.0',
613 ],
614 # Android defines a fixed gamma exponent instead of using SRGB
615 'defines!': [
616 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000617 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000618 'configurations': {
619 'Debug': {
mtkleinc0591ca2014-11-21 14:42:35 -0800620 'cflags': ['-g']
scroggo@google.comeb629502014-02-04 16:08:48 +0000621 },
622 'Release': {
623 'cflags': ['-O2'],
scroggo@google.comeb629502014-02-04 16:08:48 +0000624 },
625 },
djsollen@google.com58629292011-11-03 13:08:29 +0000626 'libraries': [
djsollen@google.com318cf922011-11-08 19:03:43 +0000627 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000628 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000629 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000630 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000631 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000632 'conditions': [
scroggodf1c3372015-02-12 10:48:25 -0800633 [ '"x86" in skia_arch_type', {
djsollenbc893292014-07-24 13:53:56 -0700634 'cflags': [
635 '-mssse3',
636 ],
637 }],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000638 [ 'skia_android_framework', {
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000639 'cflags!': [
640 '-fuse-ld=gold',
scroggo7cd3f642015-02-12 13:27:40 -0800641 '-mssse3',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000642 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000643 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000644 [ 'skia_shared_lib', {
djsollen@google.com52f02972013-06-03 12:10:19 +0000645 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000646 'SKIA_DLL',
647 'SKIA_IMPLEMENTATION=1',
halcanary6950de62015-11-07 05:29:00 -0800648 # Needed until we fix https://bug.skia.org/2440 .
scroggoecce60b2014-07-09 07:26:40 -0700649 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
djsollen@google.com52f02972013-06-03 12:10:19 +0000650 ],
651 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000652 [ 'skia_profile_enabled == 1', {
653 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000654 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000655 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000656 },
657 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000658
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000659 [ 'skia_moz2d', {
660 'defines': [
reed6518eaa2014-06-18 14:05:22 -0700661 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000662 ],
663 }],
664
hendrikw855dc932015-10-27 10:04:34 -0700665 [ 'skia_command_buffer and skia_os == "linux"', {
hendrikwb1ac52f2015-10-01 18:29:34 -0700666 'ldflags': [
667 '-Wl,-rpath,\$$ORIGIN/lib',
668 ],
669 }],
670
hendrikw855dc932015-10-27 10:04:34 -0700671 [ 'skia_command_buffer and skia_os == "mac"', {
672 'xcode_settings': {
673 'LD_RUNPATH_SEARCH_PATHS': ['@executable_path/.'],
674 },
675 }],
676
seanpaul@google.com1134f982011-09-15 14:24:33 +0000677 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000678 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
679 'xcode_settings': {
680 'SYMROOT': '<(DEPTH)/xcodebuild',
681 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000682}