wscript 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #! /usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2011 (ita)
  4. """
  5. Map a compilation failure to a successs status. People playing with C++ templates
  6. might need this.
  7. """
  8. top = '.'
  9. out = 'build'
  10. def options(opt):
  11. opt.load('compiler_cxx')
  12. def configure(conf):
  13. conf.load('compiler_cxx')
  14. def build(bld):
  15. bld.objects(source='success.cpp', target='ok')
  16. bld.objects(source='fail.cpp', target='fail', features='fail')
  17. ##################################################################
  18. # the feature 'fail' is defined below
  19. from waflib.Tools.cxx import cxx
  20. # our task class
  21. class cxxfail(cxx):
  22. def run(self):
  23. ret = super(cxxfail, self).run()
  24. self.outputs[0].write('just a simulation')
  25. return not ret
  26. # @extension would apply this to all through TaskGen.mappings
  27. def one_more_mapping(self, node):
  28. return self.create_compiled_task('cxxfail', node)
  29. from waflib.TaskGen import feature, before
  30. @before('process_source')
  31. @feature('fail')
  32. def remap_failure_to_success(self):
  33. # override
  34. self.mappings = dict(self.mappings)
  35. # then change the extension processing
  36. self.mappings['.cpp'] = one_more_mapping