waf

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

wscript_build (1034B)


      1 #! /usr/bin/env python
      2 
      3 def write_header(tsk):
      4 	tsk.outputs[0].write('int abc = 423;\n')
      5 bld(features='use', rule=write_header, target='b.h', ext_out=['.h'], name='XYZ')
      6 
      7 tg = bld.program(
      8 	features = 'aaa',
      9 	source   = 'main.c',
     10 	includes = '. ..',
     11 	#cflags   = ['-O3'], # for example
     12 	defines  = ['foo=bar'],
     13 	target   = 'myprogram',
     14 	use      = 'M XYZ')
     15 
     16 # just for fun, make main.c depend on wscript_build
     17 bld.add_manual_dependency('main.c', bld.path.find_resource('wscript_build'))
     18 
     19 # ----------------------------------------
     20 
     21 from waflib import TaskGen
     22 @TaskGen.feature('aaa')
     23 @TaskGen.before('apply_link')
     24 def add_one_task(self):
     25 	"""this is a task generator method, it is bound to the feature 'aaa' """
     26 	tsk = self.create_task('foo')
     27 	tsk.outputs = [self.bld.path.find_or_declare('abc.h')]
     28 
     29 import waflib.Task
     30 class foo(waflib.Task.Task):
     31 	"""this is a task class"""
     32 	before = ['c']
     33 	color  = 'BLUE'
     34 	def run(self):
     35 		self.outputs[0].write('int kik = 343;\n')
     36 
     37 
     38 if bld.env.CC_NAME == 'msvc':
     39 	tg.source += ' msvc_resource.rc'