mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 01:46:15 +01:00
48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
#! /usr/bin/env python
|
|
# encoding: utf-8
|
|
# Thomas Nagy, 2011 (ita)
|
|
|
|
"""
|
|
Map a compilation failure to a success status. People playing with C++ templates
|
|
might need this.
|
|
"""
|
|
|
|
top = '.'
|
|
out = 'build'
|
|
|
|
def options(opt):
|
|
opt.load('compiler_cxx')
|
|
|
|
def configure(conf):
|
|
conf.load('compiler_cxx')
|
|
|
|
def build(bld):
|
|
bld.objects(source='success.cpp', target='ok')
|
|
bld.objects(source='fail.cpp', target='fail', features='fail')
|
|
|
|
##################################################################
|
|
# the feature 'fail' is defined below
|
|
|
|
from waflib.Tools.cxx import cxx
|
|
|
|
# our task class
|
|
class cxxfail(cxx):
|
|
def run(self):
|
|
ret = super(cxxfail, self).run()
|
|
self.outputs[0].write('just a simulation')
|
|
return not ret
|
|
|
|
# @extension would apply this to all through TaskGen.mappings
|
|
def one_more_mapping(self, node):
|
|
return self.create_compiled_task('cxxfail', node)
|
|
|
|
from waflib.TaskGen import feature, before
|
|
@before('process_source')
|
|
@feature('fail')
|
|
def remap_failure_to_success(self):
|
|
# override
|
|
self.mappings = dict(self.mappings)
|
|
# then change the extension processing
|
|
self.mappings['.cpp'] = one_more_mapping
|
|
|