jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.3KB

  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. # Rafaƫl Kooi 2019
  4. from waflib import TaskGen
  5. @TaskGen.feature('c', 'cxx', 'fc')
  6. @TaskGen.after_method('propagate_uselib_vars')
  7. def add_pdb_per_object(self):
  8. """For msvc/fortran, specify a unique compile pdb per object, to work
  9. around LNK4099. Flags are updated with a unique /Fd flag based on the
  10. task output name. This is separate from the link pdb.
  11. """
  12. if not hasattr(self, 'compiled_tasks'):
  13. return
  14. link_task = getattr(self, 'link_task', None)
  15. for task in self.compiled_tasks:
  16. if task.inputs and task.inputs[0].name.lower().endswith('.rc'):
  17. continue
  18. add_pdb = False
  19. for flagname in ('CFLAGS', 'CXXFLAGS', 'FCFLAGS'):
  20. # several languages may be used at once
  21. for flag in task.env[flagname]:
  22. if flag[1:].lower() == 'zi':
  23. add_pdb = True
  24. break
  25. if add_pdb:
  26. node = task.outputs[0].change_ext('.pdb')
  27. pdb_flag = '/Fd:' + node.abspath()
  28. for flagname in ('CFLAGS', 'CXXFLAGS', 'FCFLAGS'):
  29. buf = [pdb_flag]
  30. for flag in task.env[flagname]:
  31. if flag[1:3] == 'Fd' or flag[1:].lower() == 'fs' or flag[1:].lower() == 'mp':
  32. continue
  33. buf.append(flag)
  34. task.env[flagname] = buf
  35. if link_task and not node in link_task.dep_nodes:
  36. link_task.dep_nodes.append(node)
  37. if not node in task.outputs:
  38. task.outputs.append(node)