You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
waf_old/docs/book/examples/advbuild_variant_env/wscript

44 lines
958 B
Python

#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010 (ita)
"""
Define build commands for several variants at once
Try executing
$ waf clean_debug build_debug clean_release build_release
"""
VERSION='0.0.1'
APPNAME='cc_test'
top = '.'
out = 'build'
def options(opt):
opt.load('compiler_c')
def configure(conf):
conf.setenv('debug')
conf.load('compiler_c')
conf.env.CFLAGS = ['-g']
conf.setenv('release')
conf.load('compiler_c')
conf.env.CFLAGS = ['-O2']
def build(bld):
if not bld.variant:
bld.fatal('call "waf build_debug" or "waf build_release", and try "waf --help"')
bld.program(source='main.c', target='app', includes='.')
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