From faced685be03677e6f0add77f0168b247b88afdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Tue, 12 May 2015 19:38:57 +0200 Subject: [PATCH] Build with assertions on in release build --- SConstruct | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/SConstruct b/SConstruct index d52dec5..aad42de 100644 --- a/SConstruct +++ b/SConstruct @@ -52,10 +52,11 @@ AddOption('--coverage', help='Build with coverage (gcov) support' ) -AddOption('--with-assertions', +AddOption('--without-assertions', dest='assertions', - action='store_true', - help='Build with assertions enabled (Default for a debug build)' + action='store_false', + default=True, + help='Build without assertions enabled' ) AddOption('--stack-protection', @@ -110,11 +111,6 @@ if GetOption('force32bit'): if build_type == 'release': env.Append(CFLAGS = ['-O2']) - - if not assertions: - #this will turn off assert() - env.Append(CPPDEFINES = ['NDEBUG']) - elif build_type == 'debug': lib_suffix = 'D' env.Append(CPPDEFINES = ['DEBUG']) @@ -122,6 +118,9 @@ elif build_type == 'debug': if stack_protection: env.Append(CFLAGS = ['-fstack-protector', '--param=ssp-buffer-size=4']) env.Append(CPPDEFINES = ['_FORTIFY_SOURCE=2']) +if not assertions: + #this will turn off assert() + env.Append(CPPDEFINES = ['NDEBUG']) if GetOption('coverage'): env.Append(CFLAGS = ['--coverage']) @@ -131,6 +130,7 @@ if GetOption('coverage'): subst_info = dict(('@' + key + '@', version_info[key]) for key in version_info) subst_info['@prefix@'] = prefix subst_info['@build_type@'] = build_type + if assertions: subst_info['@build_type@'] += '_A' if stack_protection: