From f403117f7152b97068188edaedee09d979d4b4c5 Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Wed, 5 Jul 2017 16:19:39 +0200 Subject: libint: factored parts of configure_args into their own functions (#4211) * libint: factored parts of configure_args into their own functions * libint: added -xSSE2, as suggested by @lee218llnl --- var/spack/repos/builtin/packages/libint/package.py | 32 +++++++++++++++------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/libint/package.py b/var/spack/repos/builtin/packages/libint/package.py index 3853d2c57f..d267a8ea88 100644 --- a/var/spack/repos/builtin/packages/libint/package.py +++ b/var/spack/repos/builtin/packages/libint/package.py @@ -61,19 +61,31 @@ class Libint(AutotoolsPackage): aclocal('-I', 'lib/autoconf') autoconf() + @property + def optflags(self): + flags = '-O2' + + # Optimizations for the Intel compiler, suggested by CP2K + if '%intel' in self.spec: + # -xSSE2 will make it usable on old architecture + flags += ' -xSSE2 -xAVX -axCORE-AVX2 -ipo' + + return flags + + def setup_environment(self, build_env, run_env): + # Set optimization flags + build_env.set('CFLAGS', self.optflags) + build_env.set('CXXFLAGS', self.optflags) + + # Change AR to xiar if we compile with Intel and we + # find the executable + if '%intel' in self.spec and which('xiar'): + build_env.set('AR', 'xiar') + def configure_args(self): config_args = ['--enable-shared'] - - # Optimizations for the Intel compiler, suggested by CP2K - optflags = '-O2' - if self.compiler.name == 'intel': - optflags += ' -xAVX -axCORE-AVX2 -ipo' - if which('xiar'): - env['AR'] = 'xiar' - - env['CFLAGS'] = optflags - env['CXXFLAGS'] = optflags + optflags = self.optflags # Optimization flag names have changed in libint 2 if self.version < Version('2.0.0'): -- cgit v1.2.3-70-g09d2