blob: 8498fe3b359ddeb8742b8765e6a7cf147f87638f [file] [log] [blame]
seanpaul@google.com1134f982011-09-15 14:24:33 +00001# conditions used in both common.gypi and skia.gyp in chromium
2#
3{
chudy@google.combbad34d2012-08-13 14:26:36 +00004 'defines': [
5 'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
mtklein@google.comdad70702013-11-20 18:06:10 +00006 'SK_SUPPORT_GPU=<(skia_gpu)',
7 'SK_SUPPORT_OPENCL=<(skia_opencl)',
commit-bot@chromium.orgae796122014-03-12 17:05:46 +00008 'SK_FORCE_DISTANCEFIELD_FONTS=<(skia_force_distancefield_fonts)',
chudy@google.combbad34d2012-08-13 14:26:36 +00009 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000010 'conditions' : [
commit-bot@chromium.org6f2d4d42014-04-02 15:03:56 +000011 [ 'skia_arch_type == "arm64"', {
12 'cflags': [
13 '-ffp-contract=off',
14 ],
15 }],
16
borenet@google.coma72aef82013-03-22 13:16:06 +000017 [ 'skia_os == "win"',
seanpaul@google.com1134f982011-09-15 14:24:33 +000018 {
19 'defines': [
20 'SK_BUILD_FOR_WIN32',
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000021 '_CRT_SECURE_NO_WARNINGS',
senorblanco@chromium.org5f47a392012-07-12 00:34:39 +000022 'GR_GL_FUNCTION_TYPE=__stdcall',
seanpaul@google.com1134f982011-09-15 14:24:33 +000023 ],
commit-bot@chromium.org50ca12b2014-05-07 19:56:27 +000024 'msvs_disabled_warnings': [
25 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
26 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000027 'msvs_cygwin_shell': 0,
28 'msvs_settings': {
29 'VCCLCompilerTool': {
bsalomon@google.comb58a6392013-03-21 20:29:05 +000030 'WarningLevel': '3',
31 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
seanpaul@google.com1134f982011-09-15 14:24:33 +000032 'DebugInformationFormat': '3',
bsalomon@google.comb58a6392013-03-21 20:29:05 +000033 'ExceptionHandling': '0',
34 'AdditionalOptions': [ '/MP', ],
seanpaul@google.com1134f982011-09-15 14:24:33 +000035 },
36 'VCLinkerTool': {
commit-bot@chromium.org4521add2014-04-30 20:47:22 +000037 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
seanpaul@google.com1134f982011-09-15 14:24:33 +000038 'AdditionalDependencies': [
39 'OpenGL32.lib',
40 'usp10.lib',
bungeman@google.comf51e1252013-06-05 18:35:22 +000041
42 # Prior to gyp r1584, the following were included automatically.
43 'kernel32.lib',
44 'gdi32.lib',
45 'winspool.lib',
46 'comdlg32.lib',
47 'advapi32.lib',
48 'shell32.lib',
49 'ole32.lib',
50 'oleaut32.lib',
51 'user32.lib',
52 'uuid.lib',
53 'odbc32.lib',
54 'odbccp32.lib',
bsalomon@google.combbba7842013-06-06 18:34:13 +000055 'DelayImp.lib',
seanpaul@google.com1134f982011-09-15 14:24:33 +000056 ],
57 },
58 },
59 'configurations': {
60 'Debug': {
61 'msvs_settings': {
62 'VCCLCompilerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000063 'DebugInformationFormat': '4', # editAndContiue (/ZI)
seanpaul@google.com1134f982011-09-15 14:24:33 +000064 'Optimization': '0', # optimizeDisabled (/Od)
65 'PreprocessorDefinitions': ['_DEBUG'],
66 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000067 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +000068 },
69 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000070 'GenerateDebugInformation': 'true', # /DEBUG
71 'LinkIncremental': '2', # /INCREMENTAL
seanpaul@google.com1134f982011-09-15 14:24:33 +000072 },
73 },
74 },
75 'Release': {
76 'msvs_settings': {
77 'VCCLCompilerTool': {
bsalomon@google.com9aabfc72012-05-31 14:12:46 +000078 'DebugInformationFormat': '3', # programDatabase (/Zi)
commit-bot@chromium.org06b38642013-06-20 20:28:54 +000079 'Optimization': '<(skia_release_optimization_level)',
bsalomon@google.comd9718692013-04-22 14:56:50 +000080 'WholeProgramOptimization': 'true', #/GL
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000081 # Changing the floating point model requires rebaseling gm images
bsalomon@google.com9aabfc72012-05-31 14:12:46 +000082 #'FloatingPointModel': '2', # fast (/fp:fast)
83 'FavorSizeOrSpeed': '1', # speed (/Ot)
seanpaul@google.com1134f982011-09-15 14:24:33 +000084 'PreprocessorDefinitions': ['NDEBUG'],
bsalomon@google.com9aabfc72012-05-31 14:12:46 +000085 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
bsalomon@google.com9aabfc72012-05-31 14:12:46 +000086 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
87 'RuntimeTypeInfo': 'false', # /GR-
seanpaul@google.com1134f982011-09-15 14:24:33 +000088 },
89 'VCLinkerTool': {
bsalomon@google.com8b5abec2011-09-28 14:32:01 +000090 'GenerateDebugInformation': 'true', # /DEBUG
bsalomon@google.comd9718692013-04-22 14:56:50 +000091 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
seanpaul@google.com1134f982011-09-15 14:24:33 +000092 },
bungeman@google.com983297e2011-10-03 19:36:51 +000093 'VCLibrarianTool': {
bsalomon@google.comd9718692013-04-22 14:56:50 +000094 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
bungeman@google.com983297e2011-10-03 19:36:51 +000095 },
seanpaul@google.com1134f982011-09-15 14:24:33 +000096 },
97 },
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +000098 },
99 'conditions' : [
epoger@google.com58d69d82014-04-01 07:02:41 +0000100 # Gyp's ninja generator depends on these specially named
101 # configurations to build 64-bit on Windows.
102 # See http://skbug.com/2348
103 #
104 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
105 # OK for us to just make these inherit non-archwidth-specific
106 # configurations without modification.
commit-bot@chromium.orgd10ec402014-04-22 20:05:35 +0000107 #
108 # See http://skbug.com/2442 : These targets cause problems in the
109 # MSVS build, so only include them if gyp is generating a ninja build.
110 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
111 'configurations': {
112 'Debug_x64': {
113 'inherit_from': ['Debug'],
114 },
115 'Release_x64': {
116 'inherit_from': ['Release'],
117 },
118 'Release_Developer_x64': {
119 'inherit_from': ['Release_Developer'],
120 },
121 },
122 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000123 [ 'skia_arch_width == 64', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000124 'msvs_configuration_platform': 'x64',
borenet@google.coma72aef82013-03-22 13:16:06 +0000125 }],
126 [ 'skia_arch_width == 32', {
127 'msvs_configuration_platform': 'Win32',
128 }],
129 [ 'skia_warnings_as_errors', {
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000130 'msvs_settings': {
131 'VCCLCompilerTool': {
borenet@google.coma72aef82013-03-22 13:16:06 +0000132 'WarnAsError': 'true',
133 'AdditionalOptions': [
134 '/we4189', # initialized but unused var warning
135 ],
bsalomon@google.com1d03ba92013-01-08 20:40:22 +0000136 },
137 },
borenet@google.comb7961192012-08-20 18:58:26 +0000138 }],
commit-bot@chromium.org5a6c2d82013-06-14 17:10:09 +0000139 [ 'skia_win_exceptions', {
140 'msvs_settings': {
141 'VCCLCompilerTool': {
142 'AdditionalOptions': [
143 '/EHsc',
144 ],
145 },
146 },
147 }],
borenet@google.comb7961192012-08-20 18:58:26 +0000148 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000149 },
150 ],
151
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000152 # The following section is common to linux + derivatives and android
153 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
154 {
mtklein@google.comf1077f92013-11-20 15:13:49 +0000155 'cflags': [
mtklein@google.comdad70702013-11-20 18:06:10 +0000156 '-g',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000157 '-fno-exceptions',
158 '-fstrict-aliasing',
mtklein@google.comdad70702013-11-20 18:06:10 +0000159
mtklein@google.comf1077f92013-11-20 15:13:49 +0000160 '-Wall',
161 '-Wextra',
162 '-Winit-self',
163 '-Wpointer-arith',
164
165 '-Wno-unused-parameter',
mtklein@google.comf1077f92013-11-20 15:13:49 +0000166 ],
167 'cflags_cc': [
168 '-fno-rtti',
169 '-Wnon-virtual-dtor',
170 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000171 'conditions': [
commit-bot@chromium.org93f5e512014-02-17 15:22:26 +0000172 [ 'skia_android_framework==0', {
173 'cflags': [
174 # This flag is not supported by Android build system.
175 '-Wno-c++11-extensions',
176 ],
177 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000178 [ 'skia_warnings_as_errors', {
179 'cflags': [
180 '-Werror',
181 ],
182 }],
commit-bot@chromium.org35d48722014-02-13 18:36:36 +0000183 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
184 [ 'skia_disable_inlining', {
185 'cflags': [
186 '-fno-inline',
187 '-fno-default-inline',
188 '-finline-limit=0',
189 '-fno-omit-frame-pointer',
190 ],
191 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000192 [ 'skia_arch_type == "arm" and arm_thumb == 1', {
193 'cflags': [
194 '-mthumb',
195 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000196 # The --fix-cortex-a8 switch enables a link-time workaround for
197 # an erratum in certain Cortex-A8 processors. The workaround is
198 # enabled by default if you target the ARM v7-A arch profile.
199 # It can be enabled otherwise by specifying --fix-cortex-a8, or
200 # disabled unconditionally by specifying --no-fix-cortex-a8.
201 #
202 # The erratum only affects Thumb-2 code.
203 'conditions': [
204 [ 'arm_version < 7', {
205 'ldflags': [
206 '-Wl,--fix-cortex-a8',
207 ],
208 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000209 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000210 }],
211 [ 'skia_arch_type == "arm" and arm_version >= 7', {
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000212 'cflags': [
213 '-march=armv7-a',
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000214 ],
djsollen@google.comf7542ba2013-07-31 12:57:27 +0000215 'ldflags': [
216 '-march=armv7-a',
217 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000218 'conditions': [
219 [ 'arm_neon == 1', {
220 'defines': [
221 '__ARM_HAVE_NEON',
222 ],
223 'cflags': [
224 '-mfpu=neon',
225 ],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000226 }],
227 [ 'arm_neon_optional == 1', {
228 'defines': [
229 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
230 ],
231 }],
borenet@google.come2b90372013-07-11 18:46:30 +0000232 [ 'skia_os != "chromeos"', {
233 'cflags': [
234 '-mfloat-abi=softfp',
235 ],
236 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000237 ],
238 }],
239 ],
240 },
241 ],
242
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000243 ['skia_android_framework', {
244 'cflags': [
245 # Skia does not enforce this usage pattern so we disable it here to avoid
246 # unecessary log spew when building
247 '-Wno-unused-parameter',
248
249 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
250 # Revert to -D_FORTIFY_SOURCE=1
251 '-U_FORTIFY_SOURCE',
252 '-D_FORTIFY_SOURCE=1',
253 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000254 # Remove flags which are either unnecessary or problematic for the
255 # Android framework build. Many of these flags are removed simply because
256 # they were not previously in the Android framework makefile, and we did
257 # did not intend to add them when generating the makefile.
258 # TODO (scroggo): Investigate whether any of these flags are actually
259 # needed/would be beneficial.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000260 'cflags!': [
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000261 # Android has one makefile, used for both debugging (after manual
262 # modification) and release. Turn off debug info by default.
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000263 '-g',
264 '-march=armv7-a',
265 '-mthumb',
266 '-mfpu=neon',
267 '-mfloat-abi=softfp',
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000268 # This flag is not supported by Android build system.
269 '-Wno-c++11-extensions',
270 '-fno-exceptions',
271 '-fstrict-aliasing',
272 # Remove flags to turn on warnings, since most people building Android
273 # are not focused on Skia and do not need the extra warning info.
274 '-Wall',
275 '-Wextra',
276 '-Winit-self',
277 '-Wpointer-arith',
278 ],
279 'cflags_cc!': [
280 '-fno-rtti',
281 '-Wnon-virtual-dtor',
commit-bot@chromium.orge72a4082014-02-28 16:07:39 +0000282 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000283 'defines': [
284 'DCT_IFAST_SUPPORTED',
285 # using freetype's embolden allows us to adjust fake bold settings at
286 # draw-time, at which point we know which SkTypeface is being drawn
287 'SK_USE_FREETYPE_EMBOLDEN',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000288 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
289 # When built as part of the system image we can enable certian non-NDK
290 # compliant optimizations.
291 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
commit-bot@chromium.orgba0c5ea2014-03-28 15:59:04 +0000292 # Optimizations for chromium (m30)
293 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
294 'IGNORE_ROT_AA_RECT_OPT',
295 # Disable this check because it is too strict for some chromium-specific
296 # subclasses of SkPixelRef. See bug: crbug.com/171776.
297 'SK_DISABLE_PIXELREF_LOCKCOUNT_BALANCE_CHECK',
298 'SkLONGLONG int64_t',
299 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
300 'SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_android.h"',
301 'SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_pthread.h"',
commit-bot@chromium.org848fdb02014-04-04 21:19:53 +0000302 # FIXME: b/13729784: Need to rework LayerRasterizer.cpp
303 'SK_SUPPORT_LEGACY_LAYERRASTERIZER_API',
commit-bot@chromium.org28fcae22014-04-11 17:15:40 +0000304 # Still need to switch Android to the new name for N32.
305 'kNative_8888_SkColorType kN32_SkColorType',
commit-bot@chromium.org04f6c4c2014-04-16 22:08:32 +0000306 'SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD',
commit-bot@chromium.org03f2f812014-04-16 23:06:29 +0000307 'SK_SUPPORT_DEPRECATED_RECORD_FLAGS',
commit-bot@chromium.org5fb2ce32014-04-17 23:35:06 +0000308 'SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES',
robertphillips@google.com770963f2014-04-18 18:04:41 +0000309 'SK_SUPPORT_LEGACY_PICTURE_HEADERS',
commit-bot@chromium.org03f2f812014-04-16 23:06:29 +0000310 'SK_SUPPORT_LEGACY_BLURDRAWLOOPERCONSTRUCTORS',
commit-bot@chromium.orge3964552014-04-28 16:25:35 +0000311 'SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE',
commit-bot@chromium.org1d0b68c2014-04-21 14:42:38 +0000312 # Needed until we fix skbug.com/2440.
313 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
commit-bot@chromium.orgd70fa202014-04-24 21:51:58 +0000314 # Transitional, for deprecated SkCanvas::SaveFlags methods.
315 'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000316 ],
317 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000318
borenet@google.com05d550e2013-06-11 15:52:19 +0000319 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000320 {
321 'defines': [
322 'SK_SAMPLES_FOR_X',
323 'SK_BUILD_FOR_UNIX',
324 ],
325 'configurations': {
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000326 'Coverage': {
mtklein@google.comdad70702013-11-20 18:06:10 +0000327 'cflags': ['--coverage'],
mtklein@google.com1fb04e22013-09-13 19:32:43 +0000328 'ldflags': ['--coverage'],
329 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000330 'Debug': {
seanpaul@google.com1134f982011-09-15 14:24:33 +0000331 },
332 'Release': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000333 'cflags': [
334 '-O<(skia_release_optimization_level)',
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000335 ],
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000336 'defines': [ 'NDEBUG' ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000337 },
338 },
borenet@google.coma37a5172012-08-09 20:44:32 +0000339 'conditions' : [
zachr@google.com28c27c82013-06-20 17:15:05 +0000340 [ 'skia_shared_lib', {
341 'cflags': [
342 '-fPIC',
343 ],
344 'defines': [
zachr@google.com28c27c82013-06-20 17:15:05 +0000345 'SKIA_DLL',
346 'SKIA_IMPLEMENTATION=1',
347 ],
348 }],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000349 [ 'skia_os == "nacl"', {
350 'defines': [
351 'SK_BUILD_FOR_NACL',
352 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000353 'variables': {
commit-bot@chromium.org25595ed2014-04-04 18:16:04 +0000354 'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000355 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000356 'link_settings': {
357 'libraries': [
358 '-lppapi',
359 '-lppapi_cpp',
360 '-lnosys',
361 '-pthread',
362 ],
commit-bot@chromium.orgfe424102014-02-21 00:40:16 +0000363 'ldflags': [
364 '-L<(nacl_sdk_root)/lib/newlib_x86_<(skia_arch_width)/Release',
365 '-L<(nacl_sdk_root)/ports/lib/newlib_x86_<(skia_arch_width)/Release',
366 ],
borenet@google.com7158e6a2012-11-01 17:43:44 +0000367 },
borenet@google.comcb9445d2013-08-19 18:26:04 +0000368 }, { # skia_os != "nacl"
369 'link_settings': {
370 'ldflags': [
371 '-lstdc++',
372 '-lm',
373 ],
374 },
borenet@google.com7158e6a2012-11-01 17:43:44 +0000375 }],
borenet@google.comcb9445d2013-08-19 18:26:04 +0000376 [ 'skia_os != "chromeos"', {
borenet@google.com05d550e2013-06-11 15:52:19 +0000377 'conditions': [
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000378 [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
borenet@google.com05d550e2013-06-11 15:52:19 +0000379 'cflags': [
380 '-m64',
381 ],
382 'ldflags': [
383 '-m64',
384 ],
385 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000386 [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
borenet@google.com05d550e2013-06-11 15:52:19 +0000387 'cflags': [
388 '-m32',
389 ],
390 'ldflags': [
391 '-m32',
392 ],
393 }],
394 ],
395 }],
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000396 # Enable asan, tsan, etc.
397 [ 'skia_sanitizer', {
borenet@google.com0d193092013-07-03 15:55:05 +0000398 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000399 '-fsanitize=<(skia_sanitizer)',
borenet@google.com0d193092013-07-03 15:55:05 +0000400 ],
401 'ldflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000402 '-fsanitize=<(skia_sanitizer)',
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000403 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000404 'conditions' : [
405 [ 'skia_sanitizer == "thread"', {
406 'defines': [ 'DYNAMIC_ANNOTATIONS_ENABLED=1' ],
bungeman@google.com0fbe01f2013-10-10 17:24:17 +0000407 'cflags': [ '-fPIC' ],
bungeman@google.com27d4ffe2013-10-10 17:09:49 +0000408 'target_conditions': [
409 [ '_type == "executable"', {
410 'cflags': [ '-fPIE' ],
411 'ldflags': [ '-pie' ],
412 }],
413 ],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000414 }],
commit-bot@chromium.org05b1b532014-05-01 19:29:46 +0000415 [ 'skia_sanitizer == "undefined"', {
416 'cflags': [ '-fPIC' ],
417 'cflags_cc!': ['-fno-rtti'],
418 'target_conditions': [
419 [ '_type == "executable"', {
420 'cflags': [ '-fPIE' ],
421 'ldflags': [ '-pie' ],
422 }],
423 ],
424 }],
mtklein@google.com3a19fb52013-10-09 16:12:23 +0000425 ],
bungeman@google.com1435f9f2013-09-25 22:39:22 +0000426 }],
borenet@google.com47ae4b02013-08-21 18:02:50 +0000427 [ 'skia_clang_build', {
428 'cflags': [
mtklein@google.com9f3b0e42013-10-08 15:16:36 +0000429 # Extra warnings we like but that only Clang knows about.
borenet@google.com47ae4b02013-08-21 18:02:50 +0000430 '-Wstring-conversion',
431 ],
432 }],
commit-bot@chromium.org5003bde2013-10-25 18:14:54 +0000433 [ 'skia_keep_frame_pointer', {
434 'cflags': [ '-fno-omit-frame-pointer' ],
435 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000436 ],
437 },
438 ],
439
borenet@google.coma72aef82013-03-22 13:16:06 +0000440 [ 'skia_os == "mac"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000441 {
442 'defines': [
443 'SK_BUILD_FOR_MAC',
444 ],
djsollen@google.come341cb32012-06-28 16:08:05 +0000445 'conditions' : [
borenet@google.coma72aef82013-03-22 13:16:06 +0000446 [ 'skia_arch_width == 64', {
djsollen@google.come341cb32012-06-28 16:08:05 +0000447 'xcode_settings': {
commit-bot@chromium.org5d7ca952013-04-22 20:26:44 +0000448 'ARCHS': ['x86_64'],
djsollen@google.come341cb32012-06-28 16:08:05 +0000449 },
450 }],
borenet@google.coma72aef82013-03-22 13:16:06 +0000451 [ 'skia_arch_width == 32', {
djsollen@google.come341cb32012-06-28 16:08:05 +0000452 'xcode_settings': {
commit-bot@chromium.org5d7ca952013-04-22 20:26:44 +0000453 'ARCHS': ['i386'],
borenet@google.coma72aef82013-03-22 13:16:06 +0000454 },
455 }],
456 [ 'skia_warnings_as_errors', {
457 'xcode_settings': {
humper@google.comfe0d6802013-01-07 20:28:16 +0000458 'OTHER_CPLUSPLUSFLAGS': [
459 '-Werror',
commit-bot@chromium.orgfaa5ae42013-07-23 11:13:56 +0000460 '-Wall',
461 '-Wextra',
462 '-Wno-unused-parameter',
commit-bot@chromium.org6a180792014-01-15 21:39:18 +0000463 '-Wno-uninitialized', # Disabled because we think GCC 4.2 is bad at this.
mtklein@google.com8d725b22013-07-24 16:20:05 +0000464 ],
465 },
466 }],
djsollen@google.come341cb32012-06-28 16:08:05 +0000467 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000468 'configurations': {
commit-bot@chromium.org866f4e32013-11-21 17:04:29 +0000469 'Coverage': {
470 'xcode_settings': {
471 'GCC_OPTIMIZATION_LEVEL': '0',
472 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
473 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
474 },
475 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000476 'Debug': {
477 'xcode_settings': {
478 'GCC_OPTIMIZATION_LEVEL': '0',
479 },
480 },
reed@google.come05cc8e2011-10-10 14:19:40 +0000481 'Release': {
482 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000483 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
reed@google.come05cc8e2011-10-10 14:19:40 +0000484 },
senorblanco@chromium.org7288c492012-01-19 19:59:22 +0000485 'defines': [ 'NDEBUG' ],
reed@google.come05cc8e2011-10-10 14:19:40 +0000486 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000487 },
488 'xcode_settings': {
robertphillips@google.com02297652012-04-05 19:29:04 +0000489 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
senorblanco@chromium.org29f351a2014-01-20 16:14:02 +0000490 'conditions': [
491 [ 'skia_osx_deployment_target==""', {
492 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in environment to ld.
493 }, {
494 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
495 }],
496 ],
reed@google.com0069aa52011-11-17 15:35:47 +0000497# trying to get this to work, but it needs clang I think...
498# 'WARNING_CFLAGS': '-Wexit-time-destructors',
mike@reedtribe.orge51755f2011-12-10 19:36:56 +0000499 'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
caryclark@google.comb462a422012-06-06 12:12:28 +0000500 'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
501 'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'YES',
502 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'YES',
503 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
504 'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
505 'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
506 'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
507 'GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL': 'YES',
508 'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
509 'GCC_WARN_MISSING_PARENTHESES': 'YES',
510 'GCC_WARN_PROTOTYPE_CONVERSION': 'YES',
511 'GCC_WARN_SIGN_COMPARE': 'YES',
512 'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
513 'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
514 'GCC_WARN_UNUSED_FUNCTION': 'YES',
515 'GCC_WARN_UNUSED_LABEL': 'YES',
516 'GCC_WARN_UNUSED_VALUE': 'YES',
517 'GCC_WARN_UNUSED_VARIABLE': 'YES',
bungeman@google.com43b4ed52012-10-02 15:42:21 +0000518 'OTHER_CPLUSPLUSFLAGS': [
519 '-mssse3',
520 '-fvisibility=hidden',
521 '-fvisibility-inlines-hidden',
522 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000523 },
524 },
525 ],
526
borenet@google.coma72aef82013-03-22 13:16:06 +0000527 [ 'skia_os == "ios"',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000528 {
529 'defines': [
530 'SK_BUILD_FOR_IOS',
531 ],
borenet@google.coma72aef82013-03-22 13:16:06 +0000532 'conditions' : [
533 [ 'skia_warnings_as_errors', {
534 'xcode_settings': {
535 'OTHER_CPLUSPLUSFLAGS': [
536 '-Werror',
537 ],
538 },
539 }],
540 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000541 'configurations': {
542 'Debug': {
543 'xcode_settings': {
544 'GCC_OPTIMIZATION_LEVEL': '0',
545 },
546 },
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000547 'Release': {
548 'xcode_settings': {
commit-bot@chromium.org06b38642013-06-20 20:28:54 +0000549 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000550 },
551 'defines': [ 'NDEBUG' ],
552 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000553 },
554 'xcode_settings': {
commit-bot@chromium.orgae0054e2014-04-05 01:13:43 +0000555 'ARCHS': ['armv7'],
caryclark@google.com867cbd82012-09-20 15:45:41 +0000556 'CODE_SIGNING_REQUIRED': 'NO',
557 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000558 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
caryclark@google.com867cbd82012-09-20 15:45:41 +0000559 'SDKROOT': 'iphoneos',
caryclark@google.com594dd3c2012-09-24 19:33:57 +0000560 'TARGETED_DEVICE_FAMILY': '1,2',
borenet@google.coma72aef82013-03-22 13:16:06 +0000561 'OTHER_CPLUSPLUSFLAGS': [
562 '-fvisibility=hidden',
563 '-fvisibility-inlines-hidden',
564 ],
bsalomon@google.com89dec582012-09-28 18:33:11 +0000565 'GCC_THUMB_SUPPORT': 'NO',
seanpaul@google.com1134f982011-09-15 14:24:33 +0000566 },
567 },
568 ],
chudy@google.combbad34d2012-08-13 14:26:36 +0000569
borenet@google.coma72aef82013-03-22 13:16:06 +0000570 [ 'skia_os == "android"',
djsollen@google.com58629292011-11-03 13:08:29 +0000571 {
572 'defines': [
djsollen@google.com58629292011-11-03 13:08:29 +0000573 'SK_BUILD_FOR_ANDROID',
bungeman@google.com451b5962013-11-11 18:36:46 +0000574 'SK_FONTHOST_DOES_NOT_USE_FONTMGR',
djsollen@google.com968757e2014-04-11 13:09:21 +0000575
576 # Android Text Tuning
577 'SK_GAMMA_EXPONENT=1.4',
578 'SK_GAMMA_CONTRAST=0.0',
579 ],
580 # Android defines a fixed gamma exponent instead of using SRGB
581 'defines!': [
582 'SK_GAMMA_SRGB',
djsollen@google.com58629292011-11-03 13:08:29 +0000583 ],
scroggo@google.comeb629502014-02-04 16:08:48 +0000584 'configurations': {
585 'Debug': {
586 'cflags': ['-g']
587 },
588 'Release': {
589 'cflags': ['-O2'],
590 'defines': [ 'NDEBUG' ],
591 },
592 },
djsollen@google.com58629292011-11-03 13:08:29 +0000593 'libraries': [
scroggo@google.comeb629502014-02-04 16:08:48 +0000594 '-lstdc++',
595 '-lm',
djsollen@google.com318cf922011-11-08 19:03:43 +0000596 '-llog',
djsollen@google.com58629292011-11-03 13:08:29 +0000597 ],
djsollen@google.com44360bc2011-12-05 13:55:55 +0000598 'cflags': [
borenet@google.comde9ac142012-07-25 15:17:03 +0000599 '-fuse-ld=gold',
djsollen@google.com44360bc2011-12-05 13:55:55 +0000600 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000601 'conditions': [
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000602 [ 'skia_android_framework', {
603 'libraries!': [
604 '-lstdc++',
605 '-lm',
606 ],
commit-bot@chromium.org2fe641b2014-03-25 15:14:18 +0000607 'cflags!': [
608 '-fuse-ld=gold',
609 ],
scroggo@google.comd4adfa32014-02-05 16:35:12 +0000610 }],
djsollen@google.com52f02972013-06-03 12:10:19 +0000611 [ 'skia_shared_lib', {
612 'cflags': [
613 '-fPIC',
614 ],
615 'defines': [
djsollen@google.com52f02972013-06-03 12:10:19 +0000616 'SKIA_DLL',
617 'SKIA_IMPLEMENTATION=1',
618 ],
619 }],
commit-bot@chromium.org183f7f52013-07-11 12:48:14 +0000620 [ 'skia_profile_enabled == 1', {
621 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
djsollen@google.com3839ca12011-11-03 17:31:41 +0000622 }],
chudy@google.combbad34d2012-08-13 14:26:36 +0000623 ],
djsollen@google.com58629292011-11-03 13:08:29 +0000624 },
625 ],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000626
digit@google.com1771cbf2012-01-26 21:26:40 +0000627 # We can POD-style initialization of static mutexes to avoid generating
628 # static initializers if we're using a pthread-compatible thread interface.
629 [ 'skia_os != "win"', {
630 'defines': [
borenet@google.com7158e6a2012-11-01 17:43:44 +0000631 'SK_USE_POSIX_THREADS',
digit@google.com1771cbf2012-01-26 21:26:40 +0000632 ],
633 }],
seanpaul@google.com1134f982011-09-15 14:24:33 +0000634 ], # end 'conditions'
caryclark@google.com4588ce82012-09-26 15:48:43 +0000635 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
636 'xcode_settings': {
637 'SYMROOT': '<(DEPTH)/xcodebuild',
638 },
seanpaul@google.com1134f982011-09-15 14:24:33 +0000639}