Skip to content

Commit 591a371

Browse files
committed
Help petsc detect the correct hypre when using build_with.
1 parent 95bb42a commit 591a371

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

pkgs/petsc/petsc.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def configure(ctx, stage_args):
3636
coptflags: -O2
3737
link: shared
3838
debug: false
39-
39+
4040
Note: this is a fairly sophisticated build stage that inspects
4141
the build artifacts available to decide what to enable in PETSc.
4242
By default, this package builds PETSc with all required artifacts,
@@ -64,7 +64,7 @@ def configure(ctx, stage_args):
6464
if stage_args['coptflags']:
6565
conf_lines.append('COPTFLAGS=%s' % stage_args['coptflags'])
6666
if stage_args['link']:
67-
conf_lines.append('--with-shared-libraries=%d' %
67+
conf_lines.append('--with-shared-libraries=%d' %
6868
bool(stage_args['link'] == 'shared'))
6969
# must explicitly set --with-debugging=0 to disable debugging
7070
conf_lines.append('--with-debugging=%d' % stage_args['debug'])
@@ -83,7 +83,7 @@ def configure(ctx, stage_args):
8383
conf_lines.append('--with-blas-dir=$BLAS_DIR')
8484
conf_lines.append('--with-lapack-dir=$LAPACK_DIR')
8585

86-
# Special case, ParMETIS also provides METIS
86+
# Special case, ParMETIS also provides METIS
8787
if 'PARMETIS' in ctx.dependency_dir_vars:
8888
conf_lines.append('--with-metis-dir=$PARMETIS_DIR')
8989
conf_lines.append('--with-parmetis-dir=$PARMETIS_DIR')
@@ -108,8 +108,17 @@ def configure(ctx, stage_args):
108108
conf_lines.append('--with-suitesparse-include=${SUITESPARSE_DIR}/include/suitesparse')
109109
conf_lines.append('--with-suitesparse-lib=[${SUITESPARSE_DIR}/lib/libumfpack.a,libklu.a,libcholmod.a,libbtf.a,libccolamd.a,libcolamd.a,libcamd.a,libamd.a,libsuitesparseconfig.a]')
110110

111+
if 'HYPRE' in ctx.dependency_dir_vars:
112+
if ctx.parameters['platform'] == 'Darwin':
113+
libHYPRE = '${HYPRE_DIR}/lib/libHYPRE.dylib'
114+
else:
115+
libHYPRE = '${HYPRE_DIR}/lib/libHYPRE.so'
116+
conf_lines.append('--with-hypre=1')
117+
conf_lines.append('--with-hypre-include=${HYPRE_DIR}/include')
118+
conf_lines.append('--with-hypre-lib=%s' % libHYPRE)
119+
111120
for dep_var in ctx.dependency_dir_vars:
112-
if dep_var in ['BLAS', 'LAPACK', 'OPENBLAS', 'PARMETIS',
121+
if dep_var in ['BLAS', 'HYPRE', 'LAPACK', 'OPENBLAS', 'PARMETIS',
113122
'SCOTCH', 'TRILINOS', 'SUITESPARSE']:
114123
continue
115124
if dep_var == 'MPI':
@@ -123,7 +132,7 @@ def configure(ctx, stage_args):
123132
else:
124133
conf_lines.append('--with-fc=0')
125134
continue
126-
conf_lines.append('--with-%s-dir=$%s_DIR' %
135+
conf_lines.append('--with-%s-dir=$%s_DIR' %
127136
(dep_var.lower(),
128137
dep_var))
129138
for package in stage_args['download']:

0 commit comments

Comments
 (0)