mumps: install header files as compiled (#29940)

Co-authored-by: Mathieu Courtois <mathieu.courtois@edf.fr>
This commit is contained in:
mcourtois 2022-04-13 18:45:47 +02:00 committed by GitHub
parent 586df30f9a
commit 10a3822728
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import glob
import os import os
import sys import sys
@ -44,6 +45,8 @@ class Mumps(Package):
description='Activate the compilation of cmumps and/or zmumps') description='Activate the compilation of cmumps and/or zmumps')
variant('int64', default=False, variant('int64', default=False,
description='Use int64_t/integer*8 as default index type') description='Use int64_t/integer*8 as default index type')
variant("incfort", default=False,
description="Use explicit types size in fortran headers")
variant('shared', default=True, description='Build shared libraries') variant('shared', default=True, description='Build shared libraries')
variant('openmp', default=True, variant('openmp', default=True,
description='Compile MUMPS with OpenMP support') description='Compile MUMPS with OpenMP support')
@ -76,6 +79,20 @@ class Mumps(Package):
conflicts('+blr_mt', when='~openmp', conflicts('+blr_mt', when='~openmp',
msg="You cannot use the blr_mt variant without openmp") msg="You cannot use the blr_mt variant without openmp")
@when("+incfort")
def patch(self):
"""Set the effective integer type used during compilation.
Usual usecase: building mumps with int and compiling a program that
includes these headers with '-fdefault-integer-8'.
"""
headers = glob.glob("include/*.h")
intsize = 8 if "+int64" in self.spec else 4
filter_file("INTEGER *,", "INTEGER({0}),".format(intsize), *headers)
filter_file("INTEGER *::", "INTEGER({0}) ::".format(intsize), *headers)
for typ in ("REAL", "COMPLEX", "LOGICAL"):
filter_file("{0} *,".format(typ), "{0}(4),".format(typ), *headers)
filter_file("{0} *::".format(typ), "{0}(4) ::".format(typ), *headers)
def write_makefile_inc(self): def write_makefile_inc(self):
# The makefile variables LIBBLAS, LSCOTCH, LMETIS, and SCALAP are only # The makefile variables LIBBLAS, LSCOTCH, LMETIS, and SCALAP are only
# used to link the examples, so if building '+shared' there is no need # used to link the examples, so if building '+shared' there is no need