waf

FORK: waf with some random patches
git clone https://git.neptards.moe/neptards/waf.git
Log | Files | Refs | README

wscript (1499B)


      1 #! /usr/bin/env python
      2 
      3 top = '.'
      4 out = 'build'
      5 
      6 from waflib import Node, Build, Utils, Logs
      7 
      8 def tt(msg, expected, result):
      9 	color = 'RED'
     10 	if result == expected:
     11 		color = 'GREEN'
     12 	Logs.pprint(color, msg.ljust(20) + " %r" % result)
     13 
     14 
     15 FRAG1 = '''#include <stdio.h>\nint main() { printf(somestring); return 0; }\n'''
     16 FRAG2 = '''#ifdef MMM\nint main() { return 0; }\n#endif\n'''
     17 
     18 def options(opt):
     19 	opt.load('compiler_c')
     20 
     21 def configure(conf):
     22 	"""the configuration should not raise any assert"""
     23 
     24 	conf.load('compiler_c')
     25 
     26 	conf.define('AAA', 1)
     27 	tt('define AAA', "['AAA=1']", repr(conf.env.DEFINES))
     28 
     29 	conf.undefine('AAA')
     30 	tt('undefine AAA', [], conf.env.DEFINES)
     31 
     32 	conf.define('BB', 32)
     33 	conf.define('CC', 'test')
     34 	conf.define('inline', 'inline', quote=False)
     35 
     36 	conf.write_config_header()
     37 	tt('empty config header', [], conf.env.DEFINES)
     38 
     39 	conf.define('somestring', 'test')
     40 	conf.check(fragment=FRAG1, define_name='MMM', mandatory=False)
     41 	tt('is_defined(MMM)', True, conf.is_defined('MMM'))
     42 	conf.check(fragment=FRAG2, define_name='NNN', mandatory=False)
     43 	tt('defines are propagated to tests', True, conf.is_defined('NNN'))
     44 
     45 	conf.undefine('AAA')
     46 	conf.write_config_header('config.2.h', remove=False)
     47 	tt('defines are not removed', 3, len(conf.env.DEFINES))
     48 
     49 	tt('have_define', 'HAVE_FOO', conf.have_define('FOO'))
     50 
     51 	conf.env.DEFINES = []
     52 	conf.define('AAA', 1)
     53 	conf.define('AAA', 2)
     54 	tt('AAA', '2', conf.get_define('AAA'))
     55 	tt('defines count', 1, len(conf.env.DEFINES))
     56 
     57 def build(bld):
     58 	pass
     59