123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- VERSION='0.0.1'
- APPNAME='cc_test'
- top = '.'
- out = 'build'
- """
- General variant system
- Call for example:
- $ waf configure build_debug build_release clean_debug clean_release
- The builds will end in different build folders
- note how "bld.variant" is used to detect the current variant
- See also playground/remote/wscript for a more specific example
- """
- def configure(conf):
- conf.setenv('debug')
- conf.load('compiler_c')
- conf.define("A", 1)
- conf.define("B", 1.1)
- conf.define("C", "1.1e19", quote=False)
-
- conf.write_config_header('debug/config.h', remove=False)
- conf.setenv('release', env=conf.env.derive())
- conf.env.CFLAGS = ['-O2']
- conf.options.prefix = '/opt'
- conf.load('compiler_c')
- conf.define('E', 1)
- conf.write_config_header('release/config.h')
- def build(bld):
-
-
-
-
-
- if not bld.variant:
- bld.fatal('Call "waf build_debug" or "waf build_release", and read the comments in the wscript file!')
-
-
- bld.program(source='main.c', target='app', includes='.')
-
-
-
-
-
-
-
- def options(opt):
- opt.load('compiler_c')
- def init(ctx):
- from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext
- for x in 'debug release'.split():
- for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
- name = y.__name__.replace('Context','').lower()
- class tmp(y):
- cmd = name + '_' + x
- variant = x
-
-
-
-
-
-
-
- def buildall(ctx):
- import waflib.Options
- for x in ('build_debug', 'build_release'):
- waflib.Options.commands.insert(0, x)
|