scons: New profile build.

This commit is contained in:
José Fonseca
2008-05-24 19:25:02 +09:00
parent 781676c7cc
commit 059a652d64
2 changed files with 14 additions and 1 deletions

View File

@@ -52,7 +52,8 @@ def AddOptions(opts):
from SCons.Options.EnumOption import EnumOption from SCons.Options.EnumOption import EnumOption
except ImportError: except ImportError:
from SCons.Variables.EnumVariable import EnumVariable as EnumOption 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(BoolOption('quiet', 'quiet command lines', 'no'))
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine, opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
allowed_values=('generic', 'x86', 'x86_64'))) allowed_values=('generic', 'x86', 'x86_64')))
@@ -125,6 +126,8 @@ def make_build_dir(env):
build_subdir += '-' + env['machine'] build_subdir += '-' + env['machine']
if env['debug']: if env['debug']:
build_subdir += "-debug" build_subdir += "-debug"
if env['profile']:
build_subdir += "-profile"
build_dir = os.path.join(build_topdir, build_subdir) build_dir = os.path.join(build_topdir, build_subdir)
# Place the .sconsign file on the builddir too, to avoid issues with different scons # Place the .sconsign file on the builddir too, to avoid issues with different scons
# versions building the same source file # versions building the same source file
@@ -154,6 +157,8 @@ def generate(env):
cppdefines += ['DEBUG'] cppdefines += ['DEBUG']
else: else:
cppdefines += ['NDEBUG'] cppdefines += ['NDEBUG']
if env['profile']:
cppdefines += ['PROFILE']
if platform == 'windows': if platform == 'windows':
cppdefines += [ cppdefines += [
'WIN32', 'WIN32',
@@ -204,6 +209,8 @@ def generate(env):
cflags += ['-O0', '-g3'] cflags += ['-O0', '-g3']
else: else:
cflags += ['-O3', '-g3'] cflags += ['-O3', '-g3']
if env['profile']:
cflags += ['-pg']
cflags += [ cflags += [
'-Wall', '-Wall',
'-Wmissing-prototypes', '-Wmissing-prototypes',
@@ -228,6 +235,11 @@ def generate(env):
'/Oi', # enable intrinsic functions '/Oi', # enable intrinsic functions
'/Os', # favor code space '/Os', # favor code space
] ]
if env['profile']:
cflags += [
'/Gh', # enable _penter hook function
'/GH', # enable _pexit hook function
]
if platform == 'windows': if platform == 'windows':
cflags += [ cflags += [
# TODO # TODO

View File

@@ -5,6 +5,7 @@ util = env.ConvenienceLibrary(
source = [ source = [
'p_debug.c', 'p_debug.c',
'p_debug_mem.c', 'p_debug_mem.c',
'p_debug_prof.c',
'p_tile.c', 'p_tile.c',
'p_util.c', 'p_util.c',
'u_blit.c', 'u_blit.c',