diff options
Diffstat (limited to 'var/spack/repos/builtin/packages/dihydrogen/package.py')
-rw-r--r-- | var/spack/repos/builtin/packages/dihydrogen/package.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/dihydrogen/package.py b/var/spack/repos/builtin/packages/dihydrogen/package.py index c25653bcb3..03a3f8f671 100644 --- a/var/spack/repos/builtin/packages/dihydrogen/package.py +++ b/var/spack/repos/builtin/packages/dihydrogen/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os from spack import * @@ -110,6 +111,8 @@ class Dihydrogen(CMakePackage, CudaPackage): depends_on('py-breathe', type='build', when='+docs') depends_on('doxygen', type='build', when='+docs') + depends_on('llvm-openmp', when='%apple-clang +openmp') + illegal_cuda_arch_values = [ '10', '11', '12', '13', '20', '21', @@ -159,4 +162,26 @@ class Dihydrogen(CMakePackage, CudaPackage): args.append('-DCUB_DIR={0}'.format( spec['cub'].prefix)) + # Add support for OpenMP with external (Brew) clang + if spec.satisfies('%clang +openmp platform=darwin'): + clang = self.compiler.cc + clang_bin = os.path.dirname(clang) + clang_root = os.path.dirname(clang_bin) + args.extend([ + '-DOpenMP_CXX_FLAGS=-fopenmp=libomp', + '-DOpenMP_CXX_LIB_NAMES=libomp', + '-DOpenMP_libomp_LIBRARY={0}/lib/libomp.dylib'.format( + clang_root)]) + return args + + def setup_build_environment(self, env): + if self.spec.satisfies('%apple-clang +openmp'): + env.append_flags( + 'CPPFLAGS', self.compiler.openmp_flag) + env.append_flags( + 'CFLAGS', self.spec['llvm-openmp'].headers.include_flags) + env.append_flags( + 'CXXFLAGS', self.spec['llvm-openmp'].headers.include_flags) + env.append_flags( + 'LDFLAGS', self.spec['llvm-openmp'].libs.ld_flags) |