llvm based compilers: filter out non-compilers (#45805)
This commit is contained in:
parent
de754c7a47
commit
15413c7258
@ -6,9 +6,10 @@
|
|||||||
from llnl.util import tty
|
from llnl.util import tty
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
from spack.pkg.builtin.llvm import LlvmDetection
|
||||||
|
|
||||||
|
|
||||||
class Aocc(Package, CompilerPackage):
|
class Aocc(Package, LlvmDetection, CompilerPackage):
|
||||||
"""
|
"""
|
||||||
The AOCC compiler system is a high performance, production quality code
|
The AOCC compiler system is a high performance, production quality code
|
||||||
generation tool. The AOCC environment provides various options to developers
|
generation tool. The AOCC environment provides various options to developers
|
||||||
@ -107,8 +108,5 @@ def cfg_files(self):
|
|||||||
with open(join_path(self.prefix.bin, "{}.cfg".format(compiler)), "w") as f:
|
with open(join_path(self.prefix.bin, "{}.cfg".format(compiler)), "w") as f:
|
||||||
f.write(compiler_options)
|
f.write(compiler_options)
|
||||||
|
|
||||||
compiler_version_argument = "--version"
|
|
||||||
compiler_version_regex = r"AOCC_(\d+[._]\d+[._]\d+)"
|
compiler_version_regex = r"AOCC_(\d+[._]\d+[._]\d+)"
|
||||||
c_names = ["clang"]
|
|
||||||
cxx_names = ["clang++"]
|
|
||||||
fortran_names = ["flang"]
|
fortran_names = ["flang"]
|
||||||
|
@ -3,9 +3,10 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
from spack.pkg.builtin.llvm import LlvmDetection
|
||||||
|
|
||||||
|
|
||||||
class AppleClang(BundlePackage, CompilerPackage):
|
class AppleClang(BundlePackage, LlvmDetection, CompilerPackage):
|
||||||
"""Apple's Clang compiler"""
|
"""Apple's Clang compiler"""
|
||||||
|
|
||||||
homepage = "https://developer.apple.com/videos/developer-tools/compiler-and-llvm"
|
homepage = "https://developer.apple.com/videos/developer-tools/compiler-and-llvm"
|
||||||
@ -14,11 +15,7 @@ class AppleClang(BundlePackage, CompilerPackage):
|
|||||||
maintainers("alalazo")
|
maintainers("alalazo")
|
||||||
|
|
||||||
compiler_languages = ["c", "cxx"]
|
compiler_languages = ["c", "cxx"]
|
||||||
c_names = ["clang"]
|
|
||||||
cxx_names = ["clang++"]
|
|
||||||
|
|
||||||
compiler_version_regex = r"^Apple (?:LLVM|clang) version ([^ )]+)"
|
compiler_version_regex = r"^Apple (?:LLVM|clang) version ([^ )]+)"
|
||||||
compiler_version_argument = "--version"
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def validate_detected_spec(cls, spec, extra_attributes):
|
def validate_detected_spec(cls, spec, extra_attributes):
|
||||||
|
@ -13,9 +13,29 @@
|
|||||||
import spack.build_environment
|
import spack.build_environment
|
||||||
import spack.util.executable
|
import spack.util.executable
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
from spack.package_base import PackageBase
|
||||||
|
|
||||||
|
|
||||||
class Llvm(CMakePackage, CudaPackage, CompilerPackage):
|
class LlvmDetection(PackageBase):
|
||||||
|
"""Base class to detect LLVM based compilers"""
|
||||||
|
|
||||||
|
compiler_version_argument = "--version"
|
||||||
|
c_names = ["clang"]
|
||||||
|
cxx_names = ["clang++"]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def filter_detected_exes(cls, prefix, exes_in_prefix):
|
||||||
|
# Executables like lldb-vscode-X are daemon listening on some port and would hang Spack
|
||||||
|
# during detection. clang-cl, clang-cpp, etc. are dev tools that we don't need to test
|
||||||
|
reject = re.compile(
|
||||||
|
r"-(vscode|cpp|cl|gpu|tidy|rename|scan-deps|format|refactor|offload|"
|
||||||
|
r"check|query|doc|move|extdef|apply|reorder|change-namespace|"
|
||||||
|
r"include-fixer|import-test)"
|
||||||
|
)
|
||||||
|
return [x for x in exes_in_prefix if not reject.search(x)]
|
||||||
|
|
||||||
|
|
||||||
|
class Llvm(CMakePackage, CudaPackage, LlvmDetection, CompilerPackage):
|
||||||
"""The LLVM Project is a collection of modular and reusable compiler and
|
"""The LLVM Project is a collection of modular and reusable compiler and
|
||||||
toolchain technologies. Despite its name, LLVM has little to do
|
toolchain technologies. Despite its name, LLVM has little to do
|
||||||
with traditional virtual machines, though it does provide helpful
|
with traditional virtual machines, though it does provide helpful
|
||||||
@ -615,10 +635,6 @@ def patch(self):
|
|||||||
# LLD
|
# LLD
|
||||||
r"LLD ([^ )\n]+) \(compatible with GNU linkers\)"
|
r"LLD ([^ )\n]+) \(compatible with GNU linkers\)"
|
||||||
)
|
)
|
||||||
compiler_version_argument = "--version"
|
|
||||||
compiler_languages = ["c", "cxx", "fortran"]
|
|
||||||
c_names = ["clang"]
|
|
||||||
cxx_names = ["clang++"]
|
|
||||||
fortran_names = ["flang"]
|
fortran_names = ["flang"]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -634,19 +650,6 @@ def supported_languages(self):
|
|||||||
def executables(cls):
|
def executables(cls):
|
||||||
return super().executables + ["ld.lld", "lldb"]
|
return super().executables + ["ld.lld", "lldb"]
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def filter_detected_exes(cls, prefix, exes_in_prefix):
|
|
||||||
result = []
|
|
||||||
for exe in exes_in_prefix:
|
|
||||||
# Executables like lldb-vscode-X are daemon listening
|
|
||||||
# on some port and would hang Spack during detection.
|
|
||||||
# clang-cl and clang-cpp are dev tools that we don't
|
|
||||||
# need to test
|
|
||||||
if any(x in exe for x in ("vscode", "cpp", "-cl", "-gpu")):
|
|
||||||
continue
|
|
||||||
result.append(exe)
|
|
||||||
return result
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def determine_version(cls, exe):
|
def determine_version(cls, exe):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user