diff options
author | José Fonseca <[email protected]> | 2008-05-24 19:25:02 +0900 |
---|---|---|
committer | José Fonseca <[email protected]> | 2008-05-24 19:25:02 +0900 |
commit | 059a652d64da470ccc7f2f3266fd64721848a7be (patch) | |
tree | 4fd0a3f94283b0fead8183c87a236a57217d0245 /common.py | |
parent | 781676c7cc5ae7586ee8edd07de880892c5a2d86 (diff) |
scons: New profile build.
Diffstat (limited to 'common.py')
-rw-r--r-- | common.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common.py b/common.py index 36b190ce89f..d3c0261d71e 100644 --- a/common.py +++ b/common.py @@ -52,7 +52,8 @@ def AddOptions(opts): 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'))) @@ -125,6 +126,8 @@ def make_build_dir(env): 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 @@ -154,6 +157,8 @@ def generate(env): cppdefines += ['DEBUG'] else: cppdefines += ['NDEBUG'] + if env['profile']: + cppdefines += ['PROFILE'] if platform == 'windows': cppdefines += [ 'WIN32', @@ -204,6 +209,8 @@ def generate(env): cflags += ['-O0', '-g3'] else: cflags += ['-O3', '-g3'] + if env['profile']: + cflags += ['-pg'] cflags += [ '-Wall', '-Wmissing-prototypes', @@ -228,6 +235,11 @@ def generate(env): '/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 |