1 # conditions used in both common.gypi and skia.gyp in chromium
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)',
11 [ 'skia_arch_type == "arm64"', {
21 '_CRT_SECURE_NO_WARNINGS',
22 'GR_GL_FUNCTION_TYPE=__stdcall',
24 'msvs_cygwin_shell': 0,
28 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
29 'DebugInformationFormat': '3',
30 'ExceptionHandling': '0',
31 'AdditionalOptions': [ '/MP', ],
34 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
35 'AdditionalDependencies': [
39 # Prior to gyp r1584, the following were included automatically.
60 'DebugInformationFormat': '4', # editAndContiue (/ZI)
61 'Optimization': '0', # optimizeDisabled (/Od)
62 'PreprocessorDefinitions': ['_DEBUG'],
63 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
64 'RuntimeTypeInfo': 'false', # /GR-
67 'GenerateDebugInformation': 'true', # /DEBUG
68 'LinkIncremental': '2', # /INCREMENTAL
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-
87 'GenerateDebugInformation': 'true', # /DEBUG
88 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
91 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
97 # Gyp's ninja generator depends on these specially named
98 # configurations to build 64-bit on Windows.
99 # See http://skbug.com/2348
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.
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%)"', {
110 'inherit_from': ['Debug'],
113 'inherit_from': ['Release'],
115 'Release_Developer_x64': {
116 'inherit_from': ['Release_Developer'],
120 [ 'skia_arch_width == 64', {
121 'msvs_configuration_platform': 'x64',
123 [ 'skia_arch_width == 32', {
124 'msvs_configuration_platform': 'Win32',
126 [ 'skia_warnings_as_errors', {
128 'VCCLCompilerTool': {
129 'WarnAsError': 'true',
130 'AdditionalOptions': [
131 '/we4189', # initialized but unused var warning
136 [ 'skia_win_exceptions', {
138 'VCCLCompilerTool': {
139 'AdditionalOptions': [
149 # The following section is common to linux + derivatives and android
150 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
162 '-Wno-unused-parameter',
166 '-Wnon-virtual-dtor',
169 [ 'skia_android_framework==0', {
171 # This flag is not supported by Android build system.
172 '-Wno-c++11-extensions',
175 [ 'skia_warnings_as_errors', {
180 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
181 [ 'skia_disable_inlining', {
184 '-fno-default-inline',
186 '-fno-omit-frame-pointer',
189 [ 'skia_arch_type == "arm" and arm_thumb == 1', {
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.
199 # The erratum only affects Thumb-2 code.
201 [ 'arm_version < 7', {
203 '-Wl,--fix-cortex-a8',
208 [ 'skia_arch_type == "arm" and arm_version >= 7', {
224 [ 'arm_neon_optional == 1', {
226 '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
229 [ 'skia_os != "chromeos"', {
231 '-mfloat-abi=softfp',
240 ['skia_android_framework', {
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',
246 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
247 # Revert to -D_FORTIFY_SOURCE=1
249 '-D_FORTIFY_SOURCE=1',
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.
258 # Android has one makefile, used for both debugging (after manual
259 # modification) and release. Turn off debug info by default.
264 '-mfloat-abi=softfp',
265 # This flag is not supported by Android build system.
266 '-Wno-c++11-extensions',
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.
278 '-Wnon-virtual-dtor',
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/
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',
319 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
327 'cflags': ['--coverage'],
328 'ldflags': ['--coverage'],
334 '-O<(skia_release_optimization_level)',
336 'defines': [ 'NDEBUG' ],
340 [ 'skia_shared_lib', {
346 'SKIA_IMPLEMENTATION=1',
349 [ 'skia_os == "nacl"', {
354 'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
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',
368 }, { # skia_os != "nacl"
376 [ 'skia_os != "chromeos"', {
378 [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
386 [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
396 # Enable asan, tsan, etc.
397 [ 'skia_sanitizer', {
399 '-fsanitize=<(skia_sanitizer)',
402 '-fsanitize=<(skia_sanitizer)',
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' ],
415 [ 'skia_sanitizer == "undefined"', {
416 'cflags': [ '-fPIC' ],
417 'cflags_cc!': ['-fno-rtti'],
418 'target_conditions': [
419 [ '_type == "executable"', {
420 'cflags': [ '-fPIE' ],
421 'ldflags': [ '-pie' ],
427 [ 'skia_clang_build', {
429 # Extra warnings we like but that only Clang knows about.
430 '-Wstring-conversion',
433 [ 'skia_keep_frame_pointer', {
434 'cflags': [ '-fno-omit-frame-pointer' ],
440 [ 'skia_os == "mac"',
446 [ 'skia_arch_width == 64', {
451 [ 'skia_arch_width == 32', {
456 [ 'skia_warnings_as_errors', {
458 'OTHER_CPLUSPLUSFLAGS': [
462 '-Wno-unused-parameter',
463 '-Wno-uninitialized', # Disabled because we think GCC 4.2 is bad at this.
471 'GCC_OPTIMIZATION_LEVEL': '0',
472 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
473 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
478 'GCC_OPTIMIZATION_LEVEL': '0',
483 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
485 'defines': [ 'NDEBUG' ],
489 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
491 [ 'skia_osx_deployment_target==""', {
492 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in environment to ld.
494 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
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': [
520 '-fvisibility=hidden',
521 '-fvisibility-inlines-hidden',
527 [ 'skia_os == "ios"',
533 [ 'skia_warnings_as_errors', {
535 'OTHER_CPLUSPLUSFLAGS': [
544 'GCC_OPTIMIZATION_LEVEL': '0',
549 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
551 'defines': [ 'NDEBUG' ],
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',
565 'GCC_THUMB_SUPPORT': 'NO',
570 [ 'skia_os == "android"',
573 'SK_BUILD_FOR_ANDROID',
574 'SK_FONTHOST_DOES_NOT_USE_FONTMGR',
576 # Android Text Tuning
577 'SK_GAMMA_EXPONENT=1.4',
578 'SK_GAMMA_CONTRAST=0.0',
580 # Android defines a fixed gamma exponent instead of using SRGB
590 'defines': [ 'NDEBUG' ],
602 [ 'skia_android_framework', {
611 [ 'skia_shared_lib', {
617 'SKIA_IMPLEMENTATION=1',
620 [ 'skia_profile_enabled == 1', {
621 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
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"', {
631 'SK_USE_POSIX_THREADS',
634 ], # end 'conditions'
635 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
637 'SYMROOT': '<(DEPTH)/xcodebuild',