Refactor skia_warnings_as_errors

Review URL: https://codereview.chromium.org/12963002

git-svn-id: http://skia.googlecode.com/svn/trunk@8330 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
borenet@google.com 2013-03-22 13:16:06 +00:00
parent a3a09ab1d5
commit a72aef8a21
7 changed files with 91 additions and 132 deletions

View File

@ -10,7 +10,7 @@
},
'variables': {
'component': 'static_library',
'skia_building_angle': 1, # See comment in common_conditions.gypi.
'skia_warnings_as_errors': 0,
},
'includes': [
'../third_party/externals/angle/src/build_angle.gypi',

33
gyp/cityhash.gyp Normal file
View File

@ -0,0 +1,33 @@
{
'variables': {
'skia_warnings_as_errors': 0,
},
'targets': [
{
'target_name': 'cityhash',
'type': 'static_library',
'standalone_static_library': 1,
'include_dirs': [
'../include/config',
'../include/core',
'../src/utils/cityhash',
'../third_party/externals/cityhash/src',
],
'sources': [
'../third_party/externals/cityhash/src/city.cc',
],
'direct_dependent_settings': {
'include_dirs': [
'../third_party/externals/cityhash/src',
],
},
'conditions': [
[ 'skia_os == "android"', {
'cflags!': [
'-Wall',
],
}],
],
},
],
}

View File

@ -6,7 +6,7 @@
# 'SK_SUPPORT_HINTING_SCALE_FACTOR',
],
'conditions' : [
['skia_gpu == 1',
[ 'skia_gpu == 1',
{
'defines': [
'SK_SUPPORT_GPU=1',
@ -17,7 +17,7 @@
],
},
],
['skia_os == "win"',
[ 'skia_os == "win"',
{
'defines': [
'SK_BUILD_FOR_WIN32',
@ -82,48 +82,27 @@
},
},
'conditions' : [
['skia_arch_width == 64', {
[ 'skia_arch_width == 64', {
'msvs_configuration_platform': 'x64',
}],
[ 'skia_arch_width == 32', {
'msvs_configuration_platform': 'Win32',
}],
[ 'skia_warnings_as_errors', {
'msvs_settings': {
'VCCLCompilerTool': {
'WarnAsError': 'false',
'WarnAsError': 'true',
'AdditionalOptions': [
'/we4189', # initialized but unused var warning
],
},
},
}],
['skia_arch_width == 32', {
# This gypi file will be included directly into the gyp(i) files in the angle repo by
# our gyp_skia script. We don't want force WarnAsError on angle. So angle.gyp defines
# skia_building_angle=1 and here we select whether to enable WarnAsError based on that
# var's value. Here it defaults to 0.
'variables' : {
'skia_building_angle%': 0,
},
'conditions' : [
['skia_building_angle', {
'msvs_configuration_platform': 'Win32',
'msvs_settings': {
'VCCLCompilerTool': {
'WarnAsError': 'false',
},
},
},{ # not angle
'msvs_configuration_platform': 'Win32',
'msvs_settings': {
'VCCLCompilerTool': {
'WarnAsError': 'true',
'AdditionalOptions': [
'/we4189', # initialized but unused var warning
],
},
},
}],
],
}],
],
},
],
['skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]',
[ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]',
{
'defines': [
'SK_SAMPLES_FOR_X',
@ -139,7 +118,6 @@
},
},
'cflags': [
'-Werror',
'-Wall',
'-Wextra',
# suppressions below here were added for clang
@ -147,12 +125,12 @@
'-Wno-c++11-extensions'
],
'conditions' : [
['skia_warnings_as_errors == 1', {
[ 'skia_warnings_as_errors', {
'cflags': [
'-Werror',
],
}],
['skia_arch_width == 64', {
[ 'skia_arch_width == 64', {
'cflags': [
'-m64',
],
@ -160,7 +138,7 @@
'-m64',
],
}],
['skia_arch_width == 32', {
[ 'skia_arch_width == 32', {
'cflags': [
'-m32',
],
@ -189,7 +167,7 @@
},
],
['skia_os == "mac"',
[ 'skia_os == "mac"',
{
'variables': {
'mac_sdk%': '<!(python <(DEPTH)/tools/find_mac_sdk.py 10.6)',
@ -198,14 +176,18 @@
'SK_BUILD_FOR_MAC',
],
'conditions' : [
['skia_arch_width == 64', {
[ 'skia_arch_width == 64', {
'xcode_settings': {
'ARCHS': 'x86_64',
},
}],
['skia_arch_width == 32', {
[ 'skia_arch_width == 32', {
'xcode_settings': {
'ARCHS': 'i386',
},
}],
[ 'skia_warnings_as_errors', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [
'-Werror',
],
@ -228,7 +210,7 @@
'xcode_settings': {
'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO',
'conditions': [
['skia_osx_sdkroot==""', {
[ 'skia_osx_sdkroot==""', {
'SDKROOT': 'macosx<(mac_sdk)', # -isysroot
}, {
'SDKROOT': '<(skia_osx_sdkroot)', # -isysroot
@ -264,11 +246,20 @@
},
],
['skia_os == "ios"',
[ 'skia_os == "ios"',
{
'defines': [
'SK_BUILD_FOR_IOS',
],
'conditions' : [
[ 'skia_warnings_as_errors', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [
'-Werror',
],
},
}],
],
'configurations': {
'Debug': {
'xcode_settings': {
@ -289,13 +280,16 @@
'IPHONEOS_DEPLOYMENT_TARGET': '<(ios_sdk_version)',
'SDKROOT': 'iphoneos',
'TARGETED_DEVICE_FAMILY': '1,2',
'OTHER_CPLUSPLUSFLAGS': '-fvisibility=hidden -fvisibility-inlines-hidden',
'OTHER_CPLUSPLUSFLAGS': [
'-fvisibility=hidden',
'-fvisibility-inlines-hidden',
],
'GCC_THUMB_SUPPORT': 'NO',
},
},
],
['skia_os == "android"',
[ 'skia_os == "android"',
{
'defines': [
'SK_BUILD_FOR_ANDROID',
@ -322,7 +316,7 @@
'-fuse-ld=gold',
],
'conditions': [
[ 'skia_warnings_as_errors == 1', {
[ 'skia_warnings_as_errors', {
'cflags': [
'-Werror',
],

View File

@ -89,12 +89,19 @@
'skia_gpu%': 1,
'skia_osx_sdkroot%': '',
'skia_profile_enabled%': 0,
# Note: This is currently only turned on for linux and android.
# TODO: Turn on for Win and Mac as well.
'skia_warnings_as_errors%': 0,
'skia_win_debuggers_path%': '',
},
'conditions': [
[ 'skia_os == "win" and skia_arch_width == 32 or '
'skia_os in ["linux", "freebsd", "openbsd", "solaris", "android"] or '
'skia_os == "mac" and skia_arch_width == 32', {
'skia_warnings_as_errors%': 1,
}, {
'skia_warnings_as_errors%': 0,
}],
],
# Re-define all variables defined within the level-2 'variables' dict,
# so that siblings of the level-1 'variables' dict can see them.
'armv7%': '<(armv7)',
@ -114,7 +121,6 @@
'skia_gpu%': '<(skia_gpu)',
'skia_osx_sdkroot%': '<(skia_osx_sdkroot)',
'skia_profile_enabled%': '<(skia_profile_enabled)',
'skia_warnings_as_errors%': '<(skia_warnings_as_errors)',
'skia_static_initializers%': '<(skia_static_initializers)',
'ios_sdk_version%': '6.0',
'skia_win_debuggers_path%': '<(skia_win_debuggers_path)',

View File

@ -12,6 +12,9 @@
# and https://code.google.com/p/skia/source/detail?r=7115
{
'variables': {
'skia_warnings_as_errors': 0,
},
'targets': [
{
'target_name': 'jsoncpp',
@ -47,29 +50,9 @@
],
},
'conditions': [
[ 'skia_os == "mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS!': [
'-Werror',
]
},
}],
[ 'skia_os == "win"', {
'msvs_settings': {
'VCCLCompilerTool': {
'WarnAsError': 'false',
},
},
}],
[ 'skia_os == "android"', {
'cflags!': [
'-Wall',
'-Werror',
],
}],
['skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', {
'cflags!': [
'-Werror',
],
}],
],

View File

@ -11,6 +11,7 @@
{
'variables': {
'use_system_libjpeg%': 0,
'skia_warnings_as_errors': 0,
},
'conditions': [
['skia_os == "android"', {
@ -95,24 +96,12 @@
],
},
'conditions': [
['OS!="win"', {
[ 'skia_os != "win"', {
'product_name': 'jpeg',
'cflags': [
'-Wno-main', # supresses warnings about naming things "main"
],
}],
['OS=="android"', {
'cflags!': [
'-fno-rtti', # supresses warnings about invalid option of non-C++ code
'-Wall',
'-Werror',
],
}],
['OS in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', {
'cflags!': [
'-Werror',
],
}],
],
},
],

View File

@ -6,7 +6,7 @@
'type': 'static_library',
'standalone_static_library': 1,
'dependencies': [
'cityhash',
'cityhash.gyp:cityhash',
],
'include_dirs': [
'../include/config',
@ -204,7 +204,7 @@
# missing byteswap.h which is needed by CityHash.
# TODO(borenet): Find a way to either provide this dependency or
# replace it.
'cityhash',
'cityhash.gyp:cityhash',
],
}],
[ 'skia_os == "android"', {
@ -219,52 +219,6 @@
],
},
},
{
'target_name': 'cityhash',
'type': 'static_library',
'standalone_static_library': 1,
'include_dirs': [
'../include/config',
'../include/core',
'../src/utils/cityhash',
'../third_party/externals/cityhash/src',
],
'sources': [
'../third_party/externals/cityhash/src/city.cc',
],
'direct_dependent_settings': {
'include_dirs': [
'../third_party/externals/cityhash/src',
],
},
'conditions': [
[ 'skia_os == "mac"', {
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS!': [
'-Werror',
]
},
}],
[ 'skia_os == "win"', {
'msvs_settings': {
'VCCLCompilerTool': {
'WarnAsError': 'false',
},
},
}],
[ 'skia_os == "android"', {
'cflags!': [
'-Wall',
'-Werror',
],
}],
['skia_os in ["linux", "freebsd", "openbsd", "solaris", "nacl"]', {
'cflags!': [
'-Werror',
],
}],
],
},
],
}