blob: 2a927d1a547efef37f9c070f780d2addb73e369b [file] [log] [blame]
scroggo3e562272015-03-25 10:22:41 -07001# Copyright 2015 Google Inc.
2#
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
mtkleindee3df92015-03-26 05:30:44 -07005
seanpaul@google.com1134f982011-09-15 14:24:33 +00006# conditions used in both common.gypi and skia.gyp in chromium
7#
8{
chudy@google.combbad34d2012-08-13 14:26:36 +00009 'defines': [
10 'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
mtklein@google.comdad70702013-11-20 18:06:10 +000011 'SK_SUPPORT_GPU=<(skia_gpu)',
12 'SK_SUPPORT_OPENCL=<(skia_opencl)',
jvanverth4736e142014-11-07 07:12:46 -080013 'SK_FORCE_DISTANCE_FIELD_TEXT=<(skia_force_distance_field_text)',
chudy@google.combbad34d2012-08-13 14:26:36 +000014 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000015 'conditions' : [
scroggoc0bc9132014-07-22 12:09:30 -070016 ['skia_pic', {
17 'cflags': [
18 '-fPIC',
19 ],
20 'conditions' : [
21 # FIXME: The reason we don't do this on Android is due to the way
22 # we build the executables/skia_launcher on Android. See
23 # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
24 ['skia_os != "android"', {
25 'target_conditions': [
26 [ '_type == "executable"', {
27 'cflags': [ '-fPIE' ],
28 'ldflags': [ '-pie' ],
29 }],
30 ],
31 }],
32 ],
33 }],
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000034
commit-bot@chromium.org6a106ce2014-05-20 19:02:55 +000035 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
36 [ 'skia_arch_type == "x86"', {
37 'cflags': [
38 '-msse2',
39 '-mfpmath=sse',
40 ],
41 }],
42
borenet@google.coma72aef82013-03-22 13:16:06 +000043 [ 'skia_os == "win"',
seanpaul@google.com1134f982011-09-15 14:24:33 +000044 {
45 'defines': [
46 'SK_BUILD_FOR_WIN32',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000047 '_CRT_SECURE_NO_WARNINGS',
senorblanco@chromium.org5f47a392012-07-12 00:34:39 +000048 'GR_GL_FUNCTION_TYPE=__stdcall',
bungemanb7069e92015-07-21 14:14:30 -070049 '_HAS_EXCEPTIONS=0',
seanpaul@google.com1134f982011-09-15 14:24:33 +000050 ],
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000051 'msvs_disabled_warnings': [
bungemanf5484442014-09-10 07:49:05 -070052 4275, # An exported class was derived from a class that was not exported
53 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
54 4355, # 'this' used in base member initializer list. Off by default in newer compilers.
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000055 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000056 'msvs_cygwin_shell': 0,
57 'msvs_settings': {
58 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000059 'WarningLevel': '3',
60 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000061 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000062 'ExceptionHandling': '0',
63 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000064 },
65 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000066 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000067 'AdditionalDependencies': [
68 'OpenGL32.lib',
69 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000070
71 # Prior to gyp r1584, the following were included automatically.
72 'kernel32.lib',
73 'gdi32.lib',
74 'winspool.lib',
75 'comdlg32.lib',
76 'advapi32.lib',
77 'shell32.lib',
78 'ole32.lib',
79 'oleaut32.lib',
80 'user32.lib',
81 'uuid.lib',
82 'odbc32.lib',
83 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +000084 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +000085 ],
86 },
87 },
88 'configurations': {
89 'Debug': {
90 'msvs_settings': {
91 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000092 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +000093 'Optimization': '0', # optimizeDisabled (/Od)
94 'PreprocessorDefinitions': ['_DEBUG'],
95 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000096 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +000097 },
98 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000099 'GenerateDebugInformation': 'true', # /DEBUG
100 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +0000101 },
102 },
103 },
104 'Release': {
105 'msvs_settings': {
106 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000107 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000108 'Optimization': '<(skia_release_optimization_level)',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000109 # Changing the floating point model requires rebaseling gm images
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000110 #'FloatingPointModel': '2', # fast (/fp:fast)
111 'FavorSizeOrSpeed': '1', # speed (/Ot)
seanpaul@google.com1134f982011-09-15 14:24:33 +0000112 'PreprocessorDefinitions': ['NDEBUG'],
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000113 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
bsalomon@google.com9aabfc72012-05-31 14:12:46 +0000114 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
115 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +0000116 },
117 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +0000118 'GenerateDebugInformation': 'true', # /DEBUG
bungeman@google.com983297e2011-10-03 19:36:51 +0000119 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000120 },
121 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000122 },
123 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000124 # Gyp's ninja generator depends on these specially named
125 # configurations to build 64-bit on Windows.
126 # See http://skbug.com/2348
127 #
128 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
129 # OK for us to just make these inherit non-archwidth-specific
130 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000131 #
132 # See http://skbug.com/2442 : These targets cause problems in the
133 # MSVS build, so only include them if gyp is generating a ninja build.
134 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
135 'configurations': {
136 'Debug_x64': {
137 'inherit_from': ['Debug'],
bsalomon6740feb2014-11-13 13:47:06 -0800138 'msvs_settings': {
139 'VCCLCompilerTool': {
140 # /ZI is not supported on 64bit
141 'DebugInformationFormat': '3', # programDatabase (/Zi)
142 },
143 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000144 },
145 'Release_x64': {
146 'inherit_from': ['Release'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800147 'msvs_settings': {
148 'VCCLCompilerTool': {
149 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
150 'EnableEnhancedInstructionSet': '0', #
151 },
152 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000153 },
154 'Release_Developer_x64': {
155 'inherit_from': ['Release_Developer'],
bsalomon26bdfcb2014-11-19 08:59:58 -0800156 'msvs_settings': {
157 'VCCLCompilerTool': {
158 # Don't specify /arch. SSE2 is implied by 64bit and specifying it warns.
159 'EnableEnhancedInstructionSet': '0', #
160 },
161 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000162 },
163 },
164 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400165 [ 'skia_arch_type == "x86_64"', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000166 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000167 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400168 [ 'skia_arch_type == "x86"', {
borenet@google.coma72aef82013-03-22 13:16:06 +0000169 'msvs_configuration_platform': 'Win32',
170 }],
171 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000172 'msvs_settings': {
173 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000174 'WarnAsError': 'true',
175 'AdditionalOptions': [
176 '/we4189', # initialized but unused var warning
177 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000178 },
179 },
borenet@google.comb7961192012-08-20 18:58:26 +0000180 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000181 [ 'skia_win_exceptions', {
182 'msvs_settings': {
183 'VCCLCompilerTool': {
184 'AdditionalOptions': [
185 '/EHsc',
186 ],
187 },
188 },
189 }],
bsalomonda07a082014-06-26 12:56:28 -0700190 [ 'skia_win_ltcg', {
191 'configurations': {
192 'Release': {
193 'msvs_settings': {
194 'VCCLCompilerTool': {
195 'WholeProgramOptimization': 'true', #/GL
196 },
197 'VCLinkerTool': {
198 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
199 },
200 'VCLibrarianTool': {
201 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
202 },
203 },
204 },
205 },
206 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000207 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000208 },
209 ],
210
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000211 # The following section is common to linux + derivatives and android
borenet48087572015-04-02 12:16:36 -0700212 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos", "android"]',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000213 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000214 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000215 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000216 '-fno-exceptions',
217 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000218
mtklein@google.comf1077f92013-11-20 15:13:49 +0000219 '-Wall',
220 '-Wextra',
221 '-Winit-self',
222 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800223 '-Wsign-compare',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000224
225 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000226 ],
227 'cflags_cc': [
mtkleinf3cdce72015-02-05 09:23:56 -0800228 '-std=c++11',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000229 '-fno-rtti',
230 '-Wnon-virtual-dtor',
mtklein24ad0962014-06-17 11:47:40 -0700231 '-Wno-invalid-offsetof', # GCC <4.6 is old-school strict about what is POD.
mtklein@google.comf1077f92013-11-20 15:13:49 +0000232 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000233 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700234 [ 'skia_fast', { 'cflags': [ '<@(skia_fast_flags)' ] }],
qiankun.miaod312a042014-07-07 09:47:24 -0700235 [ 'skia_os != "chromeos"', {
236 'conditions': [
scroggo7cd3f642015-02-12 13:27:40 -0800237 [ 'skia_arch_type == "x86_64" and not skia_android_framework', {
qiankun.miaod312a042014-07-07 09:47:24 -0700238 'cflags': [
239 '-m64',
240 ],
241 'ldflags': [
242 '-m64',
243 ],
244 }],
scroggo7cd3f642015-02-12 13:27:40 -0800245 [ 'skia_arch_type == "x86" and not skia_android_framework', {
qiankun.miaod312a042014-07-07 09:47:24 -0700246 'cflags': [
247 '-m32',
248 ],
249 'ldflags': [
250 '-m32',
251 ],
252 }],
253 ],
254 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000255 [ 'skia_warnings_as_errors', {
256 'cflags': [
257 '-Werror',
258 ],
259 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000260 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
261 [ 'skia_disable_inlining', {
262 'cflags': [
263 '-fno-inline',
264 '-fno-default-inline',
265 '-finline-limit=0',
266 '-fno-omit-frame-pointer',
267 ],
268 }],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000269 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000270 'cflags': [
271 '-march=armv7-a',
mtklein2d33a1d2015-04-02 10:47:57 -0700272 '-mthumb',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000273 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000274 'ldflags': [
275 '-march=armv7-a',
276 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000277 'conditions': [
278 [ 'arm_neon == 1', {
279 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700280 'SK_ARM_HAS_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000281 ],
282 'cflags': [
283 '-mfpu=neon',
284 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000285 }],
286 [ 'arm_neon_optional == 1', {
287 'defines': [
djsollen21769c52014-08-01 05:32:32 -0700288 'SK_ARM_HAS_OPTIONAL_NEON',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000289 ],
290 }],
mtklein19996ed2014-11-21 06:48:43 -0800291 [ 'skia_os != "chromeos" and skia_os != "linux"', {
borenet@google.come2b90372013-07-11 18:46:30 +0000292 'cflags': [
293 '-mfloat-abi=softfp',
294 ],
295 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000296 ],
297 }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400298 [ '"mips" in skia_arch_type', {
mtkleinf62833d2015-08-05 14:17:32 -0700299 'cflags': [ '-EL' ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700300 'conditions': [
301 [ 'mips_arch_variant == "mips32r2"', {
mtkleinf62833d2015-08-05 14:17:32 -0700302 'cflags': [ '-march=mips32r2' ],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700303 'conditions': [
mtkleinf62833d2015-08-05 14:17:32 -0700304 [ 'mips_dsp == 1', { 'cflags': [ '-mdsp' ] }],
305 [ 'mips_dsp == 2', { 'cflags': [ '-mdspr2' ] }],
djordje.pesutaaf1df62014-06-06 14:09:12 -0700306 ],
307 }],
308 ],
309 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000310 ],
311 },
312 ],
313
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000314 ['skia_android_framework', {
315 'cflags': [
316 # Skia does not enforce this usage pattern so we disable it here to avoid
317 # unecessary log spew when building
318 '-Wno-unused-parameter',
319
320 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
321 # Revert to -D_FORTIFY_SOURCE=1
322 '-U_FORTIFY_SOURCE',
323 '-D_FORTIFY_SOURCE=1',
djsollenf379ad32015-01-27 09:01:01 -0800324
325 # We can't use the skia_shared_library gyp setting because we need to
326 # isolate this define to Skia sources. CFLAGS are local to Android.mk
327 # and ensures that this define is not exported to clients of the library
328 '-DSKIA_IMPLEMENTATION=1',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000329 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000330 # Remove flags which are either unnecessary or problematic for the
331 # Android framework build. Many of these flags are removed simply because
332 # they were not previously in the Android framework makefile, and we did
333 # did not intend to add them when generating the makefile.
334 # TODO (scroggo): Investigate whether any of these flags are actually
335 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000336 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000337 # Android has one makefile, used for both debugging (after manual
338 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000339 '-g',
340 '-march=armv7-a',
341 '-mthumb',
342 '-mfpu=neon',
343 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000344 '-fno-exceptions',
345 '-fstrict-aliasing',
346 # Remove flags to turn on warnings, since most people building Android
347 # are not focused on Skia and do not need the extra warning info.
348 '-Wall',
349 '-Wextra',
350 '-Winit-self',
351 '-Wpointer-arith',
mtkleina07b2972015-01-23 07:01:26 -0800352 '-Wsign-compare',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000353 ],
354 'cflags_cc!': [
355 '-fno-rtti',
356 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000357 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000358 'defines': [
359 'DCT_IFAST_SUPPORTED',
360 # using freetype's embolden allows us to adjust fake bold settings at
361 # draw-time, at which point we know which SkTypeface is being drawn
362 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000363 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
364 # When built as part of the system image we can enable certian non-NDK
365 # compliant optimizations.
366 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000367 # Optimizations for chromium (m30)
368 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000369 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
commit-bot@chromium.orge3c400f2014-05-28 21:44:05 +0000370 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
krajcevski8c111f72014-06-02 13:51:34 -0700371 'SK_IGNORE_ETC1_SUPPORT',
djsollenf379ad32015-01-27 09:01:01 -0800372 # We can't use the skia_shared_library gyp setting because we need expose
373 # this define globally and the the implemention define as a cflag.
374 'SKIA_DLL',
scroggo230d4ac2015-03-26 07:15:55 -0700375 'SK_PRINT_CODEC_MESSAGES',
borenet243406e2015-07-22 13:29:25 -0700376 ],
377 }],
378
379 ['skia_use_android_framework_defines', {
380 # Add these defines when building for the Android framework, or when
381 # specifically requested. These should be temporary staging defines. Any
382 # permanent defines should be moved into the skia_android_framework block
383 # above.
384 'includes' : [
385 'skia_for_android_framework_defines.gypi',
386 ],
387 'defines': [
commit-bot@chromium.org22a1d962014-05-30 21:53:01 +0000388 '<@(skia_for_android_framework_defines)',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000389 ],
390 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000391
borenet48087572015-04-02 12:16:36 -0700392 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000393 {
394 'defines': [
395 'SK_SAMPLES_FOR_X',
396 'SK_BUILD_FOR_UNIX',
397 ],
398 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000399 'Coverage': {
borenet11271fe2015-07-06 07:43:58 -0700400 'conditions': [
401 [ 'skia_clang_build', {
402 'cflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
403 'ldflags': ['-fprofile-instr-generate', '-fcoverage-mapping'],
404 }, {
405 'cflags': ['--coverage'],
406 'ldflags': ['--coverage'],
407 }],
408 ],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000409 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000410 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000411 },
412 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000413 'cflags': [
414 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000415 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000416 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000417 },
418 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000419 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000420 [ 'skia_shared_lib', {
zachr@google.com28c27c82013-06-20 17:15:05 +0000421 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000422 'SKIA_DLL',
423 'SKIA_IMPLEMENTATION=1',
424 ],
425 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000426 # Enable asan, tsan, etc.
427 [ 'skia_sanitizer', {
borenet@google.com0d193092013-07-03 15:55:05 +0000428 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000429 '-fsanitize=<(skia_sanitizer)',
borenet@google.com0d193092013-07-03 15:55:05 +0000430 ],
431 'ldflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000432 '-fsanitize=<(skia_sanitizer)',
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000433 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000434 'conditions' : [
435 [ 'skia_sanitizer == "thread"', {
mtklein172b4552015-03-12 05:27:46 -0700436 'defines': [ 'THREAD_SANITIZER' ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000437 }],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000438 [ 'skia_sanitizer == "undefined"', {
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000439 'cflags_cc!': ['-fno-rtti'],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000440 }],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000441 ],
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000442 }],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000443 [ 'skia_clang_build', {
mtklein170e00d2014-06-30 12:33:11 -0700444 'cflags_cc': [
mtklein170e00d2014-06-30 12:33:11 -0700445 '-Wno-unknown-warning-option', # Allows unknown warnings.
446 '-Wno-deprecated', # From Qt, via debugger (older Clang).
447 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
448 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000449 'cflags': [
mtklein170e00d2014-06-30 12:33:11 -0700450 # Extra warnings we like but that only Clang knows about.
451 '-Wstring-conversion',
borenet@google.com47ae4b02013-08-21 18:02:50 +0000452 ],
commit-bot@chromium.org815d3602014-05-20 19:42:03 +0000453 'cflags!': [
454 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
455 ],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000456 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000457 [ 'skia_keep_frame_pointer', {
458 'cflags': [ '-fno-omit-frame-pointer' ],
459 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000460 ],
461 },
462 ],
463
borenet@google.coma72aef82013-03-22 13:16:06 +0000464 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000465 {
mtkleina34633f2014-08-19 13:32:59 -0700466 'defines': [ 'SK_BUILD_FOR_MAC' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000467 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000468 'Coverage': {
469 'xcode_settings': {
470 'GCC_OPTIMIZATION_LEVEL': '0',
471 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
472 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
473 },
474 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000475 'Debug': {
mtkleina34633f2014-08-19 13:32:59 -0700476 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '0' },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000477 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000478 'Release': {
mtkleina34633f2014-08-19 13:32:59 -0700479 'xcode_settings': { 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)', },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000480 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000481 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000482 },
483 'xcode_settings': {
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000484 'conditions': [
mtkleindee3df92015-03-26 05:30:44 -0700485 [ 'skia_fast', { 'WARNING_CFLAGS': [ '<@(skia_fast_flags)' ] } ],
mtkleina34633f2014-08-19 13:32:59 -0700486 [ 'skia_warnings_as_errors', { 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES' }],
Brian Salomon4239fc22015-07-27 09:10:36 -0400487 [ 'skia_arch_type == "x86"', { 'ARCHS': ['i386'] }],
488 [ 'skia_arch_type == "x86_64"', { 'ARCHS': ['x86_64'] }],
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000489 [ 'skia_osx_deployment_target==""', {
mtkleina34633f2014-08-19 13:32:59 -0700490 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in env to ld.
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000491 }, {
492 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
493 }],
494 ],
mtklein65fd5992015-02-03 13:24:36 -0800495 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
mtklein94c41512014-09-12 17:07:34 -0700496 'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
497 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
498 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
mtklein335a0ae2014-10-13 12:32:34 -0700499 'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks
500 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings
501 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
mtkleina34633f2014-08-19 13:32:59 -0700502 'WARNING_CFLAGS': [
503 '-Wall',
504 '-Wextra',
mtkleina07b2972015-01-23 07:01:26 -0800505 '-Winit-self',
506 '-Wpointer-arith',
507 '-Wsign-compare',
508
mtkleina34633f2014-08-19 13:32:59 -0700509 '-Wno-unused-parameter',
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000510 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000511 },
512 },
513 ],
514
borenet@google.coma72aef82013-03-22 13:16:06 +0000515 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000516 {
517 'defines': [
518 'SK_BUILD_FOR_IOS',
519 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000520 'conditions' : [
521 [ 'skia_warnings_as_errors', {
522 'xcode_settings': {
523 'OTHER_CPLUSPLUSFLAGS': [
524 '-Werror',
525 ],
526 },
527 }],
528 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000529 'configurations': {
530 'Debug': {
531 'xcode_settings': {
532 'GCC_OPTIMIZATION_LEVEL': '0',
533 },
534 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000535 'Release': {
536 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000537 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000538 },
539 'defines': [ 'NDEBUG' ],
540 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000541 },
542 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000543 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000544 'CODE_SIGNING_REQUIRED': 'NO',
mtkleinea6075e2015-04-16 13:29:58 -0700545 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': 'iPhone Developer: Google Development (3F4Y5873JF)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000546 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000547 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000548 'TARGETED_DEVICE_FAMILY': '1,2',
mtklein335a0ae2014-10-13 12:32:34 -0700549 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'NO', # -Wno-invalid-offsetof
borenet@google.coma72aef82013-03-22 13:16:06 +0000550 'OTHER_CPLUSPLUSFLAGS': [
mtkleinf3cdce72015-02-05 09:23:56 -0800551 '-std=c++0x',
borenet@google.coma72aef82013-03-22 13:16:06 +0000552 '-fvisibility=hidden',
553 '-fvisibility-inlines-hidden',
554 ],
bsalomon@google.com89dec582012-09-28 18:33:11 +0000555 'GCC_THUMB_SUPPORT': 'NO',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000556 },
557 },
558 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000559
borenet@google.coma72aef82013-03-22 13:16:06 +0000560 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000561 {
562 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000563 'SK_BUILD_FOR_ANDROID',
djsollen@google.com968757e2014-04-11 13:09:21 +0000564
565 # Android Text Tuning
566 'SK_GAMMA_EXPONENT=1.4',
567 'SK_GAMMA_CONTRAST=0.0',
568 ],
569 # Android defines a fixed gamma exponent instead of using SRGB
570 'defines!': [
571 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000572 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000573 'configurations': {
574 'Debug': {
mtkleinc0591ca2014-11-21 14:42:35 -0800575 'cflags': ['-g']
scroggo@google.comeb629502014-02-04 16:08:48 +0000576 },
577 'Release': {
578 'cflags': ['-O2'],
scroggo@google.comeb629502014-02-04 16:08:48 +0000579 },
580 },
djsollen@google.com58629292011-11-03 13:08:29 +0000581 'libraries': [
djsollen@google.com318cf922011-11-08 19:03:43 +0000582 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000583 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000584 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000585 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000586 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000587 'conditions': [
scroggodf1c3372015-02-12 10:48:25 -0800588 [ '"x86" in skia_arch_type', {
djsollenbc893292014-07-24 13:53:56 -0700589 'cflags': [
590 '-mssse3',
591 ],
592 }],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000593 [ 'skia_android_framework', {
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000594 'cflags!': [
595 '-fuse-ld=gold',
scroggo7cd3f642015-02-12 13:27:40 -0800596 '-mssse3',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000597 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000598 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000599 [ 'skia_shared_lib', {
djsollen@google.com52f02972013-06-03 12:10:19 +0000600 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000601 'SKIA_DLL',
602 'SKIA_IMPLEMENTATION=1',
scroggoecce60b2014-07-09 07:26:40 -0700603 # Needed until we fix skbug.com/2440.
604 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
djsollen@google.com52f02972013-06-03 12:10:19 +0000605 ],
606 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000607 [ 'skia_profile_enabled == 1', {
608 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000609 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000610 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000611 },
612 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000613
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000614 [ 'skia_moz2d', {
615 'defines': [
reed6518eaa2014-06-18 14:05:22 -0700616 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
commit-bot@chromium.org199cf692014-05-08 15:29:57 +0000617 ],
618 }],
619
mtklein4abc1862015-07-14 05:52:52 -0700620 [ 'sknx_no_simd', {
621 'defines': [ 'SKNX_NO_SIMD' ],
622 }],
623
seanpaul@google.com1134f982011-09-15 14:24:33 +0000624 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000625 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
626 'xcode_settings': {
627 'SYMROOT': '<(DEPTH)/xcodebuild',
628 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000629}