#! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2009 (ita) VERSION='0.0.1' APPNAME='groups' srcdir = '.' blddir = 'build' import Options def set_options(opt): opt.tool_options('compiler_cxx') opt.add_option('--usegroup', action='store_true', default=False, help='Show the effect of using add_group') def hey(bld): print "@ before the build" def ho(bld): print "@ after the build" def configure(conf): conf.check_tool('compiler_cxx') conf.env.append_value('CXXFLAGS', ['-O2']) debugEnv = conf.env.copy() debugEnv.set_variant('debug') conf.set_env_name('debug', debugEnv) conf.setenv('debug') conf.env.append_value('CXXFLAGS', ['-O0', '-g3']) def build(bld): obj1 = bld(features='cxx cprogram', source='main.c', target='group') # IMPORTANT: compare the execution of # waf clean build --usegroup # waf clean build if Options.options.usegroup: bld.add_group('test') # groups may be used to represent global dependencies which may be very difficult to represent: # * building a compiler before using it # * executing the tests after the build is complete # * ... obj2 = obj1.clone('debug')