summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNick Forrington <nick.forrington@arm.com>2018-07-16 17:07:28 -0400
committerTodd Gamblin <tgamblin@llnl.gov>2018-11-02 12:53:50 -0700
commit9f5865a68dd74b2a0dbc889dd436757b8881a93f (patch)
tree9a822742d51cd1cdaf6213c6dc7b87272426aa0b /lib
parent36ddcc2e9763af6a479627d0f1344153db8b946a (diff)
downloadspack-9f5865a68dd74b2a0dbc889dd436757b8881a93f.tar.gz
spack-9f5865a68dd74b2a0dbc889dd436757b8881a93f.tar.bz2
spack-9f5865a68dd74b2a0dbc889dd436757b8881a93f.tar.xz
spack-9f5865a68dd74b2a0dbc889dd436757b8881a93f.zip
compilers: add arm compiler detection to Spack
- added arm.py with support for detecting `armclang` and `armflang` Co-authored-by: Srinath Vadlamani <srinath.vadlamani@arm.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/compilers/arm.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/lib/spack/spack/compilers/arm.py b/lib/spack/spack/compilers/arm.py
new file mode 100644
index 0000000000..f80dba7ea1
--- /dev/null
+++ b/lib/spack/spack/compilers/arm.py
@@ -0,0 +1,73 @@
+# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+import re
+
+from spack.compiler import Compiler, _version_cache
+from spack.util.executable import Executable
+
+
+class Arm(Compiler):
+ # Subclasses use possible names of C compiler
+ cc_names = ['armclang']
+
+ # Subclasses use possible names of C++ compiler
+ cxx_names = ['armclang++']
+
+ # Subclasses use possible names of Fortran 77 compiler
+ f77_names = ['armflang']
+
+ # Subclasses use possible names of Fortran 90 compiler
+ fc_names = ['armflang']
+
+ # Named wrapper links within lib/spack/env
+ link_paths = {'cc': 'clang/clang',
+ 'cxx': 'clang/clang++',
+ 'f77': 'clang/flang',
+ 'fc': 'clang/flang'}
+
+ @property
+ def openmp_flag(self):
+ return "-fopenmp"
+
+ @property
+ def cxx11_flag(self):
+ return "-std=c++11"
+
+ @property
+ def cxx14_flag(self):
+ return "-std=c++14"
+
+ @property
+ def cxx17_flag(self):
+ return "-std=c++1z"
+
+ @property
+ def pic_flag(self):
+ return "-fPIC"
+
+ @classmethod
+ def default_version(cls, comp):
+ if comp not in _version_cache:
+ compiler = Executable(comp)
+ output = compiler('--version', output=str, error=str)
+
+ ver = 'unknown'
+ match = re.search(r'Arm C/C++/Fortran Compiler version ([^ )]+)',
+ output)
+ if match:
+ ver = match.group(1)
+
+ _version_cache[comp] = ver
+
+ return _version_cache[comp]
+
+ @classmethod
+ def fc_version(cls, fc):
+ return cls.default_version(fc)
+
+ @classmethod
+ def f77_version(cls, f77):
+ return cls.fc_version(f77)