summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkwryankrattiger <80296582+kwryankrattiger@users.noreply.github.com>2022-01-11 15:28:13 -0600
committerGitHub <noreply@github.com>2022-01-11 13:28:13 -0800
commit363a565ce3c15e38d07e339eafd5f59370371309 (patch)
treec69d5426600848a424e6a0e8087c0f467ecb1d7e
parentd4a468c160318642f70ac49ab691fab94f7834b0 (diff)
downloadspack-363a565ce3c15e38d07e339eafd5f59370371309.tar.gz
spack-363a565ce3c15e38d07e339eafd5f59370371309.tar.bz2
spack-363a565ce3c15e38d07e339eafd5f59370371309.tar.xz
spack-363a565ce3c15e38d07e339eafd5f59370371309.zip
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
-rw-r--r--etc/spack/defaults/packages.yaml1
-rw-r--r--var/spack/repos/builtin/packages/llvm-amdgpu/package.py13
-rw-r--r--var/spack/repos/builtin/packages/llvm/package.py12
3 files changed, 26 insertions, 0 deletions
diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml
index aeed54fd08..00da33b10d 100644
--- a/etc/spack/defaults/packages.yaml
+++ b/etc/spack/defaults/packages.yaml
@@ -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]
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