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_HINTING_SCALE_FACTOR',
      7   ],
      8   'conditions' : [
      9     ['skia_gpu == 1',
     10       {
     11         'defines': [
     12           'SK_SUPPORT_GPU=1',
     13         ],
     14       }, {
     15         'defines': [
     16           'SK_SUPPORT_GPU=0',
     17         ],
     18       },
     19     ],
     20     ['skia_os == "win"',
     21       {
     22         'defines': [
     23           'SK_BUILD_FOR_WIN32',
     24           'SK_IGNORE_STDINT_DOT_H',
     25           '_CRT_SECURE_NO_WARNINGS',
     26           'GR_GL_FUNCTION_TYPE=__stdcall',
     27         ],
     28         'msvs_cygwin_shell': 0,
     29         'msvs_settings': {
     30           'VCCLCompilerTool': {
     31             'WarningLevel': '1',
     32             'DebugInformationFormat': '3',
     33             'AdditionalOptions': [ '/MP' ],
     34           },
     35           'VCLinkerTool': {
     36             'AdditionalDependencies': [
     37               'OpenGL32.lib',
     38               'usp10.lib',
     39             ],
     40           },
     41         },
     42         'configurations': {
     43           'Debug': {
     44             'msvs_settings': {
     45               'VCCLCompilerTool': {
     46                 'DebugInformationFormat': '4', # editAndContiue (/ZI)
     47                 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
     48                 'Optimization': '0',           # optimizeDisabled (/Od)
     49                 'PreprocessorDefinitions': ['_DEBUG'],
     50                 'RuntimeLibrary': '3',         # rtMultiThreadedDebugDLL (/MDd)
     51                 'ExceptionHandling': '0',
     52                 'RuntimeTypeInfo': 'false',      # /GR-
     53                 'WarningLevel': '3',             # level3 (/W3)
     54               },
     55               'VCLinkerTool': {
     56                 'GenerateDebugInformation': 'true', # /DEBUG
     57                 'LinkIncremental': '2',             # /INCREMENTAL
     58               },
     59             },
     60           },
     61           'Release': {
     62             'msvs_settings': {
     63               'VCCLCompilerTool': {
     64                 'DebugInformationFormat': '3',      # programDatabase (/Zi)
     65                 'ProgramDataBaseFileName': '$(OutDir)\\$(ProjectName).pdb',
     66                 'Optimization': '3',                # full (/Ox)
     67                 'WholeProgramOptimization': 'true', #/GL
     68                # Changing the floating point model requires rebaseling gm images
     69                #'FloatingPointModel': '2',          # fast (/fp:fast)
     70                 'FavorSizeOrSpeed': '1',            # speed (/Ot)
     71                 'PreprocessorDefinitions': ['NDEBUG'],
     72                 'RuntimeLibrary': '2',              # rtMultiThreadedDLL (/MD)
     73                 'ExceptionHandling': '0',
     74                 'EnableEnhancedInstructionSet': '2',# /arch:SSE2
     75                 'RuntimeTypeInfo': 'false',         # /GR-
     76                 'WarningLevel': '3',                # level3 (/W3)
     77               },
     78               'VCLinkerTool': {
     79                 'GenerateDebugInformation': 'true', # /DEBUG
     80                 'LinkTimeCodeGeneration': '1',      # useLinkTimeCodeGeneration /LTCG
     81               },
     82               'VCLibrarianTool': {
     83                 'LinkTimeCodeGeneration': 'true',   # useLinkTimeCodeGeneration /LTCG
     84               },
     85             },
     86           },
     87         },
     88         'conditions' : [
     89           ['skia_arch_width == 64', {
     90             'msvs_configuration_platform': 'x64',
     91             'msvs_settings': {
     92               'VCCLCompilerTool': {
     93                 'WarnAsError': 'false',
     94               },
     95             },
     96           }],
     97           ['skia_arch_width == 32', {
     98             # This gypi file will be included directly into the gyp(i) files in the angle repo by
     99             # our gyp_skia script. We don't want force WarnAsError on angle. So angle.gyp defines
    100             # skia_building_angle=1 and here we select whether to enable WarnAsError based on that
    101             # var's value. Here it defaults to 0.
    102             'variables' : {
    103               'skia_building_angle%': 0,
    104             },
    105             'conditions' : [
    106               ['skia_building_angle', {
    107                 'msvs_configuration_platform': 'Win32',
    108                 'msvs_settings': {
    109                   'VCCLCompilerTool': {
    110                     'WarnAsError': 'false',
    111                   },
    112                 },
    113               },{ # not angle
    114                 'msvs_configuration_platform': 'Win32',
    115                 'msvs_settings': {
    116                   'VCCLCompilerTool': {
    117                     'WarnAsError': 'true',
    118                   },
    119                 },
    120               }],
    121             ],
    122           }],
    123         ],
    124       },
    125     ],
    126 
    127     ['skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]',
    128       {
    129         'defines': [
    130           'SK_SAMPLES_FOR_X',
    131           'SK_BUILD_FOR_UNIX',
    132         ],
    133         'configurations': {
    134           'Debug': {
    135             'cflags': ['-g']
    136           },
    137           'Release': {
    138             'cflags': ['-O3 -g'],
    139             'defines': [ 'NDEBUG' ],
    140           },
    141         },
    142         'cflags': [
    143           # TODO(tony): Enable -Werror once all the strict-aliasing problems
    144           # are fixed.
    145           #'-Werror',
    146           '-Wall',
    147           '-Wextra',
    148           '-Wno-unused',
    149           # suppressions below here were added for clang
    150           '-Wno-unused-parameter',
    151           '-Wno-c++11-extensions'
    152         ],
    153         'conditions' : [
    154           ['skia_warnings_as_errors == 1', {
    155             'cflags': [
    156               '-Werror',
    157             ],
    158           }],
    159           ['skia_arch_width == 64', {
    160             'cflags': [
    161               '-m64',
    162             ],
    163             'ldflags': [
    164               '-m64',
    165             ],
    166           }],
    167           ['skia_arch_width == 32', {
    168             'cflags': [
    169               '-m32',
    170             ],
    171             'ldflags': [
    172               '-m32',
    173             ],
    174           }],
    175           [ 'skia_os == "nacl"', {
    176             'defines': [
    177               'SK_BUILD_FOR_NACL',
    178             ],
    179             'link_settings': {
    180               'libraries': [
    181                 '-lppapi',
    182                 '-lppapi_cpp',
    183                 '-lnosys',
    184                 '-pthread',
    185               ],
    186             },
    187           }, { # skia_os != "nacl"
    188             'include_dirs' : [
    189               '/usr/include/freetype2',
    190             ],
    191           }],
    192         ],
    193       },
    194     ],
    195 
    196     ['skia_os == "mac"',
    197       {
    198         'defines': [
    199           'SK_BUILD_FOR_MAC',
    200         ],
    201         'conditions' : [
    202           ['skia_arch_width == 64', {
    203             'xcode_settings': {
    204               'ARCHS': 'x86_64',
    205             },
    206           }],
    207           ['skia_arch_width == 32', {
    208             'xcode_settings': {
    209               'ARCHS': 'i386',
    210               'OTHER_CPLUSPLUSFLAGS': [
    211                 '-Werror',
    212               ],
    213             },
    214           }],
    215         ],
    216         'configurations': {
    217           'Debug': {
    218             'xcode_settings': {
    219               'GCC_OPTIMIZATION_LEVEL': '0',
    220             },
    221           },
    222           'Release': {
    223             'xcode_settings': {
    224               'GCC_OPTIMIZATION_LEVEL': '3',
    225             },
    226             'defines': [ 'NDEBUG' ],
    227           },
    228         },
    229         'xcode_settings': {
    230           'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
    231           'SDKROOT': '<(skia_osx_sdkroot)',
    232 # trying to get this to work, but it needs clang I think...
    233 #          'WARNING_CFLAGS': '-Wexit-time-destructors',
    234           'CLANG_WARN_CXX0X_EXTENSIONS': 'NO',
    235           'GCC_WARN_64_TO_32_BIT_CONVERSION': 'YES',
    236           'GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS': 'YES',
    237           'GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO': 'YES',
    238           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',
    239           'GCC_WARN_ABOUT_MISSING_PROTOTYPES': 'YES',
    240           'GCC_WARN_ABOUT_POINTER_SIGNEDNESS': 'YES',
    241           'GCC_WARN_ABOUT_RETURN_TYPE': 'YES',
    242           'GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL': 'YES',
    243           'GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED': 'YES',
    244           'GCC_WARN_MISSING_PARENTHESES': 'YES',
    245           'GCC_WARN_PROTOTYPE_CONVERSION': 'YES',
    246           'GCC_WARN_SIGN_COMPARE': 'YES',
    247           'GCC_WARN_TYPECHECK_CALLS_TO_PRINTF': 'YES',
    248           'GCC_WARN_UNKNOWN_PRAGMAS': 'YES',
    249           'GCC_WARN_UNUSED_FUNCTION': 'YES',
    250           'GCC_WARN_UNUSED_LABEL': 'YES',
    251           'GCC_WARN_UNUSED_VALUE': 'YES',
    252           'GCC_WARN_UNUSED_VARIABLE': 'YES',
    253           'OTHER_CPLUSPLUSFLAGS': [
    254             '-mssse3',
    255             '-fvisibility=hidden',
    256             '-fvisibility-inlines-hidden',
    257           ],
    258         },
    259       },
    260     ],
    261 
    262     ['skia_os == "ios"',
    263       {
    264         'defines': [
    265           'SK_BUILD_FOR_IOS',
    266         ],
    267         'configurations': {
    268           'Debug': {
    269             'xcode_settings': {
    270               'GCC_OPTIMIZATION_LEVEL': '0',
    271             },
    272           },
    273           'Release': {
    274             'xcode_settings': {
    275               'GCC_OPTIMIZATION_LEVEL': '3',
    276             },
    277             'defines': [ 'NDEBUG' ],
    278           },
    279         },
    280         'xcode_settings': {
    281           'ARCHS': 'armv6 armv7',
    282           'CODE_SIGNING_REQUIRED': 'NO',
    283           'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
    284           'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
    285           'SDKROOT': 'iphoneos',
    286           'TARGETED_DEVICE_FAMILY': '1,2',
    287           'OTHER_CPLUSPLUSFLAGS': '-fvisibility=hidden -fvisibility-inlines-hidden',
    288           'GCC_THUMB_SUPPORT': 'NO',
    289         },
    290       },
    291     ],
    292 
    293     ['skia_os == "android"',
    294       {
    295         'defines': [
    296           'SK_BUILD_FOR_ANDROID',
    297           'SK_BUILD_FOR_ANDROID_NDK',
    298         ],
    299         'configurations': {
    300           'Debug': {
    301             'cflags': ['-g']
    302           },
    303           'Release': {
    304             'cflags': ['-O2'],
    305             'defines': [ 'NDEBUG' ],
    306           },
    307         },
    308         'libraries': [
    309           '-lstdc++',
    310           '-lm',
    311           '-llog',
    312         ],
    313         'cflags': [
    314           '-fno-exceptions',
    315           '-fno-rtti',
    316           '-fuse-ld=gold',
    317         ],
    318         'conditions': [
    319           [ 'skia_warnings_as_errors == 1', {
    320             'cflags': [
    321               '-Werror',
    322             ],
    323           }],
    324           [ 'skia_profile_enabled == 1', {
    325             'cflags': ['-g', '-fno-omit-frame-pointer', '-marm', '-mapcs'],
    326           }],
    327           [ 'skia_arch_type == "arm" and arm_thumb == 1', {
    328             'cflags': [
    329               '-mthumb',
    330             ],
    331           }],
    332           [ 'skia_arch_type == "arm" and armv7 == 1', {
    333             'variables': {
    334               'arm_neon_optional%': 0,
    335             },
    336             'defines': [
    337               '__ARM_ARCH__=7',
    338             ],
    339             'cflags': [
    340               '-march=armv7-a',
    341               '-mfloat-abi=softfp',
    342             ],
    343             'conditions': [
    344               [ 'arm_neon == 1', {
    345                 'defines': [
    346                   '__ARM_HAVE_NEON',
    347                 ],
    348                 'cflags': [
    349                   '-mfpu=neon',
    350                 ],
    351                 'ldflags': [
    352                   '-march=armv7-a',
    353                   '-Wl,--fix-cortex-a8',
    354                 ],
    355               }],
    356               [ 'arm_neon_optional == 1', {
    357                 'defines': [
    358                   '__ARM_HAVE_OPTIONAL_NEON_SUPPORT',
    359                 ],
    360               }],
    361             ],
    362          }],
    363         ],
    364       },
    365     ],
    366 
    367     # We can POD-style initialization of static mutexes to avoid generating
    368     # static initializers if we're using a pthread-compatible thread interface.
    369     [ 'skia_os != "win"', {
    370       'defines': [
    371         'SK_USE_POSIX_THREADS',
    372       ],
    373     }],
    374   ], # end 'conditions'
    375   # The Xcode SYMROOT must be at the root. See build/common.gypi in chromium for more details
    376   'xcode_settings': {
    377     'SYMROOT': '<(DEPTH)/xcodebuild',
    378   },
    379 }
    380 
    381 # Local Variables:
    382 # tab-width:2
    383 # indent-tabs-mode:nil
    384 # End:
    385 # vim: set expandtab tabstop=2 shiftwidth=2:
    386