blob: 4f387e988380c165e62e08706474f4e08c29688d [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)',
msarettad3a5c62016-05-06 07:21:26 -070013
14 # 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 }],
scroggoc0bc9132014-07-22 12:09:30 -070032 ['skia_pic', {
33 'cflags': [
34 '-fPIC',
35 ],
36 'conditions' : [
37 # FIXME: The reason we don't do this on Android is due to the way
38 # we build the executables/skia_launcher on Android. See
39 # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
40 ['skia_os != "android"', {
41 'target_conditions': [
42 [ '_type == "executable"', {
43 'cflags': [ '-fPIE' ],
44 'ldflags': [ '-pie' ],
45 }],
46 ],
47 }],
48 ],
49 }],
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000050
commit-bot@chromium.org6a106ce2014-05-20 19:02:55 +000051 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
52 [ 'skia_arch_type == "x86"', {
53 'cflags': [
54 '-msse2',
55 '-mfpmath=sse',
56 ],
57 }],
58
borenet@google.coma72aef82013-03-22 13:16:06 +000059 [ 'skia_os == "win"',
seanpaul@google.com1134f982011-09-15 14:24:33 +000060 {
61 'defines': [
62 'SK_BUILD_FOR_WIN32',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000063 '_CRT_SECURE_NO_WARNINGS',
senorblanco@chromium.org5f47a392012-07-12 00:34:39 +000064 'GR_GL_FUNCTION_TYPE=__stdcall',
bungemanb7069e92015-07-21 14:14:30 -070065 '_HAS_EXCEPTIONS=0',
seanpaul@google.com1134f982011-09-15 14:24:33 +000066 ],
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000067 'msvs_disabled_warnings': [
bungemanf5484442014-09-10 07:49:05 -070068 4275, # An exported class was derived from a class that was not exported
69 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
70 4355, # 'this' used in base member initializer list. Off by default in newer compilers.
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000071 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000072 'msvs_cygwin_shell': 0,
73 'msvs_settings': {
74 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000075 'WarningLevel': '3',
76 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000077 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000078 'ExceptionHandling': '0',
79 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000080 },
81 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000082 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000083 'AdditionalDependencies': [
84 'OpenGL32.lib',
85 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000086
87 # Prior to gyp r1584, the following were included automatically.
88 'kernel32.lib',
89 'gdi32.lib',
90 'winspool.lib',
91 'comdlg32.lib',
92 'advapi32.lib',
93 'shell32.lib',
94 'ole32.lib',
95 'oleaut32.lib',
96 'user32.lib',
97 'uuid.lib',
98 'odbc32.lib',
99 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +0000100 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000101 ],
102 },
103 },
104 'configurations': {
105 'Debug': {
106 'msvs_settings': {
107 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000108 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +0000109 'Optimization': '0', # optimizeDisabled (/Od)
110 'PreprocessorDefinitions': ['_DEBUG'],
111 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000112 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000113 },
114 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000115 'GenerateDebugInformation': 'true', # /DEBUG
116 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +0000117 },
118 },
119 },
120 'Release': {
121 'msvs_settings': {
122 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000123 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000124 'Optimization': '<(skia_release_optimization_level)',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000125 # Changing the floating point model requires rebaseling gm images
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000126 #'FloatingPointModel': '2', # fast (/fp:fast)
127 'FavorSizeOrSpeed': '1', # speed (/Ot)
seanpaul@google.com1134f982011-09-15 14:24:33 +0000128 'PreprocessorDefinitions': ['NDEBUG'],
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000129 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000130 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
131 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000132 },
133 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000134 'GenerateDebugInformation': 'true', # /DEBUG
bungeman@google.com983297e2011-10-03 19:36:51 +0000135 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000136 },
137 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000138 },
139 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000140 # Gyp's ninja generator depends on these specially named
141 # configurations to build 64-bit on Windows.
halcanary6950de62015-11-07 05:29:00 -0800142 # See https://bug.skia.org/2348
epoger@google.com58d69d82014-04-01 07:02:41 +0000143 #
144 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
145 # OK for us to just make these inherit non-archwidth-specific
146 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000147 #
halcanary6950de62015-11-07 05:29:00 -0800148 # See https://bug.skia.org/2442 : These targets cause problems in the
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000149 # MSVS build, so only include them if gyp is generating a ninja build.
150 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
151 'configurations': {
152 'Debug_x64': {
153 'inherit_from': ['Debug'],
bsalomon6740feb2014-11-13 13:47:06 -0800154 'msvs_settings': {
155 'VCCLCompilerTool': {
156 # /ZI is not supported on 64bit
157 'DebugInformationFormat': '3', # programDatabase (/Zi)
158 },
159 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000160 },
161 'Release_x64': {
162 'inherit_from': ['Release'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800163 'msvs_settings': {
164 'VCCLCompilerTool': {
165 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
166 'EnableEnhancedInstructionSet': '0', #
167 },
168 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000169 },
170 'Release_Developer_x64': {
171 'inherit_from': ['Release_Developer'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800172 'msvs_settings': {
173 'VCCLCompilerTool': {
174 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
175 'EnableEnhancedInstructionSet': '0', #
176 },
177 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000178 },
179 },
180 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400181 [ 'skia_arch_type == "x86_64"', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000182 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000183 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400184 [ 'skia_arch_type == "x86"', {
borenet@google.coma72aef82013-03-22 13:16:06 +0000185 'msvs_configuration_platform': 'Win32',
186 }],
187 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000188 'msvs_settings': {
189 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000190 'WarnAsError': 'true',
191 'AdditionalOptions': [
192 '/we4189', # initialized but unused var warning
bungeman918090c2016-02-09 09:14:28 -0800193 '/we4238', # taking address of rvalue
194 '/we4239', # assigning rvalues to non-const lvalues
borenet@google.coma72aef82013-03-22 13:16:06 +0000195 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000196 },
197 },
borenet@google.comb7961192012-08-20 18:58:26 +0000198 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000199 [ 'skia_win_exceptions', {
200 'msvs_settings': {
201 'VCCLCompilerTool': {
202 'AdditionalOptions': [
203 '/EHsc',
204 ],
205 },
206 },
207 }],
bsalomonda07a082014-06-26 12:56:28 -0700208 [ 'skia_win_ltcg', {
209 'configurations': {
210 'Release': {
211 'msvs_settings': {
212 'VCCLCompilerTool': {
213 'WholeProgramOptimization': 'true', #/GL
214 },
215 'VCLinkerTool': {
216 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
217 },
218 'VCLibrarianTool': {
219 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
220 },
221 },
222 },
223 },
224 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000225 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000226 },
227 ],
228
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000229 # The following section is common to linux + derivatives and android
borenet43bf5112016-04-29 14:01:34 -0700230 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android"]',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000231 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000232 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000233 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000234 '-fno-exceptions',
235 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000236
mtklein@google.comf1077f92013-11-20 15:13:49 +0000237 '-Wall',
238 '-Wextra',
239 '-Winit-self',
240 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800241 '-Wsign-compare',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000242
243 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000244 ],
245 'cflags_cc': [
mtkleinf3cdce72015-02-05 09:23:56 -0800246 '-std=c++11',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000247 '-fno-rtti',
mtklein61a81e32015-09-09 10:46:20 -0700248 '-fno-threadsafe-statics',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000249 '-Wnon-virtual-dtor',
250 ],
mtklein673748a2016-03-07 11:05:15 -0800251 'ldflags': [ '-rdynamic' ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000252 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700253 [ 'skia_fast', { 'cflags': [ '<@(skia_fast_flags)' ] }],
borenet43bf5112016-04-29 14:01:34 -0700254 [ 'skia_arch_type == "x86_64" and not skia_android_framework', {
255 'cflags': [
256 '-m64',
257 ],
258 'ldflags': [
259 '-m64',
260 ],
261 }],
262 [ 'skia_arch_type == "x86" and not skia_android_framework', {
263 'cflags': [
264 '-m32',
265 ],
266 'ldflags': [
267 '-m32',
qiankun.miaod312a042014-07-07 09:47:24 -0700268 ],
269 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000270 [ 'skia_warnings_as_errors', {
271 'cflags': [
272 '-Werror',
273 ],
274 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000275 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
276 [ 'skia_disable_inlining', {
277 'cflags': [
278 '-fno-inline',
279 '-fno-default-inline',
280 '-finline-limit=0',
281 '-fno-omit-frame-pointer',
282 ],
283 }],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000284 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000285 'cflags': [
286 '-march=armv7-a',
mtklein2d33a1d2015-04-02 10:47:57 -0700287 '-mthumb',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000288 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000289 'ldflags': [
290 '-march=armv7-a',
291 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000292 'conditions': [
293 [ 'arm_neon == 1', {
294 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700295 'SK_ARM_HAS_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000296 ],
297 'cflags': [
298 '-mfpu=neon',
299 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000300 }],
borenet43bf5112016-04-29 14:01:34 -0700301 [ 'skia_os != "linux"', {
borenet@google.come2b90372013-07-11 18:46:30 +0000302 'cflags': [
303 '-mfloat-abi=softfp',
304 ],
305 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000306 ],
307 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400308 [ '"mips" in skia_arch_type', {
mtkleinf62833d2015-08-05 14:17:32 -0700309 'cflags': [ '-EL' ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700310 'conditions': [
311 [ 'mips_arch_variant == "mips32r2"', {
mtkleinf62833d2015-08-05 14:17:32 -0700312 'cflags': [ '-march=mips32r2' ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700313 'conditions': [
mtkleinf62833d2015-08-05 14:17:32 -0700314 [ 'mips_dsp == 1', { 'cflags': [ '-mdsp' ] }],
315 [ 'mips_dsp == 2', { 'cflags': [ '-mdspr2' ] }],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700316 ],
317 }],
318 ],
319 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000320 ],
321 },
322 ],
323
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000324 ['skia_android_framework', {
325 'cflags': [
326 # Skia does not enforce this usage pattern so we disable it here to avoid
327 # unecessary log spew when building
328 '-Wno-unused-parameter',
329
330 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
331 # Revert to -D_FORTIFY_SOURCE=1
332 '-U_FORTIFY_SOURCE',
333 '-D_FORTIFY_SOURCE=1',
djsollenf379ad32015-01-27 09:01:01 -0800334
mtklein9a106ba2015-08-14 10:03:45 -0700335 # We can't use the skia_shared_lib gyp setting because we need to
djsollenf379ad32015-01-27 09:01:01 -0800336 # isolate this define to Skia sources. CFLAGS are local to Android.mk
337 # and ensures that this define is not exported to clients of the library
338 '-DSKIA_IMPLEMENTATION=1',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000339 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000340 # Remove flags which are either unnecessary or problematic for the
341 # Android framework build. Many of these flags are removed simply because
342 # they were not previously in the Android framework makefile, and we did
343 # did not intend to add them when generating the makefile.
344 # TODO (scroggo): Investigate whether any of these flags are actually
345 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000346 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000347 # Android has one makefile, used for both debugging (after manual
348 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000349 '-g',
350 '-march=armv7-a',
351 '-mthumb',
352 '-mfpu=neon',
353 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000354 '-fno-exceptions',
355 '-fstrict-aliasing',
356 # Remove flags to turn on warnings, since most people building Android
357 # are not focused on Skia and do not need the extra warning info.
358 '-Wall',
359 '-Wextra',
360 '-Winit-self',
361 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800362 '-Wsign-compare',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000363 ],
364 'cflags_cc!': [
365 '-fno-rtti',
366 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000367 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000368 'defines': [
369 'DCT_IFAST_SUPPORTED',
370 # using freetype's embolden allows us to adjust fake bold settings at
371 # draw-time, at which point we know which SkTypeface is being drawn
372 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000373 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
374 # When built as part of the system image we can enable certian non-NDK
375 # compliant optimizations.
376 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000377 # Optimizations for chromium (m30)
378 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000379 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000380 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700381 'SK_IGNORE_ETC1_SUPPORT',
mtklein9a106ba2015-08-14 10:03:45 -0700382 # We can't use the skia_shared_lib gyp setting because we need expose
djsollenf379ad32015-01-27 09:01:01 -0800383 # this define globally and the the implemention define as a cflag.
384 'SKIA_DLL',
scroggo230d4ac2015-03-26 07:15:55 -0700385 'SK_PRINT_CODEC_MESSAGES',
borenet243406e2015-07-22 13:29:25 -0700386 ],
387 }],
388
389 ['skia_use_android_framework_defines', {
390 # Add these defines when building for the Android framework, or when
391 # specifically requested. These should be temporary staging defines. Any
392 # permanent defines should be moved into the skia_android_framework block
393 # above.
394 'includes' : [
395 'skia_for_android_framework_defines.gypi',
396 ],
397 'defines': [
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000398 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000399 ],
400 }],
mtkleind7b25c72015-11-12 08:41:40 -0800401
joshualitt47fdae92015-11-09 12:30:05 -0800402 [ 'skia_use_sdl == 1',
403 {
404 'defines': [ 'SK_USE_SDL' ],
405 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000406
joshualittf16f88b2015-12-02 13:00:37 -0800407 [ 'skia_dump_stats == 1',
408 {
409 'defines': [ 'SK_DUMP_STATS'],
410 }],
411
borenet43bf5112016-04-29 14:01:34 -0700412 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000413 {
414 'defines': [
415 'SK_SAMPLES_FOR_X',
416 'SK_BUILD_FOR_UNIX',
417 ],
418 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000419 'Coverage': {
borenet11271fe2015-07-06 07:43:58 -0700420 'conditions': [
421 [ 'skia_clang_build', {
422 'cflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
423 'ldflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
424 }, {
425 'cflags': ['--coverage'],
426 'ldflags': ['--coverage'],
427 }],
428 ],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000429 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000430 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000431 },
432 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000433 'cflags': [
434 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000435 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000436 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000437 },
438 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000439 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000440 [ 'skia_shared_lib', {
zachr@google.com28c27c82013-06-20 17:15:05 +0000441 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000442 'SKIA_DLL',
443 'SKIA_IMPLEMENTATION=1',
444 ],
445 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000446 # Enable asan, tsan, etc.
447 [ 'skia_sanitizer', {
mtklein632199e2015-12-09 12:39:01 -0800448 'cflags_cc!': [ '-fno-rtti' ], # vptr needs rtti
borenet@google.com0d193092013-07-03 15:55:05 +0000449 'cflags': [
mtkleinbb5b77d2015-12-08 14:26:17 -0800450 '-fsanitize=<(skia_sanitizer)', # Turn on sanitizers.
451 '-fno-sanitize-recover=<(skia_sanitizer)', # Make any failure fatal.
452 '-fsanitize-blacklist=<(skia_sanitizer_blacklist)', # Compile in our blacklist.
453 '-include <(skia_sanitizer_blacklist)', # Make every .cpp depend on it.
borenet@google.com0d193092013-07-03 15:55:05 +0000454 ],
mtklein632199e2015-12-09 12:39:01 -0800455 'ldflags': [ '-fsanitize=<(skia_sanitizer)' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000456 'conditions' : [
457 [ 'skia_sanitizer == "thread"', {
mtklein172b4552015-03-12 05:27:46 -0700458 'defines': [ 'THREAD_SANITIZER' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000459 }],
mtkleine721a8e2016-02-06 19:12:23 -0800460 [ 'skia_sanitizer == "memory"', {
mtkleina861c002016-02-07 09:12:29 -0800461 'cflags': [
462 '-O1',
463 '-fsanitize-memory-track-origins',
464 ],
mtkleine721a8e2016-02-06 19:12:23 -0800465 }],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000466 ],
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000467 }],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000468 [ 'skia_clang_build', {
mtklein170e00d2014-06-30 12:33:11 -0700469 'cflags_cc': [
mtklein170e00d2014-06-30 12:33:11 -0700470 '-Wno-unknown-warning-option', # Allows unknown warnings.
471 '-Wno-deprecated', # From Qt, via debugger (older Clang).
472 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
473 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000474 'cflags': [
mtklein170e00d2014-06-30 12:33:11 -0700475 # Extra warnings we like but that only Clang knows about.
476 '-Wstring-conversion',
borenet@google.com47ae4b02013-08-21 18:02:50 +0000477 ],
commit-bot@chromium.org815d3602014-05-20 19:42:03 +0000478 'cflags!': [
479 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
480 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000481 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000482 [ 'skia_keep_frame_pointer', {
483 'cflags': [ '-fno-omit-frame-pointer' ],
484 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000485 ],
486 },
487 ],
488
borenet@google.coma72aef82013-03-22 13:16:06 +0000489 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000490 {
mtkleina34633f2014-08-19 13:32:59 -0700491 'defines': [ 'SK_BUILD_FOR_MAC' ],
hendrikw9a740412015-10-28 08:42:29 -0700492 'conditions': [
493 # ANGLE for mac hits -Wunneeded-internal-declaration if this isn't set.
494 [ 'skia_angle', { 'defines': [ 'YY_NO_INPUT' ], } ],
495 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000496 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000497 'Coverage': {
498 'xcode_settings': {
499 'GCC_OPTIMIZATION_LEVEL': '0',
500 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
501 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
502 },
503 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000504 'Debug': {
mtkleina34633f2014-08-19 13:32:59 -0700505 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0' },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000506 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000507 'Release': {
mtkleina34633f2014-08-19 13:32:59 -0700508 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)', },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000509 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000510 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000511 },
512 'xcode_settings': {
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000513 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700514 [ 'skia_fast', { 'WARNING_CFLAGS': [ '<@(skia_fast_flags)' ] } ],
mtkleina34633f2014-08-19 13:32:59 -0700515 [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400516 [ 'skia_arch_type == "x86"', { 'ARCHS': ['i386'] }],
517 [ 'skia_arch_type == "x86_64"', { 'ARCHS': ['x86_64'] }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000518 [ 'skia_osx_deployment_target==""', {
mtkleind7b25c72015-11-12 08:41:40 -0800519 'MACOSX_DEPLOYMENT_TARGET': '10.7', # -mmacos-version-min, passed in env to ld.
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000520 }, {
521 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
522 }],
mtklein632199e2015-12-09 12:39:01 -0800523 [ 'skia_sanitizer', {
bungeman1aeac302016-02-03 13:06:28 -0800524 'GCC_ENABLE_CPP_RTTI': 'YES', # vptr needs rtti
mtklein632199e2015-12-09 12:39:01 -0800525 'OTHER_CFLAGS': [
526 '-fsanitize=<(skia_sanitizer)', # Turn on sanitizers.
527 '-fno-sanitize-recover=<(skia_sanitizer)', # Make any failure fatal.
528 '-fsanitize-blacklist=<(skia_sanitizer_blacklist)', # Compile in our blacklist.
529 '-include <(skia_sanitizer_blacklist)', # Make every .cpp depend on it.
530 ],
531 # We want to pass -fsanitize=... to our final link call,
532 # but not to libtool. OTHER_LDFLAGS is passed to both.
533 # To trick GYP into doing what we want, we'll piggyback on
534 # LIBRARY_SEARCH_PATHS, producing "-L/usr/lib -fsanitize=...".
535 # The -L/usr/lib is redundant but innocuous: it's a default path.
536 'LIBRARY_SEARCH_PATHS': [ '/usr/lib -fsanitize=<(skia_sanitizer)'],
537 }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000538 ],
mtkleind7b25c72015-11-12 08:41:40 -0800539 'CLANG_CXX_LIBRARY': 'libc++',
bungeman1aeac302016-02-03 13:06:28 -0800540 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
541 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
542 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
543 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
544 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
mtklein02b2f192016-03-28 12:43:39 -0700545 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
546 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', # -fvisibility-inlines-hidden
mtklein335a0ae2014-10-13 12:32:34 -0700547 'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks
548 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings
bungeman1aeac302016-02-03 13:06:28 -0800549 'WARNING_CFLAGS': [
550 '-Wall',
551 '-Wextra',
552 '-Winit-self',
553 '-Wpointer-arith',
554 '-Wsign-compare',
555
556 '-Wno-unused-parameter',
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000557 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000558 },
559 },
560 ],
561
borenet@google.coma72aef82013-03-22 13:16:06 +0000562 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000563 {
564 'defines': [
sdefresnee3fa8112016-06-01 07:08:56 -0700565 # When targetting iOS and using gyp to generate the build files, it is
566 # not possible to select files to build depending on the architecture
567 # (i.e. it is not possible to use hand optimized assembly version). In
568 # that configuration, disable all optimisation.
seanpaul@google.com1134f982011-09-15 14:24:33 +0000569 'SK_BUILD_FOR_IOS',
sdefresnee3fa8112016-06-01 07:08:56 -0700570 'SK_BUILD_NO_OPTS',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000571 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000572 'conditions' : [
573 [ 'skia_warnings_as_errors', {
574 'xcode_settings': {
575 'OTHER_CPLUSPLUSFLAGS': [
576 '-Werror',
577 ],
578 },
579 }],
580 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000581 'configurations': {
582 'Debug': {
583 'xcode_settings': {
584 'GCC_OPTIMIZATION_LEVEL': '0',
585 },
586 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000587 'Release': {
588 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000589 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000590 },
591 'defines': [ 'NDEBUG' ],
592 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000593 },
594 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000595 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000596 'CODE_SIGNING_REQUIRED': 'NO',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000597 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000598 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000599 'TARGETED_DEVICE_FAMILY': '1,2',
mtklein1e5cbf22015-11-16 16:20:34 -0800600
601 'CLANG_CXX_LIBRARY': 'libc++',
602 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
603 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
604 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
605 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
mtklein02b2f192016-03-28 12:43:39 -0700606 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
607 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', # -fvisibility-inlines-hidden
mtklein1e5cbf22015-11-16 16:20:34 -0800608
609 'GCC_THUMB_SUPPORT': 'NO', # TODO(mtklein): why would we not want thumb?
seanpaul@google.com1134f982011-09-15 14:24:33 +0000610 },
611 },
612 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000613
borenet@google.coma72aef82013-03-22 13:16:06 +0000614 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000615 {
616 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000617 'SK_BUILD_FOR_ANDROID',
djsollen@google.com968757e2014-04-11 13:09:21 +0000618
619 # Android Text Tuning
620 'SK_GAMMA_EXPONENT=1.4',
621 'SK_GAMMA_CONTRAST=0.0',
622 ],
623 # Android defines a fixed gamma exponent instead of using SRGB
624 'defines!': [
625 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000626 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000627 'configurations': {
scroggo@google.comeb629502014-02-04 16:08:48 +0000628 'Release': {
629 'cflags': ['-O2'],
djsollen460f4052016-04-25 11:45:35 -0700630 'conditions': [
631 [ 'skia_clang_build', {
632 'cflags!': ['-g'],
633 'cflags': [ '-gline-tables-only' ],
634 }],
635 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000636 },
637 },
djsollen@google.com58629292011-11-03 13:08:29 +0000638 'libraries': [
djsollen@google.com318cf922011-11-08 19:03:43 +0000639 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000640 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000641 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000642 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000643 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000644 'conditions': [
scroggodf1c3372015-02-12 10:48:25 -0800645 [ '"x86" in skia_arch_type', {
djsollenbc893292014-07-24 13:53:56 -0700646 'cflags': [
647 '-mssse3',
648 ],
649 }],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000650 [ 'skia_android_framework', {
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000651 'cflags!': [
652 '-fuse-ld=gold',
scroggo7cd3f642015-02-12 13:27:40 -0800653 '-mssse3',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000654 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000655 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000656 [ 'skia_shared_lib', {
djsollen@google.com52f02972013-06-03 12:10:19 +0000657 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000658 'SKIA_DLL',
659 'SKIA_IMPLEMENTATION=1',
halcanary6950de62015-11-07 05:29:00 -0800660 # Needed until we fix https://bug.skia.org/2440 .
scroggoecce60b2014-07-09 07:26:40 -0700661 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
djsollen@google.com52f02972013-06-03 12:10:19 +0000662 ],
663 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000664 [ 'skia_profile_enabled == 1', {
665 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000666 }],
djsollenf9deeb62016-03-07 12:30:47 -0800667 [ 'skia_clang_build', {
668 'cflags': [
669 '-Wno-unknown-warning-option', # Allows unknown warnings
670 # These flags that are on by default for only the android
671 # toolchain and no other platforms.
672 '-Wno-tautological-compare',
673 '-Wno-unused-command-line-argument',
674 ],
675 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000676 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000677 },
678 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000679
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000680 [ 'skia_moz2d', {
681 'defines': [
reed6518eaa2014-06-18 14:05:22 -0700682 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000683 ],
684 }],
685
hendrikw855dc932015-10-27 10:04:34 -0700686 [ 'skia_command_buffer and skia_os == "linux"', {
hendrikwb1ac52f2015-10-01 18:29:34 -0700687 'ldflags': [
688 '-Wl,-rpath,\$$ORIGIN/lib',
689 ],
690 }],
691
hendrikw855dc932015-10-27 10:04:34 -0700692 [ 'skia_command_buffer and skia_os == "mac"', {
693 'xcode_settings': {
694 'LD_RUNPATH_SEARCH_PATHS': ['@executable_path/.'],
695 },
696 }],
697
seanpaul@google.com1134f982011-09-15 14:24:33 +0000698 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000699 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
700 'xcode_settings': {
701 'SYMROOT': '<(DEPTH)/xcodebuild',
702 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000703}