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