g95.py 1.3 KB

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