From d6ba623669d4fe747842a57c9a1e4d41c1fb59df Mon Sep 17 00:00:00 2001 From: eugeneswalker <38933153+eugeneswalker@users.noreply.github.com> Date: Sun, 10 Jan 2021 10:57:28 -0800 Subject: [PATCH] llvm-amdgpu: add variant: openmp (bool) (#20759) --- .../repos/builtin/packages/llvm-amdgpu/package.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py index 0973976cd6..80a9139cd2 100644 --- a/var/spack/repos/builtin/packages/llvm-amdgpu/package.py +++ b/var/spack/repos/builtin/packages/llvm-amdgpu/package.py @@ -25,12 +25,15 @@ class LlvmAmdgpu(CMakePackage): variant('build_type', default='Release', values=("Release", "Debug"), description='CMake build type') + variant('openmp', default=True, description='Enable OpenMP') + depends_on('cmake@3.4.3:', type='build', when='@:3.8.99') depends_on('cmake@3.13.4:', type='build', when='@3.9.0:') depends_on('python', type='build') depends_on('z3', type='link') depends_on('zlib', type='link') depends_on('ncurses+termlib', type='link') + depends_on('libelf', type='link', when='+openmp') # Will likely only be fixed in LLVM 12 upstream patch('fix-system-zlib-ncurses.patch', when='@3.5.0:3.8.0') @@ -43,8 +46,18 @@ class LlvmAmdgpu(CMakePackage): install_targets = ['clang-tidy', 'install'] def cmake_args(self): + llvm_projects = [ + 'clang', + 'lld', + 'clang-tools-extra', + 'compiler-rt' + ] + + if '+openmp' in self.spec: + llvm_projects.append('openmp') + args = [ - '-DLLVM_ENABLE_PROJECTS=clang;lld;clang-tools-extra;compiler-rt', + '-DLLVM_ENABLE_PROJECTS={0}'.format(';'.join(llvm_projects)), '-DLLVM_ENABLE_ASSERTIONS=1' ]