diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-02-21 17:15:31 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-02-21 17:22:26 +0200 |
commit | bfd5ad3220e7abe928daca98605012c1a12ae377 (patch) | |
tree | 1238c17671e7c069c87208b506fa092385fab13b /gyp | |
parent | 8219d72135c007c44b61a781c95c817a8618c478 (diff) | |
download | qtlocation-mapboxgl-bfd5ad3220e7abe928daca98605012c1a12ae377.tar.gz |
[gyp] Coverage only if BUILDTYPE=Debug and ENABLE_COVERAGE=1
Coverage compiler and linker flags are used only when (1) in debug build
and (2) with ENABLE_COVERAGE set to 1. Besides, because OS X's libtool
is unable to understand '--coverage', this linker flag is only used
genrating executable targets. Also, using 'link_settings' to specify
linker options and separate instructions for OSX and Linux.
Diffstat (limited to 'gyp')
-rw-r--r-- | gyp/common.gypi | 75 |
1 files changed, 42 insertions, 33 deletions
diff --git a/gyp/common.gypi b/gyp/common.gypi index 13565b04e6..118c75000e 100644 --- a/gyp/common.gypi +++ b/gyp/common.gypi @@ -88,47 +88,56 @@ ], 'configurations': { 'Debug': { - 'cflags_cc': [ - '-g', - '-O0', - '-fno-omit-frame-pointer', - '-fwrapv', - '-fstack-protector-all', - '-fno-common', - '--coverage', - ], 'conditions': [ - ['enable_coverage=="1"', { - 'cflags_cc': [ '<@(cflags_cc)', '--coverage' ], + ['OS=="mac"', { + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': '0', + 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', + 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', + 'DEAD_CODE_STRIPPING': 'NO', + 'OTHER_CPLUSPLUSFLAGS': [ '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ], + 'conditions': [ + ['coverage', { + 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES', + 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES', + 'OTHER_CPLUSPLUSFLAGS': [ '--coverage' ], + }], + ], + }, }, { - 'ldflags': [ '--coverage' ], + 'cflags_cc': [ '-g', '-O0', '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ], + 'conditions': [ + ['coverage', { 'cflags_cc': [ '--coverage' ] }], + ], }], ], 'defines': [ 'DEBUG' ], - 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': '0', - 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', - 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', - 'DEAD_CODE_STRIPPING': 'NO', - 'OTHER_CPLUSPLUSFLAGS': [ '-fno-omit-frame-pointer','-fwrapv', '-fstack-protector-all', '-fno-common' ], - 'conditions': [ - ['enable_coverage=="1"', { - 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES', - 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES', - 'OTHER_CPLUSPLUSFLAGS': [ '<@(OTHER_CPLUSPLUSFLAGS)', '-fprofile-arcs', '-ftest-coverage' ], - }], - ], - }, + 'target_conditions': [ + ['_type == "executable"', { + 'conditions': [ + ['OS=="mac" and coverage', { + 'xcode_settings': { 'OTHER_LDFLAGS': [ '--coverage' ] }, + }, { + 'ldflags': [ '--coverage' ], + }], + ], + }], + ], }, 'Release': { - 'cflags_cc': [ '-g', '-O3' ], 'defines': [ 'NDEBUG' ], - 'xcode_settings': { - 'GCC_OPTIMIZATION_LEVEL': '3', - 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', - 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', - 'DEAD_CODE_STRIPPING': 'NO', - } + 'conditions': [ + ['OS=="mac"', { + 'xcode_settings': { + 'GCC_OPTIMIZATION_LEVEL': '3', + 'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES', + 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', + 'DEAD_CODE_STRIPPING': 'NO', + }, + }, { + 'cflags_cc': [ '-g', '-O3' ], + }], + ], }, }, } |