Skip to content

Commit

Permalink
mfem: init at 4.7
Browse files Browse the repository at this point in the history
Init mfem built with optional dependencies mpi, suitesparse, mumps_par.
  • Loading branch information
qbisi committed Nov 4, 2024
1 parent be83f52 commit 7295c0c
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions pkgs/by-name/mf/mfem/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
gfortran,
mpi,
mpiSupport ? true,
mpiCheckPhaseHook,
blas,
hypre,
metis,
suitesparse,
withSuiteSparse ? mpiSupport,
mumps_par,
withMumps ? mpiSupport,
}:
assert withSuiteSparse -> mpiSupport;
assert withMumps -> mpiSupport;
stdenv.mkDerivation (finalAttrs: {
pname = "mfem";
version = "4.7";

src = fetchFromGitHub {
owner = "mfem";
repo = "mfem";
rev = "v${finalAttrs.version}";
hash = "sha256-NJI8ABsfnnzMETfyscpNX8qK72BFF9FfxsY0J48aRtg=";
};

enableParallelBuilding = true;

nativeBuildInputs = [
cmake
gfortran
] ++ lib.optional mpiSupport mpi;

buildInputs =
lib.optionals mpiSupport [
blas
hypre
metis
]
++ lib.optional withSuiteSparse suitesparse
++ lib.optionals withMumps ([ mumps_par ] ++ mumps_par.buildInputs);

cmakeFlags = [
(lib.cmakeBool "MFEM_ENABLE_TESTING" finalAttrs.finalPackage.doCheck)
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "MFEM_USE_MPI" mpiSupport)
(lib.cmakeBool "MFEM_USE_SUITESPARSE" withSuiteSparse)
(lib.cmakeBool "MFEM_USE_MUMPS" withMumps)
(lib.cmakeFeature "MUMPS_REQUIRED_PACKAGES" (
lib.concatStringsSep ";" (
[
"MPI"
"MPI_Fortran"
"METIS"
"ScaLAPACK"
"LAPACK"
"BLAS"
]
++ lib.optional mumps_par.withParmetis "ParMETIS"
)
))
];

doCheck = true;

nativeCheckInputs = lib.optional mpiSupport mpiCheckPhaseHook;

passthru = {
inherit
mpi
mpiSupport
withSuiteSparse
withMumps
;
};

meta = {
description = "Free, lightweight, scalable C++ library for finite element methods";
homepage = "https://mfem.org";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ qbisi ];
platforms = lib.platforms.linux;
};
})

0 comments on commit 7295c0c

Please sign in to comment.