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)',
16 # FIXME: The reason we don't do this on Android is due to the way
17 # we build the executables/skia_launcher on Android. See
18 # https://codereview.chromium.org/406613003/diff/1/gyp/common_conditions.gypi#newcode455
19 ['skia_os != "android"', {
20 'target_conditions': [
21 [ '_type == "executable"', {
22 'cflags': [ '-fPIE' ],
23 'ldflags': [ '-pie' ],
29 [ 'skia_arch_type == "arm64"', {
35 # As of M35, Chrome requires SSE2 on x86 (and SSSE3 on Mac).
36 [ 'skia_arch_type == "x86"', {
47 '_CRT_SECURE_NO_WARNINGS',
48 'GR_GL_FUNCTION_TYPE=__stdcall',
50 'msvs_disabled_warnings': [
51 4345, # This is an FYI about a behavior change from long ago. Chrome stifles it too.
53 'msvs_cygwin_shell': 0,
54 'msvs_disabled_warnings': [4275],
58 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
59 'DebugInformationFormat': '3',
60 'ExceptionHandling': '0',
61 'AdditionalOptions': [ '/MP', ],
64 'LargeAddressAware': 2, # 2 means "Yes, please let me use more RAM on 32-bit builds."
65 'AdditionalDependencies': [
69 # Prior to gyp r1584, the following were included automatically.
90 'DebugInformationFormat': '4', # editAndContiue (/ZI)
91 'Optimization': '0', # optimizeDisabled (/Od)
92 'PreprocessorDefinitions': ['_DEBUG'],
93 'RuntimeLibrary': '3', # rtMultiThreadedDebugDLL (/MDd)
94 'RuntimeTypeInfo': 'false', # /GR-
97 'GenerateDebugInformation': 'true', # /DEBUG
98 'LinkIncremental': '2', # /INCREMENTAL
104 'VCCLCompilerTool': {
105 'DebugInformationFormat': '3', # programDatabase (/Zi)
106 'Optimization': '<(skia_release_optimization_level)',
107 # Changing the floating point model requires rebaseling gm images
108 #'FloatingPointModel': '2', # fast (/fp:fast)
109 'FavorSizeOrSpeed': '1', # speed (/Ot)
110 'PreprocessorDefinitions': ['NDEBUG'],
111 'RuntimeLibrary': '2', # rtMultiThreadedDLL (/MD)
112 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
113 'RuntimeTypeInfo': 'false', # /GR-
116 'GenerateDebugInformation': 'true', # /DEBUG
122 # Gyp's ninja generator depends on these specially named
123 # configurations to build 64-bit on Windows.
124 # See http://skbug.com/2348
126 # We handle the 64- vs 32-bit variations elsewhere, so I think it's
127 # OK for us to just make these inherit non-archwidth-specific
128 # configurations without modification.
130 # See http://skbug.com/2442 : These targets cause problems in the
131 # MSVS build, so only include them if gyp is generating a ninja build.
132 [ '"ninja" in "<!(echo %GYP_GENERATORS%)"', {
135 'inherit_from': ['Debug'],
138 'inherit_from': ['Release'],
140 'Release_Developer_x64': {
141 'inherit_from': ['Release_Developer'],
145 [ 'skia_arch_width == 64', {
146 'msvs_configuration_platform': 'x64',
148 [ 'skia_arch_width == 32', {
149 'msvs_configuration_platform': 'Win32',
151 [ 'skia_warnings_as_errors', {
153 'VCCLCompilerTool': {
154 'WarnAsError': 'true',
155 'AdditionalOptions': [
156 '/we4189', # initialized but unused var warning
161 [ 'skia_win_exceptions', {
163 'VCCLCompilerTool': {
164 'AdditionalOptions': [
174 'VCCLCompilerTool': {
175 'WholeProgramOptimization': 'true', #/GL
178 'LinkTimeCodeGeneration': '1', # useLinkTimeCodeGeneration /LTCG
181 'LinkTimeCodeGeneration': 'true', # useLinkTimeCodeGeneration /LTCG
191 # The following section is common to linux + derivatives and android
192 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
204 '-Wno-c++11-extensions',
205 '-Wno-unused-parameter',
209 '-Wnon-virtual-dtor',
210 '-Wno-invalid-offsetof', # GCC <4.6 is old-school strict about what is POD.
213 [ 'skia_os != "chromeos"', {
215 [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
223 [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
233 [ 'skia_warnings_as_errors', {
238 # For profiling; reveals some costs, exaggerates others (e.g. trivial setters & getters).
239 [ 'skia_disable_inlining', {
242 '-fno-default-inline',
244 '-fno-omit-frame-pointer',
247 [ 'skia_arch_type == "arm" and arm_thumb == 1', {
251 # The --fix-cortex-a8 switch enables a link-time workaround for
252 # an erratum in certain Cortex-A8 processors. The workaround is
253 # enabled by default if you target the ARM v7-A arch profile.
254 # It can be enabled otherwise by specifying --fix-cortex-a8, or
255 # disabled unconditionally by specifying --no-fix-cortex-a8.
257 # The erratum only affects Thumb-2 code.
259 [ 'arm_version < 7', {
261 '-Wl,--fix-cortex-a8',
266 [ 'skia_arch_type == "arm" and arm_version >= 7', {
282 [ 'arm_neon_optional == 1', {
284 'SK_ARM_HAS_OPTIONAL_NEON',
287 [ 'skia_os != "chromeos"', {
289 '-mfloat-abi=softfp',
294 [ 'skia_arch_type == "mips"', {
299 [ 'mips_arch_variant == "mips32r2"', {
329 ['skia_android_framework', {
331 'skia_for_android_framework_defines.gypi',
334 # Skia does not enforce this usage pattern so we disable it here to avoid
335 # unecessary log spew when building
336 '-Wno-unused-parameter',
338 # Android's -D_FORTIFY_SOURCE=2 extensions are incompatibile with SkString.
339 # Revert to -D_FORTIFY_SOURCE=1
341 '-D_FORTIFY_SOURCE=1',
343 # Remove flags which are either unnecessary or problematic for the
344 # Android framework build. Many of these flags are removed simply because
345 # they were not previously in the Android framework makefile, and we did
346 # did not intend to add them when generating the makefile.
347 # TODO (scroggo): Investigate whether any of these flags are actually
348 # needed/would be beneficial.
350 # Android has one makefile, used for both debugging (after manual
351 # modification) and release. Turn off debug info by default.
356 '-mfloat-abi=softfp',
359 # Remove flags to turn on warnings, since most people building Android
360 # are not focused on Skia and do not need the extra warning info.
368 '-Wnon-virtual-dtor',
371 'DCT_IFAST_SUPPORTED',
372 # using freetype's embolden allows us to adjust fake bold settings at
373 # draw-time, at which point we know which SkTypeface is being drawn
374 'SK_USE_FREETYPE_EMBOLDEN',
375 'SK_SFNTLY_SUBSETTER "sample/chromium/font_subsetter.h"',
376 # When built as part of the system image we can enable certian non-NDK
377 # compliant optimizations.
378 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
379 # Optimizations for chromium (m30)
380 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
381 'IGNORE_ROT_AA_RECT_OPT',
382 'SkLONGLONG int64_t',
383 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
384 # Transitional, for deprecated SkCanvas::SaveFlags methods.
385 'SK_ATTR_DEPRECATED=SK_NOTHING_ARG1',
386 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
387 'SK_IGNORE_ETC1_SUPPORT',
388 # Defines from skia_for_android_framework_defines.gypi
389 '<@(skia_for_android_framework_defines)',
393 [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
401 'cflags': ['--coverage'],
402 'ldflags': ['--coverage'],
408 '-O<(skia_release_optimization_level)',
410 'defines': [ 'NDEBUG' ],
414 [ 'skia_shared_lib', {
417 'SKIA_IMPLEMENTATION=1',
420 [ 'skia_os == "nacl"', {
425 'nacl_sdk_root': '<!(echo ${NACL_SDK_ROOT})',
435 '-L<(nacl_sdk_root)/lib/newlib_x86_<(skia_arch_width)/Release',
436 '-L<(nacl_sdk_root)/ports/lib/newlib_x86_<(skia_arch_width)/Release',
440 # Enable asan, tsan, etc.
441 [ 'skia_sanitizer', {
443 '-fsanitize=<(skia_sanitizer)',
446 '-fsanitize=<(skia_sanitizer)',
449 [ 'skia_sanitizer == "thread"', {
450 'defines': [ 'SK_DYNAMIC_ANNOTATIONS_ENABLED=1' ],
452 [ 'skia_sanitizer == "undefined"', {
453 'cflags_cc!': ['-fno-rtti'],
457 [ 'skia_clang_build', {
459 # Build in C++11 mode to make sure we'll have an easy time switching.
461 '-Wno-unknown-warning-option', # Allows unknown warnings.
462 '-Wno-deprecated', # From Qt, via debugger (older Clang).
463 '-Wno-deprecated-register', # From Qt, via debugger (newer Clang).
466 # Extra warnings we like but that only Clang knows about.
467 '-Wstring-conversion',
470 '-mfpmath=sse', # Clang doesn't need to be told this, and sometimes gets confused.
473 [ 'skia_keep_frame_pointer', {
474 'cflags': [ '-fno-omit-frame-pointer' ],
480 [ 'skia_os == "mac"',
486 [ 'skia_arch_width == 64', {
491 [ 'skia_arch_width == 32', {
496 [ 'skia_warnings_as_errors', {
498 'OTHER_CPLUSPLUSFLAGS': [
502 '-Wno-unused-parameter',
503 '-Wno-uninitialized', # Disabled because we think GCC 4.2 is bad at this.
511 'GCC_OPTIMIZATION_LEVEL': '0',
512 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
513 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
518 'GCC_OPTIMIZATION_LEVEL': '0',
523 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
525 'defines': [ 'NDEBUG' ],
529 'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
531 [ 'skia_osx_deployment_target==""', {
532 'MACOSX_DEPLOYMENT_TARGET': '10.6', # -mmacos-version-min, passed in environment to ld.
534 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
537 # trying to get this to work, but it needs clang I think...
538 # 'WARNING_CFLAGS': '-Wexit-time-destructors',
539 'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
540 'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
541 'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'YES',
542 'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'YES',
543 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
544 'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
545 'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
546 'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
547 'GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL': 'YES',
548 'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
549 'GCC_WARN_MISSING_PARENTHESES': 'YES',
550 'GCC_WARN_PROTOTYPE_CONVERSION': 'YES',
551 'GCC_WARN_SIGN_COMPARE': 'YES',
552 'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
553 'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
554 'GCC_WARN_UNUSED_FUNCTION': 'YES',
555 'GCC_WARN_UNUSED_LABEL': 'YES',
556 'GCC_WARN_UNUSED_VALUE': 'YES',
557 'GCC_WARN_UNUSED_VARIABLE': 'YES',
558 'OTHER_CPLUSPLUSFLAGS': [
560 '-fvisibility=hidden',
561 '-fvisibility-inlines-hidden',
567 [ 'skia_os == "ios"',
573 [ 'skia_warnings_as_errors', {
575 'OTHER_CPLUSPLUSFLAGS': [
584 'GCC_OPTIMIZATION_LEVEL': '0',
589 'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
591 'defines': [ 'NDEBUG' ],
596 'CODE_SIGNING_REQUIRED': 'NO',
597 'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
598 'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
599 'SDKROOT': 'iphoneos',
600 'TARGETED_DEVICE_FAMILY': '1,2',
601 'OTHER_CPLUSPLUSFLAGS': [
602 '-fvisibility=hidden',
603 '-fvisibility-inlines-hidden',
605 'GCC_THUMB_SUPPORT': 'NO',
610 [ 'skia_os == "android"',
613 'SK_BUILD_FOR_ANDROID',
615 # Android Text Tuning
616 'SK_GAMMA_EXPONENT=1.4',
617 'SK_GAMMA_CONTRAST=0.0',
619 # Android defines a fixed gamma exponent instead of using SRGB
629 'defines': [ 'NDEBUG' ],
639 [ 'skia_arch_type == "x86"', {
644 [ 'skia_android_framework', {
649 [ 'skia_shared_lib', {
652 'SKIA_IMPLEMENTATION=1',
653 # Needed until we fix skbug.com/2440.
654 'SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG',
657 [ 'skia_profile_enabled == 1', {
658 'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
664 # We can POD-style initialization of static mutexes to avoid generating
665 # static initializers if we're using a pthread-compatible thread interface.
666 [ 'skia_os != "win"', {
668 'SK_USE_POSIX_THREADS',
674 # add flags here (e.g. SK_SUPPORT_LEGACY_...) needed by moz2d
679 'defines': [ 'SK_CRASH_HANDLER' ],
682 ], # end 'conditions'
683 # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
685 'SYMROOT': '<(DEPTH)/xcodebuild',