claw: enable building with oneapi and nag+gcc@10: (#32897)
* claw: enable building when '%oneapi' * claw: enable building when '%nag' is mixed with 'gcc@10:'
This commit is contained in:
parent
4b7836f822
commit
56a2cfd19d
@ -3,6 +3,8 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -61,10 +63,13 @@ class Claw(CMakePackage):
|
|||||||
|
|
||||||
def flag_handler(self, name, flags):
|
def flag_handler(self, name, flags):
|
||||||
if name == "cflags":
|
if name == "cflags":
|
||||||
|
compiler_spec = self.spec.compiler
|
||||||
|
if spack.compilers.is_mixed_toolchain(self.compiler):
|
||||||
|
compiler_spec = self._get_real_compiler_spec("cc") or compiler_spec
|
||||||
if any(
|
if any(
|
||||||
[
|
[
|
||||||
self.spec.compiler.satisfies(s)
|
compiler_spec.satisfies(s)
|
||||||
for s in ["gcc@10:", "clang@11:", "cce@11:", "aocc@3:"]
|
for s in ["gcc@10:", "clang@11:", "cce@11:", "aocc@3:", "oneapi"]
|
||||||
]
|
]
|
||||||
):
|
):
|
||||||
# https://gcc.gnu.org/gcc-10/porting_to.html
|
# https://gcc.gnu.org/gcc-10/porting_to.html
|
||||||
@ -77,3 +82,25 @@ def cmake_args(self):
|
|||||||
args = ["-DOMNI_CONF_OPTION=--with-libxml2=%s" % self.spec["libxml2"].prefix]
|
args = ["-DOMNI_CONF_OPTION=--with-libxml2=%s" % self.spec["libxml2"].prefix]
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
def _get_real_compiler_spec(self, language):
|
||||||
|
lang_compiler = getattr(self.compiler, language)
|
||||||
|
|
||||||
|
if not lang_compiler:
|
||||||
|
return None
|
||||||
|
|
||||||
|
for compiler_name in spack.compilers.supported_compilers():
|
||||||
|
compiler_cls = spack.compilers.class_for_compiler_name(compiler_name)
|
||||||
|
lang_version_fn = getattr(compiler_cls, "{0}_version".format(language))
|
||||||
|
for regexp in compiler_cls.search_regexps(language):
|
||||||
|
if regexp.match(os.path.basename(lang_compiler)):
|
||||||
|
try:
|
||||||
|
detected_version = lang_version_fn(lang_compiler)
|
||||||
|
if detected_version:
|
||||||
|
compiler_version = Version(detected_version)
|
||||||
|
if compiler_version != Version("unknown"):
|
||||||
|
return spack.spec.CompilerSpec(compiler_name, compiler_version)
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
|
||||||
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user