From 215c9bcdaba9b5901358dd95e51e393db604da8f Mon Sep 17 00:00:00 2001 From: Peter Thorson Date: Mon, 6 May 2013 10:33:02 -0500 Subject: [PATCH] adds better debugging options for the scons build system --- SConstruct | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/SConstruct b/SConstruct index c9a6f8f85b..2873c125de 100644 --- a/SConstruct +++ b/SConstruct @@ -2,10 +2,12 @@ import os, sys, commands env = Environment(ENV = os.environ) # figure out a better way to configure this -#env["CXX"] = "clang++" if os.environ.has_key('CXX'): env['CXX'] = os.environ['CXX'] +if os.environ.has_key('DEBUG'): + env['DEBUG'] = os.environ['DEBUG'] + if os.environ.has_key('CXXFLAGS'): #env['CXXFLAGS'] = os.environ['CXXFLAGS'] env.Append(CXXFLAGS = os.environ['CXXFLAGS']) @@ -69,14 +71,20 @@ if env['PLATFORM'].startswith('win'): env['CCFLAGS'] = '%s /EHsc /GR /GS- /MD /nologo %s %s' % (warn_flags, arch_flags, opt_flags) env['LINKFLAGS'] = '/INCREMENTAL:NO /MANIFEST /NOLOGO /OPT:REF /OPT:ICF /MACHINE:X86' elif env['PLATFORM'] == 'posix': - env.Append(CPPDEFINES = ['NDEBUG']) + if env.has_key('DEBUG'): + env.Append(CCFLAGS = ['-g', '-O0']) + else: + env.Append(CPPDEFINES = ['NDEBUG']) + env.Append(CCFLAGS = ['-O3', '-fomit-frame-pointer']) env.Append(CCFLAGS = ['-Wall']) - #env.Append(CCFLAGS = ['-O3', '-fomit-frame-pointer']) #env['LINKFLAGS'] = '' elif env['PLATFORM'] == 'darwin': - #env.Append(CPPDEFINES = ['NDEBUG']) - env.Append(CCFLAGS = ['-Wall','-O0']) - #env.Append(CCFLAGS = ['-O3', '-fomit-frame-pointer']) + if env.has_key('DEBUG'): + env.Append(CCFLAGS = ['-g', '-O0']) + else: + env.Append(CPPDEFINES = ['NDEBUG']) + env.Append(CCFLAGS = ['-O3', '-fomit-frame-pointer']) + env.Append(CCFLAGS = ['-Wall']) #env['LINKFLAGS'] = '' if env['PLATFORM'].startswith('win'):