2 # Issue 1185 ultrix gmail com
5 Microsoft Interface Definition Language support. Given ComObject.idl, this tool
6 will generate ComObject.tlb ComObject_i.h ComObject_i.c ComObject_p.c and dlldata.c
8 To declare targets using midl::
17 # Note: ComObject_i.c is generated from ComObject.idl
18 source = 'main.c ComObject.idl ComObject_i.c',
19 target = 'ComObject.dll')
22 from waflib import Task, Utils
23 from waflib.TaskGen import feature, before_method
27 conf.find_program(['midl'], var='MIDL')
29 conf.env.MIDLFLAGS = [
40 @before_method('process_source')
42 # Do this before process_source so that the generated header can be resolved
43 # when scanning source dependencies.
46 for node in Utils.to_list(self.source):
47 if str(node).endswith('.idl'):
48 idl_nodes.append(node)
50 src_nodes.append(node)
52 for node in self.to_nodes(idl_nodes):
53 t = node.change_ext('.tlb')
54 h = node.change_ext('_i.h')
55 c = node.change_ext('_i.c')
56 p = node.change_ext('_p.c')
57 d = node.parent.find_or_declare('dlldata.c')
58 self.create_task('midl', node, [t, h, c, p, d])
60 self.source = src_nodes
62 class midl(Task.Task):
67 run_str = '${MIDL} ${MIDLFLAGS} ${CPPPATH_ST:INCLUDES} /tlb ${TGT[0].bldpath()} /header ${TGT[1].bldpath()} /iid ${TGT[2].bldpath()} /proxy ${TGT[3].bldpath()} /dlldata ${TGT[4].bldpath()} ${SRC}'