Factor out xcode c/cpp settings into variables to apply to cmake builds.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1619243003

Review URL: https://codereview.chromium.org/1619243003
This commit is contained in:
bsalomon 2016-01-22 12:54:57 -08:00 committed by Commit bot
parent 97293c6ce7
commit 32235eac4b
2 changed files with 40 additions and 17 deletions

View File

@ -471,6 +471,28 @@
[ 'skia_os == "mac"', [ 'skia_os == "mac"',
{ {
'variables': {
# Setup some flags that are used below in both the XCode/ninja build as well as the
# cmake build.
'common_c_and_cpp_flags': [
'-mssse3',
'-fvisibility=hidden',
'-fvisibility-inlines-hidden',
'-Wall',
'-Wextra',
'-Winit-self',
'-Wpointer-arith',
'-Wsign-compare',
'-Wno-unused-parameter',
],
'common_cpp_flags': [
'-fno-threadsafe-statics',
'-fno-exceptions',
'-fno-rtti',
'-std=c++11',
'-stdlib=libc++'
],
},
'defines': [ 'SK_BUILD_FOR_MAC' ], 'defines': [ 'SK_BUILD_FOR_MAC' ],
'conditions': [ 'conditions': [
# ANGLE for mac hits -Wunneeded-internal-declaration if this isn't set. # ANGLE for mac hits -Wunneeded-internal-declaration if this isn't set.
@ -504,13 +526,15 @@
'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)', 'MACOSX_DEPLOYMENT_TARGET': '<(skia_osx_deployment_target)',
}], }],
[ 'skia_sanitizer', { [ 'skia_sanitizer', {
'GCC_ENABLE_CPP_RTTI': 'YES', # vptr needs rtti
'OTHER_CFLAGS': [ 'OTHER_CFLAGS': [
'-fsanitize=<(skia_sanitizer)', # Turn on sanitizers. '-fsanitize=<(skia_sanitizer)', # Turn on sanitizers.
'-fno-sanitize-recover=<(skia_sanitizer)', # Make any failure fatal. '-fno-sanitize-recover=<(skia_sanitizer)', # Make any failure fatal.
'-fsanitize-blacklist=<(skia_sanitizer_blacklist)', # Compile in our blacklist. '-fsanitize-blacklist=<(skia_sanitizer_blacklist)', # Compile in our blacklist.
'-include <(skia_sanitizer_blacklist)', # Make every .cpp depend on it. '-include <(skia_sanitizer_blacklist)', # Make every .cpp depend on it.
], ],
'OTHER_CPLUSPLUSFLAGS': [
'-frtti', # vptr needs rtti
],
# We want to pass -fsanitize=... to our final link call, # We want to pass -fsanitize=... to our final link call,
# but not to libtool. OTHER_LDFLAGS is passed to both. # but not to libtool. OTHER_LDFLAGS is passed to both.
# To trick GYP into doing what we want, we'll piggyback on # To trick GYP into doing what we want, we'll piggyback on
@ -520,25 +544,24 @@
}], }],
], ],
'CLANG_CXX_LIBRARY': 'libc++', 'CLANG_CXX_LIBRARY': 'libc++',
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES', # -mssse3
'GCC_SYMBOLS_PRIVATE_EXTERN': 'NO', # -fvisibility=hidden
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO', # -fvisibility-inlines-hidden
'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks 'GCC_CW_ASM_SYNTAX': 'NO', # remove -fasm-blocks
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # remove -mpascal-strings
'WARNING_CFLAGS': [ # Used by XCode and ninja
'-Wall', 'OTHER_CPLUSPLUSFLAGS': [
'-Wextra', '<@(common_cpp_flags)',
'-Winit-self', '<@(common_c_and_cpp_flags)',
'-Wpointer-arith', ],
'-Wsign-compare', 'OTHER_CFLAGS': [
'<@(common_c_and_cpp_flags)',
'-Wno-unused-parameter',
], ],
}, },
# Used by cmake
'cflags': [
'<@(common_c_and_cpp_flags)',
],
'cflags_cc': [
'<@(common_cpp_flags)',
],
}, },
], ],

View File

@ -120,7 +120,7 @@
'skia_os == "mac"', { 'skia_os == "mac"', {
'sources': [ '<(icu_directory)/mac/icudtl_dat.S', ], 'sources': [ '<(icu_directory)/mac/icudtl_dat.S', ],
'xcode_settings': { 'xcode_settings': {
'GCC_ENABLE_CPP_RTTI': 'YES', # -frtti 'OTHER_CPLUSPLUSFLAGS': [ '-frtti' ],
'WARNING_CFLAGS': [ '-w' ], 'WARNING_CFLAGS': [ '-w' ],
}, },
} }