Created
September 28, 2009 16:48
-
-
Save aggieben/195555 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def init(): | |
pass | |
def set_options(opt): | |
import optparse | |
modes = ('debug', 'release', 'diagnostic') | |
bld_group = optparse.OptionGroup(opt.parser, "Build Options") | |
bld_group.add_option('-m', '--mode', choices=modes, type='choice', default='debug', action='store', | |
help='Build mode: can be one of {0} [default=debug]'.format(modes)) | |
opt.add_option_group(bld_group) | |
opt.tool_options('compiler_cxx') | |
def configure(conf): | |
conf.check_tool('compiler_cxx') | |
conf.check_tool('batched_cc') | |
if Options.options.mode == 'release': | |
env_rel = conf.env.copy() | |
env_rel.append_value('CXXFLAGS', '-02') | |
env_rel.set_variant('release') | |
conf.set_env_name('release', env_rel) | |
conf.setenv('release') | |
if Options.options.mode == 'debug': | |
env_dbg = conf.env.copy() | |
env_dbg.append_value('CXXFLAGS', '-g') | |
env_dbg.set_variant('debug') | |
conf.set_env_name('debug', env_dbg) | |
conf.setenv('debug') | |
def build(bld): | |
if Options.options.mode: | |
print '======= Building in {0} mode ======='.format(Options.options.mode) | |
inc_buildnum('{0}/.buildnum'.format(TOP)) | |
print 'version.cpp.in -> version.cpp' | |
reversion(bld.env, TOP) | |
for obj in bld.all_task_gen[:]: | |
new_obj = obj.clone(Options.options.mode) | |
bld.add_subdirs('src') | |
def shutdown(): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment