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
This commit is contained in:
kwryankrattiger 2022-01-11 15:28:13 -06:00 committed by GitHub
parent d4a468c160
commit 363a565ce3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 0 deletions

View file

@ -34,6 +34,7 @@ packages:
java: [openjdk, jdk, ibm-java]
jpeg: [libjpeg-turbo, libjpeg]
lapack: [openblas, amdlibflame]
libllvm: [llvm, llvm-amdgpu]
lua-lang: [lua, lua-luajit]
mariadb-client: [mariadb-c-client, mariadb]
mkl: [intel-mkl]

View file

@ -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 @@ def cmake_args(self):
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)

View file

@ -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