from SCons.Options.EnumOption import EnumOption
except ImportError:
from SCons.Variables.EnumVariable import EnumVariable as EnumOption
- opts.Add(BoolOption('debug', 'build debug version', 'no'))
+ opts.Add(BoolOption('debug', 'debug build', 'no'))
+ opts.Add(BoolOption('profile', 'profile build', 'no'))
#opts.Add(BoolOption('quiet', 'quiet command lines', 'no'))
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'x86', 'x86_64')))
build_subdir += '-' + env['machine']
if env['debug']:
build_subdir += "-debug"
+ if env['profile']:
+ build_subdir += "-profile"
build_dir = os.path.join(build_topdir, build_subdir)
# Place the .sconsign file on the builddir too, to avoid issues with different scons
# versions building the same source file
cppdefines += ['DEBUG']
else:
cppdefines += ['NDEBUG']
+ if env['profile']:
+ cppdefines += ['PROFILE']
if platform == 'windows':
cppdefines += [
'WIN32',
cflags += ['-O0', '-g3']
else:
cflags += ['-O3', '-g3']
+ if env['profile']:
+ cflags += ['-pg']
cflags += [
'-Wall',
'-Wmissing-prototypes',
'/Oi', # enable intrinsic functions
'/Os', # favor code space
]
+ if env['profile']:
+ cflags += [
+ '/Gh', # enable _penter hook function
+ '/GH', # enable _pexit hook function
+ ]
if platform == 'windows':
cflags += [
# TODO