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