gdc.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. # Carlos Rafael Giani, 2007 (dv)
  4. from waflib.Tools import ar, d
  5. from waflib.Configure import conf
  6. @conf
  7. def find_gdc(conf):
  8. """
  9. Finds the program gdc and set the variable *D*
  10. """
  11. conf.find_program('gdc', var='D')
  12. out = conf.cmd_and_log(conf.env.D + ['--version'])
  13. if out.find("gdc") == -1:
  14. conf.fatal("detected compiler is not gdc")
  15. @conf
  16. def common_flags_gdc(conf):
  17. """
  18. Sets the flags required by *gdc*
  19. """
  20. v = conf.env
  21. v.DFLAGS = []
  22. v.D_SRC_F = ['-c']
  23. v.D_TGT_F = '-o%s'
  24. v.D_LINKER = v.D
  25. v.DLNK_SRC_F = ''
  26. v.DLNK_TGT_F = '-o%s'
  27. v.DINC_ST = '-I%s'
  28. v.DSHLIB_MARKER = v.DSTLIB_MARKER = ''
  29. v.DSTLIB_ST = v.DSHLIB_ST = '-l%s'
  30. v.DSTLIBPATH_ST = v.DLIBPATH_ST = '-L%s'
  31. v.LINKFLAGS_dshlib = ['-shared']
  32. v.DHEADER_ext = '.di'
  33. v.DFLAGS_d_with_header = '-fintfc'
  34. v.D_HDR_F = '-fintfc-file=%s'
  35. def configure(conf):
  36. """
  37. Configuration for gdc
  38. """
  39. conf.find_gdc()
  40. conf.load('ar')
  41. conf.load('d')
  42. conf.common_flags_gdc()
  43. conf.d_platform_flags()