compilers: make sure cxx11_flag() is defined for all compilers

This commit is contained in:
Denis Davydov 2016-05-03 10:47:39 +02:00
parent 13e52962ee
commit 2cdfe14e5a
3 changed files with 23 additions and 1 deletions

View File

@ -47,6 +47,17 @@ class Clang(Compiler):
'f77' : 'f77',
'fc' : 'f90' }
@property
def cxx11_flag(self):
if ver.endswith('-apple'):
# FIXME: figure out from which version Apple's clang supports c++11
return "-std=c++11"
else:
if self.version < ver('3.3'):
tty.die("Only Clang 3.3 and above support c++11.")
else:
return "-std=c++11"
@classmethod
def default_version(self, comp):
"""The '--version' option works for clang compilers.

View File

@ -20,6 +20,12 @@ class Nag(Compiler):
'f77' : 'nag/nagfor',
'fc' : 'nag/nagfor' }
@property
def cxx11_flag(self):
tty.die("cxx11_flag() is not implemented for nag. Consider creating a pull-request.")
return "-std=c++11"
@classmethod
def default_version(self, comp):
"""The '-V' option works for nag compilers.

View File

@ -43,6 +43,12 @@ class Pgi(Compiler):
'f77' : 'pgi/pgfortran',
'fc' : 'pgi/pgfortran' }
@property
def cxx11_flag(self):
tty.die("cxx11_flag() is not implemented for pgi. Consider creating a pull-request.")
return "-std=c++11"
@classmethod
def default_version(cls, comp):
"""The '-V' option works for all the PGI compilers.
@ -54,4 +60,3 @@ def default_version(cls, comp):
"""
return get_compiler_version(
comp, '-V', r'pg[^ ]* ([^ ]+) \d\d\d?-bit target')