Skip to content
Snippets Groups Projects
Commit 92c45674 authored by Tiziano Müller's avatar Tiziano Müller Committed by Peter Scheibel
Browse files

elpa: override headers prop for common include-dir localization

... and apply this in SIRIUS, CP2K & QE.

Thanks to @scheibelp for the idea.
parent f87722b7
Branches
Tags
No related merge requests found
...@@ -284,13 +284,9 @@ def edit(self, spec, prefix): ...@@ -284,13 +284,9 @@ def edit(self, spec, prefix):
if '+elpa' in self.spec: if '+elpa' in self.spec:
elpa = spec['elpa'] elpa = spec['elpa']
elpa_suffix = '_openmp' if '+openmp' in elpa else '' elpa_suffix = '_openmp' if '+openmp' in elpa else ''
elpa_base_path = os.path.join( elpa_incdir = elpa.headers.directories[0]
elpa.prefix,
'include',
'elpa{suffix}-{version!s}'.format(
suffix=elpa_suffix, version=elpa.version))
fcflags.append('-I' + os.path.join(elpa_base_path, 'modules')) fcflags += ['-I{0}'.format(os.path.join(elpa_incdir, 'modules'))]
libs.append(os.path.join(elpa.libs.directories[0], libs.append(os.path.join(elpa.libs.directories[0],
('libelpa{elpa_suffix}.{dso_suffix}' ('libelpa{elpa_suffix}.{dso_suffix}'
.format(elpa_suffix=elpa_suffix, .format(elpa_suffix=elpa_suffix,
...@@ -307,7 +303,7 @@ def edit(self, spec, prefix): ...@@ -307,7 +303,7 @@ def edit(self, spec, prefix):
cppflags.append('-D__ELPA={0}{1:02d}' cppflags.append('-D__ELPA={0}{1:02d}'
.format(elpa.version[0], .format(elpa.version[0],
int(elpa.version[1]))) int(elpa.version[1])))
fcflags.append('-I' + os.path.join(elpa_base_path, 'elpa')) fcflags += ['-I{0}'.format(os.path.join(elpa_incdir, 'elpa'))]
if self.spec.satisfies('+sirius'): if self.spec.satisfies('+sirius'):
sirius = spec['sirius'] sirius = spec['sirius']
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import * from spack import *
...@@ -43,6 +45,18 @@ def libs(self): ...@@ -43,6 +45,18 @@ def libs(self):
libname, root=self.prefix, shared=True, recursive=True libname, root=self.prefix, shared=True, recursive=True
) )
@property
def headers(self):
suffix = '_openmp' if self.spec.satisfies('+openmp') else ''
incdir = os.path.join(
self.spec.prefix.include,
'elpa{suffix}-{version!s}'.format(
suffix=suffix, version=self.spec.version))
hlist = find_all_headers(incdir)
hlist.directories = [incdir]
return hlist
build_directory = 'spack-build' build_directory = 'spack-build'
def setup_environment(self, spack_env, run_env): def setup_environment(self, spack_env, run_env):
......
...@@ -217,13 +217,13 @@ def install(self, spec, prefix): ...@@ -217,13 +217,13 @@ def install(self, spec, prefix):
# Spec for elpa # Spec for elpa
elpa = spec['elpa'] elpa = spec['elpa']
# Find where the Fortran module resides
elpa_module = find(elpa.prefix, 'elpa.mod')
# Compute the include directory from there: versions # Compute the include directory from there: versions
# of espresso prior to 6.1 requires -I in front of the directory # of espresso prior to 6.1 requires -I in front of the directory
elpa_include = '' if '@6.1:' in spec else '-I' elpa_include = '' if '@6.1:' in spec else '-I'
elpa_include += os.path.dirname(elpa_module[0]) elpa_include += os.path.join(
elpa.headers.directories[0],
'modules'
)
options.extend([ options.extend([
'--with-elpa-include={0}'.format(elpa_include), '--with-elpa-include={0}'.format(elpa_include),
......
...@@ -81,15 +81,10 @@ def _def(variant, flag=None): ...@@ -81,15 +81,10 @@ def _def(variant, flag=None):
] ]
if self.spec.satisfies('+elpa'): if self.spec.satisfies('+elpa'):
elpa = self.spec['elpa']
elpa_suffix = '_openmp' if elpa.satisfies('+openmp') else ''
elpa_incdir = os.path.join( elpa_incdir = os.path.join(
elpa.prefix, self.spec['elpa'].headers.directories[0],
'include', 'elpa'
'elpa{suffix}-{version!s}'.format( )
suffix=elpa_suffix, version=elpa.version),
'elpa')
args += ["-DELPA_INCLUDE_DIR={0}".format(elpa_incdir)] args += ["-DELPA_INCLUDE_DIR={0}".format(elpa_incdir)]
return args return args
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment