g95.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # http://g95.sourceforge.net/
  2. from __future__ import division, absolute_import, print_function
  3. from numpy.distutils.fcompiler import FCompiler
  4. compilers = ['G95FCompiler']
  5. class G95FCompiler(FCompiler):
  6. compiler_type = 'g95'
  7. description = 'G95 Fortran Compiler'
  8. # version_pattern = r'G95 \((GCC (?P<gccversion>[\d.]+)|.*?) \(g95!\) (?P<version>.*)\).*'
  9. # $ g95 --version
  10. # G95 (GCC 4.0.3 (g95!) May 22 2006)
  11. version_pattern = r'G95 \((GCC (?P<gccversion>[\d.]+)|.*?) \(g95 (?P<version>.*)!\) (?P<date>.*)\).*'
  12. # $ g95 --version
  13. # G95 (GCC 4.0.3 (g95 0.90!) Aug 22 2006)
  14. executables = {
  15. 'version_cmd' : ["<F90>", "--version"],
  16. 'compiler_f77' : ["g95", "-ffixed-form"],
  17. 'compiler_fix' : ["g95", "-ffixed-form"],
  18. 'compiler_f90' : ["g95"],
  19. 'linker_so' : ["<F90>", "-shared"],
  20. 'archiver' : ["ar", "-cr"],
  21. 'ranlib' : ["ranlib"]
  22. }
  23. pic_flags = ['-fpic']
  24. module_dir_switch = '-fmod='
  25. module_include_switch = '-I'
  26. def get_flags(self):
  27. return ['-fno-second-underscore']
  28. def get_flags_opt(self):
  29. return ['-O']
  30. def get_flags_debug(self):
  31. return ['-g']
  32. if __name__ == '__main__':
  33. from distutils import log
  34. from numpy.distutils import customized_fcompiler
  35. log.set_verbosity(2)
  36. print(customized_fcompiler('g95').get_version())