From 3a266ff5e8bad36a219673cdbd2ba34494aa8f39 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Tue, 27 Oct 2015 21:26:12 +1000 Subject: Add --profile waf option so frame pointer isn't omitted in optimized builds --- wscript | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'wscript') diff --git a/wscript b/wscript index b864d95464..9ef5ab7e36 100644 --- a/wscript +++ b/wscript @@ -40,8 +40,10 @@ compiler_flags_dictionaries= { 'linker-debuggable' : '', # Flags required when building a non-debug optimized build 'nondebuggable' : '-DNDEBUG', - # Flags required to enable profiling at runtime - 'profile' : '-pg', + # Flags required to enable profiling at runtime with optimized builds + 'profile' : [ '-fno-omit-frame-pointer' ], + # Flags required to enable gprofile profiling + 'gprofile' : '-pg', # Flags required to disable warnings about unused arguments to function calls 'silence-unused-arguments' : '', # Flags required to use SSE unit for general math @@ -89,7 +91,7 @@ compiler_flags_dictionaries= { 'debuggable' : ['/DDEBUG', '/Od', '/Zi', '/MDd', '/Gd', '/EHsc'], 'linker-debuggable' : ['/DEBUG', '/INCREMENTAL' ], 'nondebuggable' : ['/DNDEBUG', '/Ob1', '/MD', '/Gd', '/EHsc'], - 'profile' : '', + 'profile' : '/Oy-', 'sse' : '/arch:SSE', 'silence-unused-arguments' : '', 'sse' : '', @@ -332,7 +334,7 @@ int main() { return 0; }''', linker_flags.append('-fsanitize=address') if opt.gprofile: - debug_flags = [ flags_dict['profile'] ] + debug_flags = [ flags_dict['gprofile'] ] # OSX if platform == 'darwin': @@ -545,6 +547,9 @@ int main() { return 0; }''', if opt.debug_symbols: optimization_flags += flags_dict['debuggable'] + if opt.profile: + optimization_flags += flags_dict['profile'] + if opt.stl_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)') opt.add_option('--freebie', action='store_true', default=False, dest='freebie', 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', help='Compile for use with gprofile') opt.add_option('--libjack', type='string', default="auto", dest='libjack_link', -- cgit v1.2.3