sun.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. from __future__ import division, absolute_import, print_function
  2. from numpy.distutils.ccompiler import simple_version_match
  3. from numpy.distutils.fcompiler import FCompiler
  4. compilers = ['SunFCompiler']
  5. class SunFCompiler(FCompiler):
  6. compiler_type = 'sun'
  7. description = 'Sun or Forte Fortran 95 Compiler'
  8. # ex:
  9. # f90: Sun WorkShop 6 update 2 Fortran 95 6.2 Patch 111690-10 2003/08/28
  10. version_match = simple_version_match(
  11. start=r'f9[05]: (Sun|Forte|WorkShop).*Fortran 95')
  12. executables = {
  13. 'version_cmd' : ["<F90>", "-V"],
  14. 'compiler_f77' : ["f90"],
  15. 'compiler_fix' : ["f90", "-fixed"],
  16. 'compiler_f90' : ["f90"],
  17. 'linker_so' : ["<F90>", "-Bdynamic", "-G"],
  18. 'archiver' : ["ar", "-cr"],
  19. 'ranlib' : ["ranlib"]
  20. }
  21. module_dir_switch = '-moddir='
  22. module_include_switch = '-M'
  23. pic_flags = ['-xcode=pic32']
  24. def get_flags_f77(self):
  25. ret = ["-ftrap=%none"]
  26. if (self.get_version() or '') >= '7':
  27. ret.append("-f77")
  28. else:
  29. ret.append("-fixed")
  30. return ret
  31. def get_opt(self):
  32. return ['-fast', '-dalign']
  33. def get_arch(self):
  34. return ['-xtarget=generic']
  35. def get_libraries(self):
  36. opt = []
  37. opt.extend(['fsu', 'sunmath', 'mvec'])
  38. return opt
  39. def runtime_library_dir_option(self, dir):
  40. return '-R%s' % dir
  41. if __name__ == '__main__':
  42. from distutils import log
  43. log.set_verbosity(2)
  44. from numpy.distutils import customized_fcompiler
  45. print(customized_fcompiler(compiler='sun').get_version())