5 from waflib
import TaskGen
7 @TaskGen.feature('c', 'cxx', 'fc')
8 @TaskGen.after_method('propagate_uselib_vars')
9 def add_pdb_per_object(self
):
10 """For msvc/fortran, specify a unique compile pdb per object, to work
11 around LNK4099. Flags are updated with a unique /Fd flag based on the
12 task output name. This is separate from the link pdb.
14 if not hasattr(self
, 'compiled_tasks'):
17 link_task
= getattr(self
, 'link_task', None)
19 for task
in self
.compiled_tasks
:
20 if task
.inputs
and task
.inputs
[0].name
.lower().endswith('.rc'):
24 for flagname
in ('CFLAGS', 'CXXFLAGS', 'FCFLAGS'):
25 # several languages may be used at once
26 for flag
in task
.env
[flagname
]:
27 if flag
[1:].lower() == 'zi':
32 node
= task
.outputs
[0].change_ext('.pdb')
33 pdb_flag
= '/Fd:' + node
.abspath()
35 for flagname
in ('CFLAGS', 'CXXFLAGS', 'FCFLAGS'):
37 for flag
in task
.env
[flagname
]:
38 if flag
[1:3] == 'Fd' or flag
[1:].lower() == 'fs' or flag
[1:].lower() == 'mp':
41 task
.env
[flagname
] = buf
43 if link_task
and not node
in link_task
.dep_nodes
:
44 link_task
.dep_nodes
.append(node
)
45 if not node
in task
.outputs
:
46 task
.outputs
.append(node
)