From 363a565ce3c15e38d07e339eafd5f59370371309 Mon Sep 17 00:00:00 2001 From: kwryankrattiger <80296582+kwryankrattiger@users.noreply.github.com> Date: Tue, 11 Jan 2022 15:28:13 -0600 Subject: Packaging: Virtual package for libllvm (#27200) Add an abstraction around libllvm to allow libllvm providers to be specified for all packages. This is targeting allowing mesa to build against llvm-amdgpu or intel-llvm or llvm or any other custom llvm variant that arises for specific GPU toolchains --- var/spack/repos/builtin/packages/llvm-amdgpu/package.py | 13 +++++++++++++ var/spack/repos/builtin/packages/llvm/package.py | 12 ++++++++++++ 2 files changed, 25 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py index 90781f8f94..1de450f0bd 100644 --- a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py +++ b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py @@ -35,6 +35,16 @@ class LlvmAmdgpu(CMakePackage): variant('build_type', default='Release', values=("Release", "Debug", "RelWithDebInfo"), description='CMake build type') variant('rocm-device-libs', default=True, description='Build ROCm device libs as external LLVM project instead of a standalone spack package.') variant('openmp', default=True, description='Enable OpenMP') + variant( + "llvm_dylib", + default=False, + description="Build LLVM shared library, containing all " + "components in a single shared library", + ) + + provides('libllvm@11', when='@3.5:3.8') + provides('libllvm@12', when='@3.9:4.2') + provides('libllvm@13', when='@4.3:') depends_on('cmake@3.4.3:', type='build', when='@:3.8') depends_on('cmake@3.13.4:', type='build', when='@3.9.0:') @@ -131,6 +141,9 @@ class LlvmAmdgpu(CMakePackage): self.define('LLVM_EXTERNAL_DEVICE_LIBS_SOURCE_DIR', dir) ]) + if '+llvm_dylib' in self.spec: + cmake_args.append("-DLLVM_BUILD_LLVM_DYLIB:Bool=ON") + # Get the GCC prefix for LLVM. if self.compiler.name == "gcc": compiler = Executable(self.compiler.cc) diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index c23aff0724..1c2255b677 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -170,6 +170,18 @@ class Llvm(CMakePackage, CudaPackage): variant('version_suffix', default='none', description="Add a symbol suffix") variant('z3', default=False, description='Use Z3 for the clang static analyzer') + provides('libllvm@13', when='@13.0.0:13') + provides('libllvm@12', when='@12.0.0:12') + provides('libllvm@11', when='@11.0.0:11') + provides('libllvm@10', when='@10.0.0:10') + provides('libllvm@9', when='@9.0.0:9') + provides('libllvm@8', when='@8.0.0:8') + provides('libllvm@7', when='@7.0.0:7') + provides('libllvm@6', when='@6.0.0:6') + provides('libllvm@5', when='@5.0.0:5') + provides('libllvm@4', when='@4.0.0:4') + provides('libllvm@3', when='@3.0.0:3') + extends("python", when="+python") # Build dependency -- cgit v1.2.3-60-g2f50