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