More template filtering

This commit is contained in:
Adam J. Stewart 2016-06-15 09:33:13 -05:00
parent 9cf1257be4
commit 7b97ea248a

View File

@ -73,12 +73,12 @@ def install(self, spec, prefix):
cmake('..', *cmake_args) cmake('..', *cmake_args)
make() make()
# ctest() ctest()
make('install') make('install')
self.filter_compilers() self.filter_compilers(spec)
def filter_compilers(self): def filter_compilers(self, spec):
"""Run after install to tell the configuration files to """Run after install to tell the configuration files to
use the compilers that Spack built the package with. use the compilers that Spack built the package with.
@ -90,6 +90,7 @@ def filter_compilers(self):
cc_files = ['bin/psi4-config'] cc_files = ['bin/psi4-config']
cxx_files = ['bin/psi4-config', 'include/psi4/psiconfig.h'] cxx_files = ['bin/psi4-config', 'include/psi4/psiconfig.h']
template = 'share/psi4/plugin/Makefile.template'
for filename in cc_files: for filename in cc_files:
filter_file(os.environ['CC'], self.compiler.cc, filter_file(os.environ['CC'], self.compiler.cc,
@ -98,3 +99,22 @@ def filter_compilers(self):
for filename in cxx_files: for filename in cxx_files:
filter_file(os.environ['CXX'], self.compiler.cxx, filter_file(os.environ['CXX'], self.compiler.cxx,
os.path.join(self.prefix, filename), **kwargs) os.path.join(self.prefix, filename), **kwargs)
# The binary still keeps track of the compiler used to install Psi4
# and uses it when creating a plugin template
filter_file('@PLUGIN_CXX@', self.compiler.cxx,
os.path.join(self.prefix, template), **kwargs)
# The binary links to the build include directory instead of the
# installation include directory:
# https://github.com/psi4/psi4/issues/410
filter_file('@PLUGIN_INCLUDES@', '-I{0}'.format(
' -I'.join(
spec['psi4'].prefix.include,
spec['boost'].prefix.include,
spec['lapack'].prefix.include,
spec['blas'].prefix.include,
spec['python'].prefix.include,
'/usr/include'
)
), os.path.join(self.prefix, template), **kwargs)