Build with assertions on in release build
This commit is contained in:
+8
-8
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user