Fortran compiler fixes from Peter Koval.

pull/15/head
Jussi Pakkanen 10 years ago
parent d79b8a19a0
commit 36d6fc47b3
  1. 40
      environment.py

@ -1159,7 +1159,7 @@ class FortranCompiler():
return True return True
def sanity_check(self, work_dir): def sanity_check(self, work_dir):
source_name = os.path.join(work_dir, 'sanitycheckf.f95') source_name = os.path.join(work_dir, 'sanitycheckf.f90')
binary_name = os.path.join(work_dir, 'sanitycheckf') binary_name = os.path.join(work_dir, 'sanitycheckf')
ofile = open(source_name, 'w') ofile = open(source_name, 'w')
ofile.write('''program prog ofile.write('''program prog
@ -1190,7 +1190,7 @@ end program prog
return [] return []
def get_std_warn_args(self): def get_std_warn_args(self):
return GnuFortranCompiler.std_warn_args return FortranCompiler.std_warn_args
def get_buildtype_args(self, buildtype): def get_buildtype_args(self, buildtype):
return gnulike_buildtype_args[buildtype] return gnulike_buildtype_args[buildtype]
@ -1257,6 +1257,9 @@ class G95FortranCompiler(FortranCompiler):
super().__init__(exelist, version, is_cross, exe_wrapper=None) super().__init__(exelist, version, is_cross, exe_wrapper=None)
self.id = 'g95' self.id = 'g95'
def get_module_outdir_args(self, path):
return ['-fmod='+path]
class SunFortranCompiler(FortranCompiler): class SunFortranCompiler(FortranCompiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None): def __init__(self, exelist, version, is_cross, exe_wrapper=None):
super().__init__(exelist, version, is_cross, exe_wrapper=None) super().__init__(exelist, version, is_cross, exe_wrapper=None)
@ -1266,7 +1269,35 @@ class SunFortranCompiler(FortranCompiler):
return ['-fpp'] return ['-fpp']
def get_always_args(self): def get_always_args(self):
return [''] return []
def get_std_warn_args(self):
return []
def get_module_outdir_args(self, path):
return ['-moddir='+path]
class IntelFortranCompiler(FortranCompiler):
std_warn_args = ['-warn', 'all']
def __init__(self, exelist, version, is_cross, exe_wrapper=None):
super().__init__(exelist, version, is_cross, exe_wrapper=None)
self.id = 'intel'
def get_module_outdir_args(self, path):
return ['-module', path]
def get_always_args(self):
return []
def can_compile(self, src):
suffix = os.path.splitext(src)[1].lower()
if suffix == '.f' or suffix == '.f90':
return True
return False
def get_std_warn_args(self):
return IntelFortranCompiler.std_warn_args
class VisualStudioLinker(): class VisualStudioLinker():
always_args = ['/NOLOGO'] always_args = ['/NOLOGO']
@ -1580,6 +1611,9 @@ class Environment():
version = vmatch.group(0) version = vmatch.group(0)
return SunFortranCompiler([compiler], version, is_cross, exe_wrap) return SunFortranCompiler([compiler], version, is_cross, exe_wrap)
if 'ifort (IFORT)' in out:
return IntelFortranCompiler([compiler], version, is_cross, exe_wrap)
raise EnvironmentException('Unknown compiler(s): "' + ', '.join(compilers) + '"') raise EnvironmentException('Unknown compiler(s): "' + ', '.join(compilers) + '"')
def get_scratch_dir(self): def get_scratch_dir(self):

Loading…
Cancel
Save