QMCPACK CMake fix (#11212)

* cflags and cxxflags from packages.yaml need to be passed into QMCPACK's CMake explictly for now.

* You need the ifcore library from the Intel compler to be manually linked in when you linked against a LAPACK provider that is not MKL.
This commit is contained in:
Nichols A. Romero 2019-04-18 13:00:24 -05:00 committed by Massimiliano Culpo
parent c7725e9ff8
commit eb7c79720d

View file

@ -180,6 +180,26 @@ def cmake_args(self):
spec = self.spec spec = self.spec
args = [] args = []
# This bit of code is needed in order to pass compiler.yaml flags
# into the QMCPACK's CMake. Probably the CMake base class in
# the code of Spack should be doing this instead. Otherwise, it
# it would need to be done on a per package basis which is
# problematic.
cflags = spec.compiler_flags['cflags']
cxxflags = spec.compiler_flags['cxxflags']
args.append('-DCMAKE_C_FLAGS=%s' % ' '.join(cflags))
args.append('-DCMAKE_CXX_FLAGS=%s' % ' '.join(cxxflags))
# This issue appears specifically with the the Intel compiler,
# but may be an issue with other compilers as well. The final fix
# probably needs to go into QMCPACK's CMake instead of in Spack.
# QMCPACK binaries are linked with the C++ compiler, but *may* contain
# Fortran libraries such as NETLIB-LAPACK and OpenBLAS on the link
# line. For the case of the Intel C++ compiler, we need to manually
# add a libray from the Intel Fortran compiler.
if '%intel' in spec:
args.append('-DQMC_EXTRA_LIBS=-lifcore')
if '+mpi' in spec: if '+mpi' in spec:
mpi = spec['mpi'] mpi = spec['mpi']
args.append('-DCMAKE_C_COMPILER={0}'.format(mpi.mpicc)) args.append('-DCMAKE_C_COMPILER={0}'.format(mpi.mpicc))