lahey.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import os
  2. from numpy.distutils.fcompiler import FCompiler
  3. compilers = ['LaheyFCompiler']
  4. class LaheyFCompiler(FCompiler):
  5. compiler_type = 'lahey'
  6. description = 'Lahey/Fujitsu Fortran 95 Compiler'
  7. version_pattern = r'Lahey/Fujitsu Fortran 95 Compiler Release (?P<version>[^\s*]*)'
  8. executables = {
  9. 'version_cmd' : ["<F90>", "--version"],
  10. 'compiler_f77' : ["lf95", "--fix"],
  11. 'compiler_fix' : ["lf95", "--fix"],
  12. 'compiler_f90' : ["lf95"],
  13. 'linker_so' : ["lf95", "-shared"],
  14. 'archiver' : ["ar", "-cr"],
  15. 'ranlib' : ["ranlib"]
  16. }
  17. module_dir_switch = None #XXX Fix me
  18. module_include_switch = None #XXX Fix me
  19. def get_flags_opt(self):
  20. return ['-O']
  21. def get_flags_debug(self):
  22. return ['-g', '--chk', '--chkglobal']
  23. def get_library_dirs(self):
  24. opt = []
  25. d = os.environ.get('LAHEY')
  26. if d:
  27. opt.append(os.path.join(d, 'lib'))
  28. return opt
  29. def get_libraries(self):
  30. opt = []
  31. opt.extend(['fj9f6', 'fj9i6', 'fj9ipp', 'fj9e6'])
  32. return opt
  33. if __name__ == '__main__':
  34. from distutils import log
  35. log.set_verbosity(2)
  36. from numpy.distutils import customized_fcompiler
  37. print(customized_fcompiler(compiler='lahey').get_version())