Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / gyp / common_conditions.gypi
1 # conditions used in both common.gypi and skia.gyp in chromium
2 #
3 {
4   'defines': [
5     'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
6     'SK_SUPPORT_GPU=<(skia_gpu)',
7     'SK_SUPPORT_OPENCL=<(skia_opencl)',
8     'SK_DISTANCEFIELD_FONTS=<(skia_distancefield_fonts)',
9   ],
10   'conditions' : [
11     [ 'skia_os == "win"',
12       {
13         'defines': [
14           'SK_BUILD_FOR_WIN32',
15           '_CRT_SECURE_NO_WARNINGS',
16           'GR_GL_FUNCTION_TYPE=__stdcall',
17         ],
18         'msvs_cygwin_shell': 0,
19         'msvs_settings': {
20           'VCCLCompilerTool': {
21             'WarningLevel': '3',
22             'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
23             'DebugInformationFormat': '3',
24             'ExceptionHandling': '0',
25             'AdditionalOptions': [ '/MP', ],
26           },
27           'VCLinkerTool': {
28             'AdditionalDependencies': [
29               'OpenGL32.lib',
30               'usp10.lib',
31
32               # Prior to gyp r1584, the following were included automatically.
33               'kernel32.lib',
34               'gdi32.lib',
35               'winspool.lib',
36               'comdlg32.lib',
37               'advapi32.lib',
38               'shell32.lib',
39               'ole32.lib',
40               'oleaut32.lib',
41               'user32.lib',
42               'uuid.lib',
43               'odbc32.lib',
44               'odbccp32.lib',
45               'DelayImp.lib',
46             ],
47           },
48         },
49         'configurations': {
50           'Debug': {
51             'msvs_settings': {
52               'VCCLCompilerTool': {
53                 'DebugInformationFormat': '4', # editAndContiue (/ZI)
54                 'Optimization': '0',           # optimizeDisabled (/Od)
55                 'PreprocessorDefinitions': ['_DEBUG'],
56                 'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
57                 'RuntimeTypeInfo': 'false',      # /GR-
58               },
59               'VCLinkerTool': {
60                 'GenerateDebugInformation': 'true', # /DEBUG
61                 'LinkIncremental': '2',             # /INCREMENTAL
62               },
63             },
64           },
65           'Release': {
66             'msvs_settings': {
67               'VCCLCompilerTool': {
68                 'DebugInformationFormat': '3',      # programDatabase (/Zi)
69                 'Optimization': '<(skia_release_optimization_level)',
70                 'WholeProgramOptimization': 'true', #/GL
71                # Changing the floating point model requires rebaseling gm images
72                #'FloatingPointModel': '2',          # fast (/fp:fast)
73                 'FavorSizeOrSpeed': '1',            # speed (/Ot)
74                 'PreprocessorDefinitions': ['NDEBUG'],
75                 'RuntimeLibrary': '2',              # rtMultiThreadedDLL (/MD)
76                 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
77                 'RuntimeTypeInfo': 'false',         # /GR-
78               },
79               'VCLinkerTool': {
80                 'GenerateDebugInformation': 'true', # /DEBUG
81                 'LinkTimeCodeGeneration': '1',      # useLinkTimeCodeGeneration /LTCG
82               },
83               'VCLibrarianTool': {
84                 'LinkTimeCodeGeneration': 'true',   # useLinkTimeCodeGeneration /LTCG
85               },
86             },
87           },
88         },
89         'conditions' : [
90           [ 'skia_arch_width == 64', {
91             'msvs_configuration_platform': 'x64',
92           }],
93           [ 'skia_arch_width == 32', {
94             'msvs_configuration_platform': 'Win32',
95           }],
96           [ 'skia_warnings_as_errors', {
97             'msvs_settings': {
98               'VCCLCompilerTool': {
99                 'WarnAsError': 'true',
100                 'AdditionalOptions': [
101                   '/we4189', # initialized but unused var warning
102                 ],
103               },
104             },
105           }],
106           [ 'skia_win_exceptions', {
107             'msvs_settings': {
108               'VCCLCompilerTool': {
109                 'AdditionalOptions': [
110                   '/EHsc',
111                 ],
112               },
113             },
114           }],
115         ],
116       },
117     ],
118
119     # The following section is common to linux + derivatives and android
120     [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
121       {
122         'cflags': [
123           '-g',
124           '-fno-exceptions',
125           '-fstrict-aliasing',
126
127           '-Wall',
128           '-Wextra',
129           '-Winit-self',
130           '-Wpointer-arith',
131
132           '-Wno-unused-parameter',
133           '-Wno-c++11-extensions',
134         ],
135         'cflags_cc': [
136           '-fno-rtti',
137           '-Wnon-virtual-dtor',
138         ],
139         'conditions': [
140           [ 'skia_warnings_as_errors', {
141             'cflags': [
142               '-Werror',
143             ],
144           }],
145           # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
146           [ 'skia_disable_inlining', {
147             'cflags': [
148               '-fno-inline',
149               '-fno-default-inline',
150               '-finline-limit=0',
151               '-fno-omit-frame-pointer',
152             ],
153           }],
154           [ 'skia_arch_type == "arm" and arm_thumb == 1', {
155             'cflags': [
156               '-mthumb',
157             ],
158             # The --fix-cortex-a8 switch enables a link-time workaround for
159             # an erratum in certain Cortex-A8 processors.  The workaround is
160             # enabled by default if you target the ARM v7-A arch profile.
161             # It can be enabled otherwise by specifying --fix-cortex-a8, or
162             # disabled unconditionally by specifying --no-fix-cortex-a8.
163             #
164             # The erratum only affects Thumb-2 code.
165             'conditions': [
166               [ 'arm_version < 7', {
167                 'ldflags': [
168                   '-Wl,--fix-cortex-a8',
169                 ],
170               }],
171             ],
172           }],
173           [ 'skia_arch_type == "arm" and arm_version >= 7', {
174             'cflags': [
175               '-march=armv7-a',
176             ],
177             'ldflags': [
178               '-march=armv7-a',
179             ],
180             'conditions': [
181               [ 'arm_neon == 1', {
182                 'defines': [
183                   '__ARM_HAVE_NEON',
184                 ],
185                 'cflags': [
186                   '-mfpu=neon',
187                 ],
188               }],
189               [ 'arm_neon_optional == 1', {
190                 'defines': [
191                   '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
192                 ],
193               }],
194               [ 'skia_os != "chromeos"', {
195                 'cflags': [
196                   '-mfloat-abi=softfp',
197                 ],
198               }],
199             ],
200           }],
201         ],
202       },
203     ],
204
205     ['skia_android_framework', {
206       'cflags': [
207         # Skia does not enforce this usage pattern so we disable it here to avoid
208         # unecessary log spew when building
209         '-Wno-unused-parameter',
210
211         # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
212         # Revert to -D_FORTIFY_SOURCE=1
213         '-U_FORTIFY_SOURCE',
214         '-D_FORTIFY_SOURCE=1',
215       ],
216       'defines': [
217         'DCT_IFAST_SUPPORTED',
218         # using freetype's embolden allows us to adjust fake bold settings at
219         # draw-time, at which point we know which SkTypeface is being drawn
220         'SK_USE_FREETYPE_EMBOLDEN',
221         # Android provides at least FreeType 2.4.0 at runtime.
222         'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020400',
223         # Skia should not use dlopen on Android.
224         'SK_CAN_USE_DLOPEN=0',
225       ],
226     }],
227
228     [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
229       {
230         'defines': [
231           'SK_SAMPLES_FOR_X',
232           'SK_BUILD_FOR_UNIX',
233         ],
234         'configurations': {
235           'Coverage': {
236             'cflags': ['--coverage'],
237             'ldflags': ['--coverage'],
238           },
239           'Debug': {
240           },
241           'Release': {
242             'cflags': [
243               '-O<(skia_release_optimization_level)',
244             ],
245             'defines': [ 'NDEBUG' ],
246           },
247         },
248         'conditions' : [
249           [ 'skia_shared_lib', {
250             'cflags': [
251               '-fPIC',
252             ],
253             'defines': [
254               'SKIA_DLL',
255               'SKIA_IMPLEMENTATION=1',
256             ],
257           }],
258           [ 'skia_os == "nacl"', {
259             'defines': [
260               'SK_BUILD_FOR_NACL',
261             ],
262             'link_settings': {
263               'libraries': [
264                 '-lppapi',
265                 '-lppapi_cpp',
266                 '-lnosys',
267                 '-pthread',
268               ],
269             },
270           }, { # skia_os != "nacl"
271             'link_settings': {
272               'ldflags': [
273                 '-lstdc++',
274                 '-lm',
275               ],
276             },
277           }],
278           [ 'skia_os != "chromeos"', {
279             'conditions': [
280               [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
281                 'cflags': [
282                   '-m64',
283                 ],
284                 'ldflags': [
285                   '-m64',
286                 ],
287               }],
288               [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
289                 'cflags': [
290                   '-m32',
291                 ],
292                 'ldflags': [
293                   '-m32',
294                 ],
295               }],
296             ],
297           }],
298           # Enable asan, tsan, etc.
299           [ 'skia_sanitizer', {
300             'cflags': [
301               '-fsanitize=<(skia_sanitizer)',
302             ],
303             'ldflags': [
304               '-fsanitize=<(skia_sanitizer)',
305             ],
306             'conditions' : [
307               [ 'skia_sanitizer == "thread"', {
308                 'defines': [ 'DYNAMIC_ANNOTATIONS_ENABLED=1' ],
309                 'cflags': [ '-fPIC' ],
310                 'target_conditions': [
311                   [ '_type == "executable"', {
312                     'cflags': [ '-fPIE' ],
313                     'ldflags': [ '-pie' ],
314                   }],
315                 ],
316               }],
317             ],
318           }],
319           [ 'skia_clang_build', {
320             'cflags': [
321               # Extra warnings we like but that only Clang knows about.
322               '-Wstring-conversion',
323             ],
324           }],
325           [ 'skia_keep_frame_pointer', {
326             'cflags': [ '-fno-omit-frame-pointer' ],
327           }],
328         ],
329       },
330     ],
331
332     [ 'skia_os == "mac"',
333       {
334         'defines': [
335           'SK_BUILD_FOR_MAC',
336         ],
337         'conditions' : [
338           [ 'skia_arch_width == 64', {
339             'xcode_settings': {
340               'ARCHS': ['x86_64'],
341             },
342           }],
343           [ 'skia_arch_width == 32', {
344             'xcode_settings': {
345               'ARCHS': ['i386'],
346             },
347           }],
348           [ 'skia_warnings_as_errors', {
349             'xcode_settings': {
350               'OTHER_CPLUSPLUSFLAGS': [
351                 '-Werror',
352                 '-Wall',
353                 '-Wextra',
354                 '-Wno-unused-parameter',
355                 '-Wno-uninitialized',  # Disabled because we think GCC 4.2 is bad at this.
356               ],
357             },
358           }],
359         ],
360         'configurations': {
361           'Coverage': {
362             'xcode_settings': {
363                'GCC_OPTIMIZATION_LEVEL': '0',
364                'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
365                'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
366             },
367           },
368           'Debug': {
369             'xcode_settings': {
370               'GCC_OPTIMIZATION_LEVEL': '0',
371             },
372           },
373           'Release': {
374             'xcode_settings': {
375               'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
376             },
377             'defines': [ 'NDEBUG' ],
378           },
379         },
380         'xcode_settings': {
381           'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
382           'conditions': [
383             [ 'skia_osx_deployment_target==""', {
384               'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in environment to ld.
385             }, {
386               'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
387             }],
388           ],
389 # trying to get this to work, but it needs clang I think...
390 #          'WARNING_CFLAGS': '-Wexit-time-destructors',
391           'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
392           'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
393           'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'YES',
394           'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'YES',
395           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
396           'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
397           'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
398           'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
399           'GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL': 'YES',
400           'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
401           'GCC_WARN_MISSING_PARENTHESES': 'YES',
402           'GCC_WARN_PROTOTYPE_CONVERSION': 'YES',
403           'GCC_WARN_SIGN_COMPARE': 'YES',
404           'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
405           'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
406           'GCC_WARN_UNUSED_FUNCTION': 'YES',
407           'GCC_WARN_UNUSED_LABEL': 'YES',
408           'GCC_WARN_UNUSED_VALUE': 'YES',
409           'GCC_WARN_UNUSED_VARIABLE': 'YES',
410           'OTHER_CPLUSPLUSFLAGS': [
411             '-mssse3',
412             '-fvisibility=hidden',
413             '-fvisibility-inlines-hidden',
414           ],
415         },
416       },
417     ],
418
419     [ 'skia_os == "ios"',
420       {
421         'defines': [
422           'SK_BUILD_FOR_IOS',
423         ],
424         'conditions' : [
425           [ 'skia_warnings_as_errors', {
426             'xcode_settings': {
427               'OTHER_CPLUSPLUSFLAGS': [
428                 '-Werror',
429               ],
430             },
431           }],
432         ],
433         'configurations': {
434           'Debug': {
435             'xcode_settings': {
436               'GCC_OPTIMIZATION_LEVEL': '0',
437             },
438           },
439           'Release': {
440             'xcode_settings': {
441               'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
442             },
443             'defines': [ 'NDEBUG' ],
444           },
445         },
446         'xcode_settings': {
447           'ARCHS': ['armv6', 'armv7'],
448           'CODE_SIGNING_REQUIRED': 'NO',
449           'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
450           'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
451           'SDKROOT': 'iphoneos',
452           'TARGETED_DEVICE_FAMILY': '1,2',
453           'OTHER_CPLUSPLUSFLAGS': [
454             '-fvisibility=hidden',
455             '-fvisibility-inlines-hidden',
456           ],
457           'GCC_THUMB_SUPPORT': 'NO',
458         },
459       },
460     ],
461
462     [ 'skia_os == "android"',
463       {
464         'defines': [
465           'SK_BUILD_FOR_ANDROID',
466           'SK_FONTHOST_DOES_NOT_USE_FONTMGR',
467         ],
468         'configurations': {
469           'Debug': {
470             'cflags': ['-g']
471           },
472           'Release': {
473             'cflags': ['-O2'],
474             'defines': [ 'NDEBUG' ],
475           },
476         },
477         'libraries': [
478           '-lstdc++',
479           '-lm',
480           '-llog',
481         ],
482         'cflags': [
483           '-fuse-ld=gold',
484         ],
485         'conditions': [
486           [ 'skia_android_framework', {
487             'libraries!': [
488               '-lstdc++',
489               '-lm',
490             ],
491           }],
492           [ 'skia_shared_lib', {
493             'cflags': [
494               '-fPIC',
495             ],
496             'defines': [
497               'SKIA_DLL',
498               'SKIA_IMPLEMENTATION=1',
499             ],
500           }],
501           [ 'skia_profile_enabled == 1', {
502             'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
503           }],
504         ],
505       },
506     ],
507
508     # We can POD-style initialization of static mutexes to avoid generating
509     # static initializers if we're using a pthread-compatible thread interface.
510     [ 'skia_os != "win"', {
511       'defines': [
512         'SK_USE_POSIX_THREADS',
513       ],
514     }],
515   ], # end 'conditions'
516   # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
517   'xcode_settings': {
518     'SYMROOT': '<(DEPTH)/xcodebuild',
519   },
520 }