diff options
author | Sergey Kosukhin <sergey.kosukhin@mpimet.mpg.de> | 2022-09-29 22:32:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-29 13:32:10 -0700 |
commit | 56a2cfd19db526d26349b15cb8fc470555ab0a95 (patch) | |
tree | cdfe09989529409caf338612ab7ab06d11ce425e | |
parent | 4b7836f822c1d48186984be0b93d709bed318e66 (diff) | |
download | spack-56a2cfd19db526d26349b15cb8fc470555ab0a95.tar.gz spack-56a2cfd19db526d26349b15cb8fc470555ab0a95.tar.bz2 spack-56a2cfd19db526d26349b15cb8fc470555ab0a95.tar.xz spack-56a2cfd19db526d26349b15cb8fc470555ab0a95.zip |
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:'
-rw-r--r-- | var/spack/repos/builtin/packages/claw/package.py | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/claw/package.py b/var/spack/repos/builtin/packages/claw/package.py index 904bdc94b8..60320d97f6 100644 --- a/var/spack/repos/builtin/packages/claw/package.py +++ b/var/spack/repos/builtin/packages/claw/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os + from spack.package import * @@ -61,10 +63,13 @@ class Claw(CMakePackage): def flag_handler(self, name, flags): 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( [ - self.spec.compiler.satisfies(s) - for s in ["gcc@10:", "clang@11:", "cce@11:", "aocc@3:"] + compiler_spec.satisfies(s) + for s in ["gcc@10:", "clang@11:", "cce@11:", "aocc@3:", "oneapi"] ] ): # https://gcc.gnu.org/gcc-10/porting_to.html @@ -77,3 +82,25 @@ class Claw(CMakePackage): args = ["-DOMNI_CONF_OPTION=--with-libxml2=%s" % self.spec["libxml2"].prefix] 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 |