ipopt package: set compiler flags in configure (#6714)

This makes use of the new flag_handler logic from 28d8784a to set
compiler flags for ipopt by passing them as arguments to the build
system rather than injecting them into the compiler wrappers. This
avoids conflicts between flags that are chosen by the build system
and flags that are set by the user.
This commit is contained in:
junkudo 2018-01-18 10:39:08 -08:00 committed by scheibelp
parent 4dd6ee25d6
commit 9704369f17

View File

@ -25,7 +25,7 @@
from spack import * from spack import *
class Ipopt(Package): class Ipopt(AutotoolsPackage):
"""Ipopt (Interior Point OPTimizer, pronounced eye-pea-Opt) is a """Ipopt (Interior Point OPTimizer, pronounced eye-pea-Opt) is a
software package for large-scale nonlinear optimization.""" software package for large-scale nonlinear optimization."""
homepage = "https://projects.coin-or.org/Ipopt" homepage = "https://projects.coin-or.org/Ipopt"
@ -55,7 +55,14 @@ class Ipopt(Package):
patch('ipopt_ppc_build.patch', when='arch=ppc64le') patch('ipopt_ppc_build.patch', when='arch=ppc64le')
def install(self, spec, prefix): flag_handler = AutotoolsPackage.build_system_flags
build_directory = 'spack-build'
# IPOPT does not build correctly in parallel on OS X
parallel = False
def configure_args(self):
spec = self.spec
# Dependency directories # Dependency directories
blas_dir = spec['blas'].prefix blas_dir = spec['blas'].prefix
lapack_dir = spec['lapack'].prefix lapack_dir = spec['lapack'].prefix
@ -69,7 +76,7 @@ def install(self, spec, prefix):
blas_lib = spec['blas'].libs.ld_flags blas_lib = spec['blas'].libs.ld_flags
lapack_lib = spec['lapack'].libs.ld_flags lapack_lib = spec['lapack'].libs.ld_flags
configure_args = [ args = [
"--prefix=%s" % prefix, "--prefix=%s" % prefix,
"--with-mumps-incdir=%s" % mumps_dir.include, "--with-mumps-incdir=%s" % mumps_dir.include,
"--with-mumps-lib=%s" % mumps_libcmd, "--with-mumps-lib=%s" % mumps_libcmd,
@ -82,18 +89,13 @@ def install(self, spec, prefix):
] ]
if 'coinhsl' in spec: if 'coinhsl' in spec:
configure_args.extend([ args.extend([
'--with-hsl-lib=%s' % spec['coinhsl'].libs.ld_flags, '--with-hsl-lib=%s' % spec['coinhsl'].libs.ld_flags,
'--with-hsl-incdir=%s' % spec['coinhsl'].prefix.include]) '--with-hsl-incdir=%s' % spec['coinhsl'].prefix.include])
if 'metis' in spec: if 'metis' in spec:
configure_args.extend([ args.extend([
'--with-metis-lib=%s' % spec['metis'].libs.ld_flags, '--with-metis-lib=%s' % spec['metis'].libs.ld_flags,
'--with-metis-incdir=%s' % spec['metis'].prefix.include]) '--with-metis-incdir=%s' % spec['metis'].prefix.include])
configure(*configure_args) return args
# IPOPT does not build correctly in parallel on OS X
make(parallel=False)
make("test", parallel=False)
make("install", parallel=False)