aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-01-17 22:21:45 +0200
committerGitHub <noreply@github.com>2019-01-17 22:21:45 +0200
commit57424e94039a0ba4f95686b23fce3d84775bb1c7 (patch)
treea8950e02a1e50f106b04a98d3f21427725bf9853
parent65f3de70ac979b18233f405d2d7d33ac647f7376 (diff)
parent5c00751515ac36ac6edbd7e8890f221f791feafb (diff)
downloadmeson-57424e94039a0ba4f95686b23fce3d84775bb1c7.zip
meson-57424e94039a0ba4f95686b23fce3d84775bb1c7.tar.gz
meson-57424e94039a0ba4f95686b23fce3d84775bb1c7.tar.bz2
Merge pull request #4792 from scivision/flang
Flang Fortran compiler added.
-rw-r--r--docs/markdown/Reference-tables.md1
-rw-r--r--docs/markdown/snippets/flang_fortran_compiler.md3
-rw-r--r--mesonbuild/compilers/__init__.py2
-rw-r--r--mesonbuild/compilers/compilers.py6
-rw-r--r--mesonbuild/compilers/fortran.py14
-rw-r--r--mesonbuild/environment.py4
6 files changed, 28 insertions, 2 deletions
diff --git a/docs/markdown/Reference-tables.md b/docs/markdown/Reference-tables.md
index 9688bf8..a6289df 100644
--- a/docs/markdown/Reference-tables.md
+++ b/docs/markdown/Reference-tables.md
@@ -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 |
diff --git a/docs/markdown/snippets/flang_fortran_compiler.md b/docs/markdown/snippets/flang_fortran_compiler.md
new file mode 100644
index 0000000..d34d6cb
--- /dev/null
+++ b/docs/markdown/snippets/flang_fortran_compiler.md
@@ -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.
diff --git a/mesonbuild/compilers/__init__.py b/mesonbuild/compilers/__init__.py
index b5b2475..b4807c6 100644
--- a/mesonbuild/compilers/__init__.py
+++ b/mesonbuild/compilers/__init__.py
@@ -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,
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 34c0e3b..758b1c3 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -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
diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py
index 2eb4c71..57d1dd9 100644
--- a/mesonbuild/compilers/fortran.py
+++ b/mesonbuild/compilers/fortran.py
@@ -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)
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 0e74851..4f5115f 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -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)