summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/llvm/llvm_python_path.patch14
-rw-r--r--var/spack/repos/builtin/packages/llvm/package.py14
2 files changed, 27 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/llvm/llvm_python_path.patch b/var/spack/repos/builtin/packages/llvm/llvm_python_path.patch
new file mode 100644
index 0000000000..9f821cc365
--- /dev/null
+++ b/var/spack/repos/builtin/packages/llvm/llvm_python_path.patch
@@ -0,0 +1,14 @@
+diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+index dab55707338..6f4c6791141 100644
+--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
++++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+@@ -612,6 +612,9 @@ macro(add_custom_libcxx name prefix)
+ CMAKE_OBJDUMP
+ CMAKE_STRIP
+ CMAKE_SYSROOT
++ PYTHON_EXECUTABLE
++ Python3_EXECUTABLE
++ Python2_EXECUTABLE
+ CMAKE_SYSTEM_NAME)
+ foreach(variable ${PASSTHROUGH_VARIABLES})
+ get_property(is_value_set CACHE ${variable} PROPERTY VALUE SET)
diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py
index 6469f28c03..2f7b62707e 100644
--- a/var/spack/repos/builtin/packages/llvm/package.py
+++ b/var/spack/repos/builtin/packages/llvm/package.py
@@ -225,6 +225,10 @@ class Llvm(CMakePackage, CudaPackage):
# merged in llvm-11.0.0_rc2
patch("lldb_external_ncurses-10.patch", when="@10.0.0:10.99+lldb")
+ # https://github.com/spack/spack/issues/19908
+ # merged in llvm main prior to 12.0.0
+ patch("llvm_python_path.patch", when="@11.0.0")
+
# The functions and attributes below implement external package
# detection for LLVM. See:
#
@@ -365,16 +369,24 @@ class Llvm(CMakePackage, CudaPackage):
def cmake_args(self):
spec = self.spec
+ python = spec['python']
cmake_args = [
"-DLLVM_REQUIRES_RTTI:BOOL=ON",
"-DLLVM_ENABLE_RTTI:BOOL=ON",
"-DLLVM_ENABLE_EH:BOOL=ON",
"-DCLANG_DEFAULT_OPENMP_RUNTIME:STRING=libomp",
- "-DPYTHON_EXECUTABLE:PATH={0}".format(spec["python"].command.path),
+ "-DPYTHON_EXECUTABLE:PATH={0}".format(python.command.path),
"-DLIBOMP_USE_HWLOC:BOOL=ON",
"-DLIBOMP_HWLOC_INSTALL_DIR={0}".format(spec["hwloc"].prefix),
]
+ if python.version >= Version("3.0.0"):
+ cmake_args.append("-DPython3_EXECUTABLE={0}".format(
+ python.command.path))
+ else:
+ cmake_args.append("-DPython2_EXECUTABLE={0}".format(
+ python.command.path))
+
projects = []
if "+cuda" in spec: