Update llvm recipe regarding libomptarget. (#36675)

This commit is contained in:
Ye Luo 2023-05-16 04:20:02 -05:00 committed by GitHub
parent c47b554fa1
commit 54003d4d72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,11 +88,6 @@ class Llvm(CMakePackage, CudaPackage):
description="Build the LLVM Fortran compiler frontend "
"(experimental - parser only, needs GCC)",
)
variant(
"omp_debug",
default=False,
description="Include debugging code in OpenMP runtime libraries",
)
variant("lldb", default=True, when="+clang", description="Build the LLVM debugger")
variant("lld", default=True, description="Build the LLVM linker")
variant("mlir", default=False, when="@10:", description="Build with MLIR support")
@ -107,6 +102,18 @@ class Llvm(CMakePackage, CudaPackage):
variant(
"libcxx", default=True, when="+clang", description="Build the LLVM C++ standard library"
)
variant(
"libomptarget",
default=True,
when="+clang",
description="Build the OpenMP offloading library",
)
variant(
"omp_debug",
default=False,
when="+libomptarget",
description="Include debugging code in OpenMP runtime libraries",
)
variant(
"compiler-rt",
when="+clang",
@ -132,7 +139,7 @@ class Llvm(CMakePackage, CudaPackage):
)
variant(
"targets",
default="none",
default="all",
description=(
"What targets to build. Spack's target family is always added "
"(e.g. X86 is automatically enabled when targeting znver2)."
@ -230,7 +237,7 @@ class Llvm(CMakePackage, CudaPackage):
depends_on("hwloc")
depends_on("hwloc@2.0.1:", when="@9:")
depends_on("elf", when="+cuda") # libomptarget
depends_on("libffi", when="+cuda") # libomptarget
depends_on("libffi", when="+libomptarget") # libomptarget
# llvm-config --system-libs libraries.
depends_on("zlib")
@ -272,6 +279,15 @@ class Llvm(CMakePackage, CudaPackage):
conflicts("%clang@:10", when="@13:+libcxx")
conflicts("%apple-clang@:11", when="@13:+libcxx")
# libomptarget
conflicts("+cuda", when="@15:") # +cuda variant is obselete since LLVM 15
conflicts(
"targets=none",
when="+libomptarget",
msg="Non-host backends needed for offloading, set targets=all",
)
conflicts("~lld", when="+libomptarget")
# cuda_arch value must be specified
conflicts("cuda_arch=none", when="+cuda", msg="A value for cuda_arch must be specified.")
@ -644,6 +660,11 @@ def cmake_args(self):
else:
projects.append("openmp")
if "+libomptarget" in spec:
cmake_args.append(define("OPENMP_ENABLE_LIBOMPTARGET", True))
else:
cmake_args.append(define("OPENMP_ENABLE_LIBOMPTARGET", False))
if "@8" in spec:
cmake_args.append(from_variant("CLANG_ANALYZER_ENABLE_Z3_SOLVER", "z3"))
elif "@9:" in spec: