Skip to content

Commit

Permalink
Fortran compiler fixes from Peter Koval.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Sep 8, 2014
1 parent d79b8a1 commit 36d6fc4
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ def needs_static_linker(self):
return True

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')
ofile = open(source_name, 'w')
ofile.write('''program prog
Expand Down Expand Up @@ -1190,7 +1190,7 @@ def get_linker_always_args(self):
return []

def get_std_warn_args(self):
return GnuFortranCompiler.std_warn_args
return FortranCompiler.std_warn_args

def get_buildtype_args(self, buildtype):
return gnulike_buildtype_args[buildtype]
Expand Down Expand Up @@ -1257,6 +1257,9 @@ def __init__(self, exelist, version, is_cross, exe_wrapper=None):
super().__init__(exelist, version, is_cross, exe_wrapper=None)
self.id = 'g95'

def get_module_outdir_args(self, path):
return ['-fmod='+path]

class SunFortranCompiler(FortranCompiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None):
super().__init__(exelist, version, is_cross, exe_wrapper=None)
Expand All @@ -1266,7 +1269,35 @@ def get_dependency_gen_args(self, outtarget, outfile):
return ['-fpp']

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():
always_args = ['/NOLOGO']
Expand Down Expand Up @@ -1580,6 +1611,9 @@ def detect_fortran_compiler(self, want_cross):
version = vmatch.group(0)
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) + '"')

def get_scratch_dir(self):
Expand Down

0 comments on commit 36d6fc4

Please sign in to comment.