From e1edefa15766cd6b19a93fca31ba8da8000bbad3 Mon Sep 17 00:00:00 2001 From: Scriptkiddi Date: Mon, 21 Feb 2022 13:24:05 +0100 Subject: [PATCH] febio: init at 3.5.1 --- pkgs/development/libraries/febio/default.nix | 55 +++++++++++++++++++ .../libraries/febio/fix-cmake.patch | 26 +++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 83 insertions(+) create mode 100644 pkgs/development/libraries/febio/default.nix create mode 100644 pkgs/development/libraries/febio/fix-cmake.patch diff --git a/pkgs/development/libraries/febio/default.nix b/pkgs/development/libraries/febio/default.nix new file mode 100644 index 000000000000..4d01bf52bf73 --- /dev/null +++ b/pkgs/development/libraries/febio/default.nix @@ -0,0 +1,55 @@ +{ lib, stdenv, fetchFromGitHub, cmake, boost, eigen, libxml2, mpi, python3 +, mklSupport ? true, mkl +}: + +stdenv.mkDerivation rec { + pname = "FEBio"; + version = "3.6"; + + src = fetchFromGitHub { + owner = "febiosoftware"; + repo = pname; + rev = "v${version}"; + sha256 = "187s4lyzr806xla3smq3lsvj3f6wxlhfkban89w0fnyfmfb8w9am"; + }; + + patches = [ + ./fix-cmake.patch # cannot find mkl libraries without this + ]; + + cmakeFlags = lib.optional mklSupport "-DUSE_MKL=On" + ++ lib.optional mklSupport "-DMKLROOT=${mkl}" + ; + + installPhase = '' + runHook preInstall + + mkdir -p $out/include + cp -R lib bin $out/ + cp -R ../FECore \ + ../FEBioFluid \ + ../FEBioLib \ + ../FEBioMech \ + ../FEBioMix \ + ../FEBioOpt \ + ../FEBioPlot \ + ../FEBioXML \ + ../NumCore \ + $out/include + + runHook postInstall + ''; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ boost eigen libxml2 mpi python3 python3.pkgs.numpy ] + ++ lib.optional mklSupport mkl + ; + + meta = { + description = "FEBio Suite Solver"; + license = with lib.licenses; [ mit ]; + homepage = "https://febio.org/"; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ Scriptkiddi ]; + }; +} diff --git a/pkgs/development/libraries/febio/fix-cmake.patch b/pkgs/development/libraries/febio/fix-cmake.patch new file mode 100644 index 000000000000..5af10a0b3962 --- /dev/null +++ b/pkgs/development/libraries/febio/fix-cmake.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -47,7 +47,7 @@ function(findLib libName libDir libOut) + find_library(TEMP NAMES ${libName}.lib ${ARGV3}.lib ${ARGV4}.lib ${ARGV5}.lib ${ARGV6}.lib + PATHS ${${libDir}} NO_DEFAULT_PATH) + else() +- find_library(TEMP NAMES lib${libName}.a lib${ARGV3}.a lib${ARGV4}.a lib${ARGV5}.a lib${ARGV6}.a ++ find_library(TEMP NAMES lib${libName}.a lib${ARGV3}.a lib${ARGV4}.a lib${ARGV5}.a lib${ARGV6}.a lib${libName}.so lib${ARGV3}.so lib${ARGV4}.so lib${ARGV5}.so lib${ARGV6}.so + PATHS ${${libDir}} NO_DEFAULT_PATH) + endif() + +diff --git a/FindDependencies.cmake b/FindDependencies.cmake +index 2d644005f..7261ba923 100644 +--- a/FindDependencies.cmake ++++ b/FindDependencies.cmake +@@ -46,8 +46,8 @@ if(MKLROOT) + NO_DEFAULT_PATH) + + find_library(MKL_OMP_LIB +- NAMES iomp5 iomp5md libiomp5md.lib +- PATHS ${MKLROOT}/../lib ${MKLROOT}/../compiler/lib ++ NAMES libiomp5.so libiomp5 iomp5 iomp5md libiomp5md.lib ++ PATHS ${MKLROOT}/lib ${MKLROOT}/../lib ${MKLROOT}/../compiler/lib + PATH_SUFFIXES "intel64" "intel32" + NO_DEFAULT_PATH + DOC "MKL OMP Library") diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1656f6339188..5cdd3ce12ba4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16523,6 +16523,8 @@ with pkgs; fcl = callPackage ../development/libraries/fcl { }; + febio = callPackage ../development/libraries/febio { }; + ffcast = callPackage ../tools/X11/ffcast { }; fflas-ffpack = callPackage ../development/libraries/fflas-ffpack { };