diff --git a/lib/spack/spack/build_systems/compiler.py b/lib/spack/spack/build_systems/compiler.py index 7526d2e8a3d..fae6e70377b 100644 --- a/lib/spack/spack/build_systems/compiler.py +++ b/lib/spack/spack/build_systems/compiler.py @@ -165,6 +165,8 @@ def determine_variants(cls, exes: Sequence[Path], version_str: str) -> Tuple: #: Flag to activate OpenMP support openmp_flag: str = "-fopenmp" + required_libs: List[str] = [] + def standard_flag(self, *, language: str, standard: str) -> str: """Returns the flag used to enforce a given standard for a language""" if language not in self.supported_languages: @@ -288,6 +290,39 @@ def archspec_name(self) -> str: """Name that archspec uses to refer to this compiler""" return self.spec.name + @property + def cc(self) -> Optional[str]: + assert self.spec.concrete, "cannot retrieve C compiler, spec is not concrete" + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("c", None) + return self._cc_path() + + def _cc_path(self) -> Optional[str]: + """Returns the path to the C compiler, if the package was installed by Spack""" + return None + + @property + def cxx(self) -> Optional[str]: + assert self.spec.concrete, "cannot retrieve C++ compiler, spec is not concrete" + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("cxx", None) + return self._cxx_path() + + def _cxx_path(self) -> Optional[str]: + """Returns the path to the C++ compiler, if the package was installed by Spack""" + return None + + @property + def fortran(self): + assert self.spec.concrete, "cannot retrieve Fortran compiler, spec is not concrete" + if self.spec.external: + return self.spec.extra_attributes["compilers"].get("fortran", None) + return self._fortran_path() + + def _fortran_path(self) -> Optional[str]: + """Returns the path to the Fortran compiler, if the package was installed by Spack""" + return None + def _implicit_rpaths(pkg: spack.package_base.PackageBase) -> List[str]: detector = spack.compilers.libraries.CompilerPropertyDetector(pkg.spec)