13
0

Add --profile waf option so frame pointer isn't omitted in optimized builds

This commit is contained in:
Tim Mayberry 2015-10-27 21:26:12 +10:00
parent bb5b0a6d8a
commit 3a266ff5e8

15
wscript
View File

@ -40,8 +40,10 @@ compiler_flags_dictionaries= {
'linker-debuggable' : '', 'linker-debuggable' : '',
# Flags required when building a non-debug optimized build # Flags required when building a non-debug optimized build
'nondebuggable' : '-DNDEBUG', 'nondebuggable' : '-DNDEBUG',
# Flags required to enable profiling at runtime # Flags required to enable profiling at runtime with optimized builds
'profile' : '-pg', 'profile' : [ '-fno-omit-frame-pointer' ],
# Flags required to enable gprofile profiling
'gprofile' : '-pg',
# Flags required to disable warnings about unused arguments to function calls # Flags required to disable warnings about unused arguments to function calls
'silence-unused-arguments' : '', 'silence-unused-arguments' : '',
# Flags required to use SSE unit for general math # Flags required to use SSE unit for general math
@ -89,7 +91,7 @@ compiler_flags_dictionaries= {
'debuggable' : ['/DDEBUG', '/Od', '/Zi', '/MDd', '/Gd', '/EHsc'], 'debuggable' : ['/DDEBUG', '/Od', '/Zi', '/MDd', '/Gd', '/EHsc'],
'linker-debuggable' : ['/DEBUG', '/INCREMENTAL' ], 'linker-debuggable' : ['/DEBUG', '/INCREMENTAL' ],
'nondebuggable' : ['/DNDEBUG', '/Ob1', '/MD', '/Gd', '/EHsc'], 'nondebuggable' : ['/DNDEBUG', '/Ob1', '/MD', '/Gd', '/EHsc'],
'profile' : '', 'profile' : '/Oy-',
'sse' : '/arch:SSE', 'sse' : '/arch:SSE',
'silence-unused-arguments' : '', 'silence-unused-arguments' : '',
'sse' : '', 'sse' : '',
@ -332,7 +334,7 @@ int main() { return 0; }''',
linker_flags.append('-fsanitize=address') linker_flags.append('-fsanitize=address')
if opt.gprofile: if opt.gprofile:
debug_flags = [ flags_dict['profile'] ] debug_flags = [ flags_dict['gprofile'] ]
# OSX # OSX
if platform == 'darwin': if platform == 'darwin':
@ -545,6 +547,9 @@ int main() { return 0; }''',
if opt.debug_symbols: if opt.debug_symbols:
optimization_flags += flags_dict['debuggable'] optimization_flags += flags_dict['debuggable']
if opt.profile:
optimization_flags += flags_dict['profile']
if opt.stl_debug: if opt.stl_debug:
cxx_flags.append("-D_GLIBCXX_DEBUG") cxx_flags.append("-D_GLIBCXX_DEBUG")
@ -646,6 +651,8 @@ def options(opt):
help='Build MIME type and .desktop files as per freedesktop.org standards (will be placed in build/gtk2_ardour)') help='Build MIME type and .desktop files as per freedesktop.org standards (will be placed in build/gtk2_ardour)')
opt.add_option('--freebie', action='store_true', default=False, dest='freebie', opt.add_option('--freebie', action='store_true', default=False, dest='freebie',
help='Build a version suitable for distribution as a zero-cost binary') help='Build a version suitable for distribution as a zero-cost binary')
opt.add_option('--profile', action='store_true', default=False, dest='profile',
help='Compile for use with profiling tools requiring a frame pointer')
opt.add_option('--gprofile', action='store_true', default=False, dest='gprofile', opt.add_option('--gprofile', action='store_true', default=False, dest='gprofile',
help='Compile for use with gprofile') help='Compile for use with gprofile')
opt.add_option('--libjack', type='string', default="auto", dest='libjack_link', opt.add_option('--libjack', type='string', default="auto", dest='libjack_link',