Home | History | Annotate | Download | only in gyp
      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_DISTANCEFIELD_FONTS=<(skia_distancefield_fonts)',
      9   ],
     10   'conditions' : [
     11     [ 'skia_os == "win"',
     12       {
     13         'defines': [
     14           'SK_BUILD_FOR_WIN32',
     15           '_CRT_SECURE_NO_WARNINGS',
     16           'GR_GL_FUNCTION_TYPE=__stdcall',
     17         ],
     18         'msvs_cygwin_shell': 0,
     19         'msvs_settings': {
     20           'VCCLCompilerTool': {
     21             'WarningLevel': '3',
     22             'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
     23             'DebugInformationFormat': '3',
     24             'ExceptionHandling': '0',
     25             'AdditionalOptions': [ '/MP', ],
     26           },
     27           'VCLinkerTool': {
     28             'AdditionalDependencies': [
     29               'OpenGL32.lib',
     30               'usp10.lib',
     31 
     32               # Prior to gyp r1584, the following were included automatically.
     33               'kernel32.lib',
     34               'gdi32.lib',
     35               'winspool.lib',
     36               'comdlg32.lib',
     37               'advapi32.lib',
     38               'shell32.lib',
     39               'ole32.lib',
     40               'oleaut32.lib',
     41               'user32.lib',
     42               'uuid.lib',
     43               'odbc32.lib',
     44               'odbccp32.lib',
     45               'DelayImp.lib',
     46             ],
     47           },
     48         },
     49         'configurations': {
     50           'Debug': {
     51             'msvs_settings': {
     52               'VCCLCompilerTool': {
     53                 'DebugInformationFormat': '4', # editAndContiue (/ZI)
     54                 'Optimization': '0',           # optimizeDisabled (/Od)
     55                 'PreprocessorDefinitions': ['_DEBUG'],
     56                 'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
     57                 'RuntimeTypeInfo': 'false',      # /GR-
     58               },
     59               'VCLinkerTool': {
     60                 'GenerateDebugInformation': 'true', # /DEBUG
     61                 'LinkIncremental': '2',             # /INCREMENTAL
     62               },
     63             },
     64           },
     65           'Release': {
     66             'msvs_settings': {
     67               'VCCLCompilerTool': {
     68                 'DebugInformationFormat': '3',      # programDatabase (/Zi)
     69                 'Optimization': '<(skia_release_optimization_level)',
     70                 'WholeProgramOptimization': 'true', #/GL
     71                # Changing the floating point model requires rebaseling gm images
     72                #'FloatingPointModel': '2',          # fast (/fp:fast)
     73                 'FavorSizeOrSpeed': '1',            # speed (/Ot)
     74                 'PreprocessorDefinitions': ['NDEBUG'],
     75                 'RuntimeLibrary': '2',              # rtMultiThreadedDLL (/MD)
     76                 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
     77                 'RuntimeTypeInfo': 'false',         # /GR-
     78               },
     79               'VCLinkerTool': {
     80                 'GenerateDebugInformation': 'true', # /DEBUG
     81                 'LinkTimeCodeGeneration': '1',      # useLinkTimeCodeGeneration /LTCG
     82               },
     83               'VCLibrarianTool': {
     84                 'LinkTimeCodeGeneration': 'true',   # useLinkTimeCodeGeneration /LTCG
     85               },
     86             },
     87           },
     88         },
     89         'conditions' : [
     90           [ 'skia_arch_width == 64', {
     91             'msvs_configuration_platform': 'x64',
     92           }],
     93           [ 'skia_arch_width == 32', {
     94             'msvs_configuration_platform': 'Win32',
     95           }],
     96           [ 'skia_warnings_as_errors', {
     97             'msvs_settings': {
     98               'VCCLCompilerTool': {
     99                 'WarnAsError': 'true',
    100                 'AdditionalOptions': [
    101                   '/we4189', # initialized but unused var warning
    102                 ],
    103               },
    104             },
    105           }],
    106           [ 'skia_win_exceptions', {
    107             'msvs_settings': {
    108               'VCCLCompilerTool': {
    109                 'AdditionalOptions': [
    110                   '/EHsc',
    111                 ],
    112               },
    113             },
    114           }],
    115         ],
    116       },
    117     ],
    118 
    119     # The following section is common to linux + derivatives and android
    120     [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos", "android"]',
    121       {
    122         'cflags': [
    123           '-g',
    124           '-fno-exceptions',
    125           '-fstrict-aliasing',
    126 
    127           '-Wall',
    128           '-Wextra',
    129           '-Winit-self',
    130           '-Wpointer-arith',
    131 
    132           '-Wno-unused-parameter',
    133           '-Wno-c++11-extensions',
    134         ],
    135         'cflags_cc': [
    136           '-fno-rtti',
    137           '-Wnon-virtual-dtor',
    138         ],
    139         'conditions': [
    140           [ 'skia_warnings_as_errors', {
    141             'cflags': [
    142               '-Werror',
    143             ],
    144           }],
    145           [ 'skia_arch_type == "arm" and arm_thumb == 1', {
    146             'cflags': [
    147               '-mthumb',
    148             ],
    149             # The --fix-cortex-a8 switch enables a link-time workaround for
    150             # an erratum in certain Cortex-A8 processors.  The workaround is
    151             # enabled by default if you target the ARM v7-A arch profile.
    152             # It can be enabled otherwise by specifying --fix-cortex-a8, or
    153             # disabled unconditionally by specifying --no-fix-cortex-a8.
    154             #
    155             # The erratum only affects Thumb-2 code.
    156             'conditions': [
    157               [ 'arm_version < 7', {
    158                 'ldflags': [
    159                   '-Wl,--fix-cortex-a8',
    160                 ],
    161               }],
    162             ],
    163           }],
    164           [ 'skia_arch_type == "arm" and arm_version >= 7', {
    165             'cflags': [
    166               '-march=armv7-a',
    167             ],
    168             'ldflags': [
    169               '-march=armv7-a',
    170             ],
    171             'conditions': [
    172               [ 'arm_neon == 1', {
    173                 'defines': [
    174                   '__ARM_HAVE_NEON',
    175                 ],
    176                 'cflags': [
    177                   '-mfpu=neon',
    178                 ],
    179               }],
    180               [ 'arm_neon_optional == 1', {
    181                 'defines': [
    182                   '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
    183                 ],
    184               }],
    185               [ 'skia_os != "chromeos"', {
    186                 'cflags': [
    187                   '-mfloat-abi=softfp',
    188                 ],
    189               }],
    190             ],
    191           }],
    192         ],
    193       },
    194     ],
    195 
    196 
    197     [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl", "chromeos"]',
    198       {
    199         'defines': [
    200           'SK_SAMPLES_FOR_X',
    201           'SK_BUILD_FOR_UNIX',
    202         ],
    203         'configurations': {
    204           'Coverage': {
    205             'cflags': ['--coverage'],
    206             'ldflags': ['--coverage'],
    207           },
    208           'Debug': {
    209           },
    210           'Release': {
    211             'cflags': [
    212               '-O<(skia_release_optimization_level)',
    213             ],
    214             'defines': [ 'NDEBUG' ],
    215           },
    216         },
    217         'conditions' : [
    218           [ 'skia_shared_lib', {
    219             'cflags': [
    220               '-fPIC',
    221             ],
    222             'defines': [
    223               'SKIA_DLL',
    224               'SKIA_IMPLEMENTATION=1',
    225             ],
    226           }],
    227           [ 'skia_os == "nacl"', {
    228             'defines': [
    229               'SK_BUILD_FOR_NACL',
    230             ],
    231             'link_settings': {
    232               'libraries': [
    233                 '-lppapi',
    234                 '-lppapi_cpp',
    235                 '-lnosys',
    236                 '-pthread',
    237               ],
    238             },
    239           }, { # skia_os != "nacl"
    240             'link_settings': {
    241               'ldflags': [
    242                 '-lstdc++',
    243                 '-lm',
    244               ],
    245             },
    246           }],
    247           [ 'skia_os != "chromeos"', {
    248             'conditions': [
    249               [ 'skia_arch_width == 64 and skia_arch_type == "x86"', {
    250                 'cflags': [
    251                   '-m64',
    252                 ],
    253                 'ldflags': [
    254                   '-m64',
    255                 ],
    256               }],
    257               [ 'skia_arch_width == 32 and skia_arch_type == "x86"', {
    258                 'cflags': [
    259                   '-m32',
    260                 ],
    261                 'ldflags': [
    262                   '-m32',
    263                 ],
    264               }],
    265             ],
    266           }],
    267           # Enable asan, tsan, etc.
    268           [ 'skia_sanitizer', {
    269             'cflags': [
    270               '-fsanitize=<(skia_sanitizer)',
    271             ],
    272             'ldflags': [
    273               '-fsanitize=<(skia_sanitizer)',
    274             ],
    275             'conditions' : [
    276               [ 'skia_sanitizer == "thread"', {
    277                 'defines': [ 'DYNAMIC_ANNOTATIONS_ENABLED=1' ],
    278                 'cflags': [ '-fPIC' ],
    279                 'target_conditions': [
    280                   [ '_type == "executable"', {
    281                     'cflags': [ '-fPIE' ],
    282                     'ldflags': [ '-pie' ],
    283                   }],
    284                 ],
    285               }],
    286             ],
    287           }],
    288           [ 'skia_clang_build', {
    289             'cflags': [
    290               # Extra warnings we like but that only Clang knows about.
    291               '-Wstring-conversion',
    292             ],
    293           }],
    294           [ 'skia_keep_frame_pointer', {
    295             'cflags': [ '-fno-omit-frame-pointer' ],
    296           }],
    297         ],
    298       },
    299     ],
    300 
    301     [ 'skia_os == "mac"',
    302       {
    303         'variables': {
    304           'mac_sdk%': '<!(python <(DEPTH)/tools/find_mac_sdk.py 10.6)',
    305         },
    306         'defines': [
    307           'SK_BUILD_FOR_MAC',
    308         ],
    309         'conditions' : [
    310           [ 'skia_arch_width == 64', {
    311             'xcode_settings': {
    312               'ARCHS': ['x86_64'],
    313             },
    314           }],
    315           [ 'skia_arch_width == 32', {
    316             'xcode_settings': {
    317               'ARCHS': ['i386'],
    318             },
    319           }],
    320           [ 'skia_warnings_as_errors', {
    321             'xcode_settings': {
    322               'OTHER_CPLUSPLUSFLAGS': [
    323                 '-Werror',
    324                 '-Wall',
    325                 '-Wextra',
    326                 '-Wno-unused-parameter',
    327               ],
    328             },
    329           }],
    330 # This old compiler is really bad at figuring out when things are uninitialized, so ignore it.
    331           [ '<(mac_sdk)==10.6', {
    332             'xcode_settings': {
    333               'OTHER_CPLUSPLUSFLAGS': [
    334                 '-Wno-uninitialized',
    335               ],
    336             },
    337           }],
    338         ],
    339         'configurations': {
    340           'Coverage': {
    341             'xcode_settings': {
    342                'GCC_OPTIMIZATION_LEVEL': '0',
    343                'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',
    344                'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS' : 'YES',
    345             },
    346           },
    347           'Debug': {
    348             'xcode_settings': {
    349               'GCC_OPTIMIZATION_LEVEL': '0',
    350             },
    351           },
    352           'Release': {
    353             'xcode_settings': {
    354               'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
    355             },
    356             'defines': [ 'NDEBUG' ],
    357           },
    358         },
    359         'xcode_settings': {
    360           'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
    361           'conditions': [
    362             [ 'skia_osx_sdkroot==""', {
    363               'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
    364             }, {
    365               'SDKROOT': '<(skia_osx_sdkroot)',  # -isysroot
    366             }],
    367            ],
    368 # trying to get this to work, but it needs clang I think...
    369 #          'WARNING_CFLAGS': '-Wexit-time-destructors',
    370           'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
    371           'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
    372           'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'YES',
    373           'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'YES',
    374           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
    375           'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
    376           'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
    377           'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
    378           'GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL': 'YES',
    379           'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
    380           'GCC_WARN_MISSING_PARENTHESES': 'YES',
    381           'GCC_WARN_PROTOTYPE_CONVERSION': 'YES',
    382           'GCC_WARN_SIGN_COMPARE': 'YES',
    383           'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
    384           'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
    385           'GCC_WARN_UNUSED_FUNCTION': 'YES',
    386           'GCC_WARN_UNUSED_LABEL': 'YES',
    387           'GCC_WARN_UNUSED_VALUE': 'YES',
    388           'GCC_WARN_UNUSED_VARIABLE': 'YES',
    389           'OTHER_CPLUSPLUSFLAGS': [
    390             '-mssse3',
    391             '-fvisibility=hidden',
    392             '-fvisibility-inlines-hidden',
    393           ],
    394         },
    395       },
    396     ],
    397 
    398     [ 'skia_os == "ios"',
    399       {
    400         'defines': [
    401           'SK_BUILD_FOR_IOS',
    402         ],
    403         'conditions' : [
    404           [ 'skia_warnings_as_errors', {
    405             'xcode_settings': {
    406               'OTHER_CPLUSPLUSFLAGS': [
    407                 '-Werror',
    408               ],
    409             },
    410           }],
    411         ],
    412         'configurations': {
    413           'Debug': {
    414             'xcode_settings': {
    415               'GCC_OPTIMIZATION_LEVEL': '0',
    416             },
    417           },
    418           'Release': {
    419             'xcode_settings': {
    420               'GCC_OPTIMIZATION_LEVEL': '<(skia_release_optimization_level)',
    421             },
    422             'defines': [ 'NDEBUG' ],
    423           },
    424         },
    425         'xcode_settings': {
    426           'ARCHS': ['armv6', 'armv7'],
    427           'CODE_SIGNING_REQUIRED': 'NO',
    428           'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
    429           'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
    430           'SDKROOT': 'iphoneos',
    431           'TARGETED_DEVICE_FAMILY': '1,2',
    432           'OTHER_CPLUSPLUSFLAGS': [
    433             '-fvisibility=hidden',
    434             '-fvisibility-inlines-hidden',
    435           ],
    436           'GCC_THUMB_SUPPORT': 'NO',
    437         },
    438       },
    439     ],
    440 
    441     [ 'skia_os == "android"',
    442       {
    443         'defines': [
    444           'SK_BUILD_FOR_ANDROID',
    445           'SK_FONTHOST_DOES_NOT_USE_FONTMGR',
    446         ],
    447         'configurations': {
    448           'Debug': {
    449             'cflags': ['-g']
    450           },
    451           'Release': {
    452             'cflags': ['-O2'],
    453             'defines': [ 'NDEBUG' ],
    454           },
    455         },
    456         'libraries': [
    457           '-lstdc++',
    458           '-lm',
    459           '-llog',
    460         ],
    461         'cflags': [
    462           '-fuse-ld=gold',
    463         ],
    464         'conditions': [
    465           [ 'skia_shared_lib', {
    466             'cflags': [
    467               '-fPIC',
    468             ],
    469             'defines': [
    470               'SKIA_DLL',
    471               'SKIA_IMPLEMENTATION=1',
    472             ],
    473           }],
    474           [ 'skia_profile_enabled == 1', {
    475             'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
    476           }],
    477         ],
    478       },
    479     ],
    480 
    481     # We can POD-style initialization of static mutexes to avoid generating
    482     # static initializers if we're using a pthread-compatible thread interface.
    483     [ 'skia_os != "win"', {
    484       'defines': [
    485         'SK_USE_POSIX_THREADS',
    486       ],
    487     }],
    488   ], # end 'conditions'
    489   # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
    490   'xcode_settings': {
    491     'SYMROOT': '<(DEPTH)/xcodebuild',
    492   },
    493 }
    494