Build with assertions on in release build

This commit is contained in:
Nils O. Selåsdal
2015-05-12 19:38:57 +02:00
parent 54de720e87
commit faced685be
+8 -8
View File
@@ -52,10 +52,11 @@ AddOption('--coverage',
help='Build with coverage (gcov) support' help='Build with coverage (gcov) support'
) )
AddOption('--with-assertions', AddOption('--without-assertions',
dest='assertions', dest='assertions',
action='store_true', action='store_false',
help='Build with assertions enabled (Default for a debug build)' default=True,
help='Build without assertions enabled'
) )
AddOption('--stack-protection', AddOption('--stack-protection',
@@ -110,11 +111,6 @@ if GetOption('force32bit'):
if build_type == 'release': if build_type == 'release':
env.Append(CFLAGS = ['-O2']) env.Append(CFLAGS = ['-O2'])
if not assertions:
#this will turn off assert()
env.Append(CPPDEFINES = ['NDEBUG'])
elif build_type == 'debug': elif build_type == 'debug':
lib_suffix = 'D' lib_suffix = 'D'
env.Append(CPPDEFINES = ['DEBUG']) env.Append(CPPDEFINES = ['DEBUG'])
@@ -122,6 +118,9 @@ elif build_type == 'debug':
if stack_protection: if stack_protection:
env.Append(CFLAGS = ['-fstack-protector', '--param=ssp-buffer-size=4']) env.Append(CFLAGS = ['-fstack-protector', '--param=ssp-buffer-size=4'])
env.Append(CPPDEFINES = ['_FORTIFY_SOURCE=2']) env.Append(CPPDEFINES = ['_FORTIFY_SOURCE=2'])
if not assertions:
#this will turn off assert()
env.Append(CPPDEFINES = ['NDEBUG'])
if GetOption('coverage'): if GetOption('coverage'):
env.Append(CFLAGS = ['--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 = dict(('@' + key + '@', version_info[key]) for key in version_info)
subst_info['@prefix@'] = prefix subst_info['@prefix@'] = prefix
subst_info['@build_type@'] = build_type subst_info['@build_type@'] = build_type
if assertions: if assertions:
subst_info['@build_type@'] += '_A' subst_info['@build_type@'] += '_A'
if stack_protection: if stack_protection: