Merge pull request #4792 from scivision/flang

Flang Fortran compiler added.
pull/4799/head
Jussi Pakkanen 6 years ago committed by GitHub
commit 57424e9403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      docs/markdown/Reference-tables.md
  2. 3
      docs/markdown/snippets/flang_fortran_compiler.md
  3. 2
      mesonbuild/compilers/__init__.py
  4. 6
      mesonbuild/compilers/compilers.py
  5. 14
      mesonbuild/compilers/fortran.py
  6. 4
      mesonbuild/environment.py

@ -13,6 +13,7 @@ These are return values of the `get_id` (Compiler family) and
| clang | The Clang compiler | gcc |
| clang-cl | The Clang compiler (MSVC compatible driver) | msvc |
| dmd | D lang reference compiler | |
| flang | Flang Fortran compiler | |
| g95 | The G95 Fortran compiler | |
| gcc | The GNU Compiler Collection | gcc |
| intel | Intel compiler | msvc on windows, otherwise gcc |

@ -0,0 +1,3 @@
## added the Flang compiler
[Flang](https://github.com/flang-compiler/flang/releases) Fortran compiler support was added.
As with other Fortran compilers, flang is specified using `FC=flang meson ..` or similar.

@ -62,6 +62,7 @@ __all__ = [
'GnuDCompiler',
'GnuFortranCompiler',
'ElbrusFortranCompiler',
'FlangFortranCompiler',
'GnuObjCCompiler',
'GnuObjCPPCompiler',
'IntelCompiler',
@ -153,6 +154,7 @@ from .fortran import (
G95FortranCompiler,
GnuFortranCompiler,
ElbrusFortranCompiler,
FlangFortranCompiler,
IntelFortranCompiler,
NAGFortranCompiler,
Open64FortranCompiler,

@ -1617,7 +1617,11 @@ class PGICompiler:
return ['-silent']
def openmp_flags(self):
return ['-fopenmp']
return ['-mp']
def get_allow_undefined_link_args(self):
return []
class ElbrusCompiler(GnuCompiler):
# Elbrus compiler is nearly like GCC, but does not support

@ -22,6 +22,7 @@ from .compilers import (
clike_debug_args,
Compiler,
GnuCompiler,
ClangCompiler,
ElbrusCompiler,
IntelCompiler,
PGICompiler
@ -370,7 +371,7 @@ class PathScaleFortranCompiler(FortranCompiler):
return ['-mp']
class PGIFortranCompiler(FortranCompiler):
class PGIFortranCompiler(PGICompiler, FortranCompiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags):
FortranCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwags)
PGICompiler.__init__(self, CompilerType.PGI_STANDARD)
@ -382,6 +383,17 @@ class PGIFortranCompiler(FortranCompiler):
return val
class FlangFortranCompiler(ClangCompiler, FortranCompiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags):
FortranCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwags)
ClangCompiler.__init__(self, CompilerType.CLANG_STANDARD)
self.id = 'flang'
default_warn_args = ['-Minform=inform']
self.warn_args = {'1': default_warn_args,
'2': default_warn_args,
'3': default_warn_args}
class Open64FortranCompiler(FortranCompiler):
def __init__(self, exelist, version, is_cross, exe_wrapper=None, **kwags):
FortranCompiler.__init__(self, exelist, version, is_cross, exe_wrapper, **kwags)

@ -44,6 +44,7 @@ from .compilers import (
ClangObjCPPCompiler,
ClangClCCompiler,
ClangClCPPCompiler,
FlangFortranCompiler,
G95FortranCompiler,
GnuCCompiler,
GnuCPPCompiler,
@ -782,6 +783,9 @@ class Environment:
if 'PGI Compilers' in out:
return PGIFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version)
if 'flang' in out or 'clang' in out:
return FlangFortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version)
if 'Open64 Compiler Suite' in err:
return Open64FortranCompiler(compiler, version, is_cross, exe_wrap, full_version=full_version)

Loading…
Cancel
Save