Upstream version 7.36.149.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_FORCE_DISTANCEFIELD_FONTS=<(skia_force_distancefield_fonts)',
9   ],
10   'conditions' : [
11     [ 'skia_arch_type == "arm64"', {
12       'cflags': [
13         '-ffp-contract=off',
14       ],
15     }],
16
17     [ 'skia_os == "win"',
18       {
19         'defines': [
20           'SK_BUILD_FOR_WIN32',
21           '_CRT_SECURE_NO_WARNINGS',
22           'GR_GL_FUNCTION_TYPE=__stdcall',
23         ],
24         'msvs_cygwin_shell': 0,
25         'msvs_settings': {
26           'VCCLCompilerTool': {
27             'WarningLevel': '3',
28             'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
29             'DebugInformationFormat': '3',
30             'ExceptionHandling': '0',
31             'AdditionalOptions': [ '/MP', ],
32           },
33           'VCLinkerTool': {
34             'LargeAddressAware': 2,  # 2 means "Yes, please let me use more RAM on 32-bit builds."
35             'AdditionalDependencies': [
36               'OpenGL32.lib',
37               'usp10.lib',
38
39               # Prior to gyp r1584, the following were included automatically.
40               'kernel32.lib',
41               'gdi32.lib',
42               'winspool.lib',
43               'comdlg32.lib',
44               'advapi32.lib',
45               'shell32.lib',
46               'ole32.lib',
47               'oleaut32.lib',
48               'user32.lib',
49               'uuid.lib',
50               'odbc32.lib',
51               'odbccp32.lib',
52               'DelayImp.lib',
53             ],
54           },
55         },
56         'configurations': {
57           'Debug': {
58             'msvs_settings': {
59               'VCCLCompilerTool': {
60                 'DebugInformationFormat': '4', # editAndContiue (/ZI)
61                 'Optimization': '0',           # optimizeDisabled (/Od)
62                 'PreprocessorDefinitions': ['_DEBUG'],
63                 'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
64                 'RuntimeTypeInfo': 'false',      # /GR-
65               },
66               'VCLinkerTool': {
67                 'GenerateDebugInformation': 'true', # /DEBUG
68                 'LinkIncremental': '2',             # /INCREMENTAL
69               },
70             },
71           },
72           'Release': {
73             'msvs_settings': {
74               'VCCLCompilerTool': {
75                 'DebugInformationFormat': '3',      # programDatabase (/Zi)
76                 'Optimization': '<(skia_release_optimization_level)',
77                 'WholeProgramOptimization': 'true', #/GL
78                # Changing the floating point model requires rebaseling gm images
79                #'FloatingPointModel': '2',          # fast (/fp:fast)
80                 'FavorSizeOrSpeed': '1',            # speed (/Ot)
81                 'PreprocessorDefinitions': ['NDEBUG'],
82                 'RuntimeLibrary': '2',              # rtMultiThreadedDLL (/MD)
83                 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
84                 'RuntimeTypeInfo': 'false',         # /GR-
85               },
86               'VCLinkerTool': {
87                 'GenerateDebugInformation': 'true', # /DEBUG
88                 'LinkTimeCodeGeneration': '1',      # useLinkTimeCodeGeneration /LTCG
89               },
90               'VCLibrarianTool': {
91                 'LinkTimeCodeGeneration': 'true',   # useLinkTimeCodeGeneration /LTCG
92               },
93             },
94           },
95         },
96         'conditions' : [
97           # Gyp's ninja generator depends on these specially named
98           # configurations to build 64-bit on Windows.
99           # See http://skbug.com/2348
100           #
101           # We handle the 64- vs 32-bit variations elsewhere, so I think it's
102           # OK for us to just make these inherit non-archwidth-specific
103           # configurations without modification.
104           #
105           # See http://skbug.com/2442 : These targets cause problems in the
106           # MSVS build, so only include them if gyp is generating a ninja build.
107           [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
108             'configurations': {
109               'Debug_x64': {
110                 'inherit_from': ['Debug'],
111               },
112               'Release_x64': {
113                 'inherit_from': ['Release'],
114               },
115               'Release_Developer_x64': {
116                 'inherit_from': ['Release_Developer'],
117               },
118             },
119           }],
120           [ 'skia_arch_width == 64', {
121             'msvs_configuration_platform': 'x64',
122           }],
123           [ 'skia_arch_width == 32', {
124             'msvs_configuration_platform': 'Win32',
125           }],
126           [ 'skia_warnings_as_errors', {
127             'msvs_settings': {
128               'VCCLCompilerTool': {
129                 'WarnAsError': 'true',
130                 'AdditionalOptions': [
131                   '/we4189', # initialized but unused var warning
132                 ],
133               },
134             },
135           }],
136           [ 'skia_win_exceptions', {
137             'msvs_settings': {
138               'VCCLCompilerTool': {
139                 'AdditionalOptions': [
140                   '/EHsc',
141                 ],
142               },
143             },
144           }],
145         ],
146       },
147     ],
148
149     # The following section is common to linux + derivatives and android
150     [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
151       {
152         'cflags': [
153           '-g',
154           '-fno-exceptions',
155           '-fstrict-aliasing',
156
157           '-Wall',
158           '-Wextra',
159           '-Winit-self',
160           '-Wpointer-arith',
161
162           '-Wno-unused-parameter',
163         ],
164         'cflags_cc': [
165           '-fno-rtti',
166           '-Wnon-virtual-dtor',
167         ],
168         'conditions': [
169           [ 'skia_android_framework==0', {
170             'cflags': [
171               # This flag is not supported by Android build system.
172               '-Wno-c++11-extensions',
173             ],
174           }],
175           [ 'skia_warnings_as_errors', {
176             'cflags': [
177               '-Werror',
178             ],
179           }],
180           # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
181           [ 'skia_disable_inlining', {
182             'cflags': [
183               '-fno-inline',
184               '-fno-default-inline',
185               '-finline-limit=0',
186               '-fno-omit-frame-pointer',
187             ],
188           }],
189           [ 'skia_arch_type == "arm" and arm_thumb == 1', {
190             'cflags': [
191               '-mthumb',
192             ],
193             # The --fix-cortex-a8 switch enables a link-time workaround for
194             # an erratum in certain Cortex-A8 processors.  The workaround is
195             # enabled by default if you target the ARM v7-A arch profile.
196             # It can be enabled otherwise by specifying --fix-cortex-a8, or
197             # disabled unconditionally by specifying --no-fix-cortex-a8.
198             #
199             # The erratum only affects Thumb-2 code.
200             'conditions': [
201               [ 'arm_version < 7', {
202                 'ldflags': [
203                   '-Wl,--fix-cortex-a8',
204                 ],
205               }],
206             ],
207           }],
208           [ 'skia_arch_type == "arm" and arm_version >= 7', {
209             'cflags': [
210               '-march=armv7-a',
211             ],
212             'ldflags': [
213               '-march=armv7-a',
214             ],
215             'conditions': [
216               [ 'arm_neon == 1', {
217                 'defines': [
218                   '__ARM_HAVE_NEON',
219                 ],
220                 'cflags': [
221                   '-mfpu=neon',
222                 ],
223               }],
224               [ 'arm_neon_optional == 1', {
225                 'defines': [
226                   '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
227                 ],
228               }],
229               [ 'skia_os != "chromeos"', {
230                 'cflags': [
231                   '-mfloat-abi=softfp',
232                 ],
233               }],
234             ],
235           }],
236         ],
237       },
238     ],
239
240     ['skia_android_framework', {
241       'cflags': [
242         # Skia does not enforce this usage pattern so we disable it here to avoid
243         # unecessary log spew when building
244         '-Wno-unused-parameter',
245
246         # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
247         # Revert to -D_FORTIFY_SOURCE=1
248         '-U_FORTIFY_SOURCE',
249         '-D_FORTIFY_SOURCE=1',
250       ],
251       # Remove flags which are either unnecessary or problematic for the
252       # Android framework build. Many of these flags are removed simply because
253       # they were not previously in the Android framework makefile, and we did
254       # did not intend to add them when generating the makefile.
255       # TODO (scroggo): Investigate whether any of these flags are actually
256       # needed/would be beneficial.
257       'cflags!': [
258         # Android has one makefile, used for both debugging (after manual
259         # modification) and release. Turn off debug info by default.
260         '-g',
261         '-march=armv7-a',
262         '-mthumb',
263         '-mfpu=neon',
264         '-mfloat-abi=softfp',
265         # This flag is not supported by Android build system.
266         '-Wno-c++11-extensions',
267         '-fno-exceptions',
268         '-fstrict-aliasing',
269         # Remove flags to turn on warnings, since most people building Android
270         # are not focused on Skia and do not need the extra warning info.
271         '-Wall',
272         '-Wextra',
273         '-Winit-self',
274         '-Wpointer-arith',
275       ],
276       'cflags_cc!': [
277         '-fno-rtti',
278         '-Wnon-virtual-dtor',
279       ],
280       'defines': [
281         'DCT_IFAST_SUPPORTED',
282         # using freetype's embolden allows us to adjust fake bold settings at
283         # draw-time, at which point we know which SkTypeface is being drawn
284         'SK_USE_FREETYPE_EMBOLDEN',
285         'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
286         # When built as part of the system image we can enable certian non-NDK
287         # compliant optimizations.
288         'SK_BUILD_FOR_ANDROID_FRAMEWORK',
289         # Optimizations for chromium (m30)
290         'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
291         'IGNORE_ROT_AA_RECT_OPT',
292         # Disable this check because it is too strict for some chromium-specific
293         # subclasses of SkPixelRef. See bug: crbug.com/171776.
294         'SK_DISABLE_PIXELREF_LOCKCOUNT_BALANCE_CHECK',
295         'SkLONGLONG int64_t',
296         'SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)',
297         'SK_ATOMICS_PLATFORM_H "../../src/ports/SkAtomics_android.h"',
298         'SK_MUTEX_PLATFORM_H "../../src/ports/SkMutex_pthread.h"',
299         # FIXME: b/13729784: Need to rework LayerRasterizer.cpp
300         'SK_SUPPORT_LEGACY_LAYERRASTERIZER_API',
301         # Temporary until https:#googleplex-android-review.git.corp.google.com/#/c/442220/
302         # lands.
303         'SK_SUPPORT_LEGACY_GETTOTALCLIP',
304         # Still need to switch Android to the new name for N32.
305         'kNative_8888_SkColorType kN32_SkColorType',
306         'SK_SUPPORT_LEGACY_PICTURE_CAN_RECORD',
307         'SK_SUPPORT_DEPRECATED_RECORD_FLAGS',
308         'SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES',
309         'SK_SUPPORT_LEGACY_PICTURE_HEADERS',
310         'SK_SUPPORT_LEGACY_BLURDRAWLOOPERCONSTRUCTORS',
311         'SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE',
312         # Needed until we fix skbug.com/2440.
313         'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
314         # Transitional, for deprecated SkCanvas::SaveFlags methods.
315         'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
316       ],
317     }],
318
319     [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
320       {
321         'defines': [
322           'SK_SAMPLES_FOR_X',
323           'SK_BUILD_FOR_UNIX',
324         ],
325         'configurations': {
326           'Coverage': {
327             'cflags': ['--coverage'],
328             'ldflags': ['--coverage'],
329           },
330           'Debug': {
331           },
332           'Release': {
333             'cflags': [
334               '-O<(skia_release_optimization_level)',
335             ],
336             'defines': [ 'NDEBUG' ],
337           },
338         },
339         'conditions' : [
340           [ 'skia_shared_lib', {
341             'cflags': [
342               '-fPIC',
343             ],
344             'defines': [
345               'SKIA_DLL',
346               'SKIA_IMPLEMENTATION=1',
347             ],
348           }],
349           [ 'skia_os == "nacl"', {
350             'defines': [
351               'SK_BUILD_FOR_NACL',
352             ],
353             'variables': {
354               'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
355             },
356             'link_settings': {
357               'libraries': [
358                 '-lppapi',
359                 '-lppapi_cpp',
360                 '-lnosys',
361                 '-pthread',
362               ],
363               '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               ],
367             },
368           }, { # skia_os != "nacl"
369             'link_settings': {
370               'ldflags': [
371                 '-lstdc++',
372                 '-lm',
373               ],
374             },
375           }],
376           [ 'skia_os != "chromeos"', {
377             'conditions': [
378               [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
379                 'cflags': [
380                   '-m64',
381                 ],
382                 'ldflags': [
383                   '-m64',
384                 ],
385               }],
386               [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
387                 'cflags': [
388                   '-m32',
389                 ],
390                 'ldflags': [
391                   '-m32',
392                 ],
393               }],
394             ],
395           }],
396           # Enable asan, tsan, etc.
397           [ 'skia_sanitizer', {
398             'cflags': [
399               '-fsanitize=<(skia_sanitizer)',
400             ],
401             'ldflags': [
402               '-fsanitize=<(skia_sanitizer)',
403             ],
404             'conditions' : [
405               [ 'skia_sanitizer == "thread"', {
406                 'defines': [ 'DYNAMIC_ANNOTATIONS_ENABLED=1' ],
407                 'cflags': [ '-fPIC' ],
408                 'target_conditions': [
409                   [ '_type == "executable"', {
410                     'cflags': [ '-fPIE' ],
411                     'ldflags': [ '-pie' ],
412                   }],
413                 ],
414               }],
415               [ '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               }],
425             ],
426           }],
427           [ 'skia_clang_build', {
428             'cflags': [
429               # Extra warnings we like but that only Clang knows about.
430               '-Wstring-conversion',
431             ],
432           }],
433           [ 'skia_keep_frame_pointer', {
434             'cflags': [ '-fno-omit-frame-pointer' ],
435           }],
436         ],
437       },
438     ],
439
440     [ 'skia_os == "mac"',
441       {
442         'defines': [
443           'SK_BUILD_FOR_MAC',
444         ],
445         'conditions' : [
446           [ 'skia_arch_width == 64', {
447             'xcode_settings': {
448               'ARCHS': ['x86_64'],
449             },
450           }],
451           [ 'skia_arch_width == 32', {
452             'xcode_settings': {
453               'ARCHS': ['i386'],
454             },
455           }],
456           [ 'skia_warnings_as_errors', {
457             'xcode_settings': {
458               'OTHER_CPLUSPLUSFLAGS': [
459                 '-Werror',
460                 '-Wall',
461                 '-Wextra',
462                 '-Wno-unused-parameter',
463                 '-Wno-uninitialized',  # Disabled because we think GCC 4.2 is bad at this.
464               ],
465             },
466           }],
467         ],
468         'configurations': {
469           '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           },
476           'Debug': {
477             'xcode_settings': {
478               'GCC_OPTIMIZATION_LEVEL': '0',
479             },
480           },
481           'Release': {
482             'xcode_settings': {
483               'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
484             },
485             'defines': [ 'NDEBUG' ],
486           },
487         },
488         'xcode_settings': {
489           'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
490           '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           ],
497 # trying to get this to work, but it needs clang I think...
498 #          'WARNING_CFLAGS': '-Wexit-time-destructors',
499           'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
500           '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',
518           'OTHER_CPLUSPLUSFLAGS': [
519             '-mssse3',
520             '-fvisibility=hidden',
521             '-fvisibility-inlines-hidden',
522           ],
523         },
524       },
525     ],
526
527     [ 'skia_os == "ios"',
528       {
529         'defines': [
530           'SK_BUILD_FOR_IOS',
531         ],
532         'conditions' : [
533           [ 'skia_warnings_as_errors', {
534             'xcode_settings': {
535               'OTHER_CPLUSPLUSFLAGS': [
536                 '-Werror',
537               ],
538             },
539           }],
540         ],
541         'configurations': {
542           'Debug': {
543             'xcode_settings': {
544               'GCC_OPTIMIZATION_LEVEL': '0',
545             },
546           },
547           'Release': {
548             'xcode_settings': {
549               'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
550             },
551             'defines': [ 'NDEBUG' ],
552           },
553         },
554         'xcode_settings': {
555           'ARCHS': ['armv7'],
556           'CODE_SIGNING_REQUIRED': 'NO',
557           'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
558           'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
559           'SDKROOT': 'iphoneos',
560           'TARGETED_DEVICE_FAMILY': '1,2',
561           'OTHER_CPLUSPLUSFLAGS': [
562             '-fvisibility=hidden',
563             '-fvisibility-inlines-hidden',
564           ],
565           'GCC_THUMB_SUPPORT': 'NO',
566         },
567       },
568     ],
569
570     [ 'skia_os == "android"',
571       {
572         'defines': [
573           'SK_BUILD_FOR_ANDROID',
574           'SK_FONTHOST_DOES_NOT_USE_FONTMGR',
575
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',
583         ],
584         'configurations': {
585           'Debug': {
586             'cflags': ['-g']
587           },
588           'Release': {
589             'cflags': ['-O2'],
590             'defines': [ 'NDEBUG' ],
591           },
592         },
593         'libraries': [
594           '-lstdc++',
595           '-lm',
596           '-llog',
597         ],
598         'cflags': [
599           '-fuse-ld=gold',
600         ],
601         'conditions': [
602           [ 'skia_android_framework', {
603             'libraries!': [
604               '-lstdc++',
605               '-lm',
606             ],
607             'cflags!': [
608               '-fuse-ld=gold',
609             ],
610           }],
611           [ 'skia_shared_lib', {
612             'cflags': [
613               '-fPIC',
614             ],
615             'defines': [
616               'SKIA_DLL',
617               'SKIA_IMPLEMENTATION=1',
618             ],
619           }],
620           [ 'skia_profile_enabled == 1', {
621             'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
622           }],
623         ],
624       },
625     ],
626
627     # 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': [
631         'SK_USE_POSIX_THREADS',
632       ],
633     }],
634   ], # end 'conditions'
635   # 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   },
639 }