Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 0 additions & 62 deletions pkgs/applications/science/biology/febio-studio/default.nix

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion pkgs/applications/science/geometry/tetgen/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ stdenv.mkDerivation rec {
mainProgram = "tetgen";
homepage = "http://tetgen.org/";
license = lib.licenses.agpl3Plus;
platforms = lib.platforms.linux;
platforms = lib.platforms.unix;
};
}
14 changes: 14 additions & 0 deletions pkgs/by-name/fe/febio-studio/cmake-install.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7ad2c68eb2..0e3e978bd9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -449,6 +449,9 @@
set_property(TARGET ${FBS_BIN_NAME} PROPERTY AUTOGEN_BUILD_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/AutoGen/FEBioStudio_autogen)
endif()

+include(GNUInstallDirs)
+install(TARGETS ${FBS_BIN_NAME} BUNDLE DESTINATION Applications)
+
macro(addLib name)
add_library(${name} ${HDR_${name}} ${SRC_${name}})
set_property(TARGET ${name} PROPERTY AUTOGEN_BUILD_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/AutoGen/${name}_autogen)
89 changes: 89 additions & 0 deletions pkgs/by-name/fe/febio-studio/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
lib,
stdenv,
overrideSDK,
fetchFromGitHub,
cmake,
ninja,
zlib,
libGLU,
qt6Packages,
febio,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed that this derivation builds with febio = febio.override { mklSupport = false; }

glew,
sshSupport ? true,
openssl,
libssh,
tetgenSupport ? true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed that this builds with tetgenSupport set to false

tetgen,
ffmpegSupport ? true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed that this builds with ffmpegSupport set to false

ffmpeg_7,
dicomSupport ? false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed that this builds with dicomSupport set to true

dcmtk,
withModelRepo ? true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed that this builds with withModelRepo set to false

withCadFeatures ? false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed that this builds with withCadFeatures set to true

}:

let
stdenv' =
if stdenv.isDarwin then
overrideSDK stdenv {
darwinSdkVersion = "11.0";
darwinMinVersion = "10.15";
}
else
stdenv;
in

stdenv'.mkDerivation (finalAttrs: {
pname = "febio-studio";
version = "2.7";

src = fetchFromGitHub {
owner = "febiosoftware";
repo = "FEBioStudio";
rev = "v${finalAttrs.version}";
hash = "sha256-ggIzz6bvNjqlI8s31EVnbM0TOspBSc9/myKpWukS3MU=";
};

patches = [ ./cmake-install.patch ];

cmakeFlags =
[ (lib.cmakeFeature "Qt_Root" "${qt6Packages.qtbase}") ]
++ lib.optional sshSupport "-DUSE_SSH=On"
++ lib.optional tetgenSupport "-DUSE_TETGEN=On"
++ lib.optional ffmpegSupport "-DUSE_FFMPEG=On"
++ lib.optional dicomSupport "-DUSE_DICOM=On"
++ lib.optional withModelRepo "-DMODEL_REPO=On"
++ lib.optional withCadFeatures "-DCAD_FEATURES=On";

nativeBuildInputs = [
cmake
ninja
qt6Packages.wrapQtAppsHook
];

buildInputs =
[
zlib
libGLU
glew
qt6Packages.qtbase
febio
]
++ lib.optionals sshSupport [
openssl
libssh
]
++ lib.optional tetgenSupport tetgen
++ lib.optional ffmpegSupport ffmpeg_7
++ lib.optional dicomSupport dcmtk;

meta = {
description = "FEBio Suite Solver";
mainProgram = "FEBioStudio";
license = with lib.licenses; [ mit ];
homepage = "https://febio.org/";
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ Scriptkiddi ];
};
})
71 changes: 71 additions & 0 deletions pkgs/by-name/fe/febio/fix-cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c1bc953edf..f6aaf92fb5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,6 +2,7 @@
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
mark_as_advanced(FORCE CMAKE_INSTALL_PREFIX)
+include(GNUInstallDirs)

project(FEBio)
set(FEBIO_LIBS FEBioFluid FEBioLib FEBioMech FEBioMix FEBioOpt FECore NumCore FEAMR FEBioRVE FEImgLib)
@@ -51,7 +52,7 @@
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()

@@ -154,7 +155,7 @@
##### Find Source Files #####

macro(findHdrSrc name)
- file(GLOB HDR_${name} "${name}/*.h")
+ file(GLOB HDR_${name} "${name}/*.h" "${name}/*.hpp")
file(GLOB SRC_${name} "${name}/*.cpp")
endmacro()

@@ -171,8 +172,9 @@

macro(addLib name TYPE)
string(TOLOWER ${name} lname)
- add_library(${lname} ${TYPE} ${HDR_${name}} ${SRC_${name}})
+ add_library(${lname} ${TYPE} ${SRC_${name}})
set_property(TARGET ${lname} PROPERTY AUTOGEN_BUILD_DIR ${CMAKE_BINARY_DIR}/CMakeFiles/AutoGen/${name}_autogen)
+ target_sources(${lname} PUBLIC FILE_SET HEADERS TYPE HEADERS FILES ${HDR_${name}})

if(NOT WIN32)
set_property(TARGET ${lname} PROPERTY POSITION_INDEPENDENT_CODE ON)
@@ -181,6 +183,8 @@
if(APPLE)
target_link_libraries(${lname} PRIVATE "-undefined dynamic_lookup")
endif()
+
+ install(TARGETS ${lname} FILE_SET HEADERS)
endmacro()

foreach(name IN LISTS FEBIO_LIBS)
@@ -194,6 +198,7 @@
##### Set up executable compilation #####
file(GLOB SOURCES "FEBio/*.cpp")
add_executable (febio4 ${SOURCES})
+install(TARGETS febio4)

if(WIN32)
target_compile_options(febio4 PRIVATE /openmp)
@@ -269,7 +274,6 @@
mark_as_advanced(EXTRA_INC)

##### Setup includes, defnitions, and linking options #####
-include_directories(${PROJECT_SOURCE_DIR})

# Link LEVMAR
if(USE_LEVMAR)
@@ -438,3 +442,4 @@
file(WRITE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/febio.xml "${filedata}")
endif()

+install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/febio.xml TYPE BIN)
72 changes: 72 additions & 0 deletions pkgs/by-name/fe/febio/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
lib,
stdenv,
overrideSDK,
fetchFromGitHub,
fetchpatch2,
substituteAll,
cmake,
ninja,
zlib,
darwin,
mklSupport ? true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with mklSupport off on x86_64-linux; builds.

I know it's in the previous version, but this does make febio a mixed free/non-free derivation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I get the impression that you’re really just meant to use it:

FEBio requires the Intel Math Kernel Library (MKL) in order to utilize the Pardiso linear solver and some of the iterative linear solvers. This library can be downloaded as part of the Intel oneAPI Base Toolkit from Intel's website: https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit.html. In the absence of MKL, FEBio will default to using the Skyline linear solver. However, the Pardiso solver is significantly faster and more memory-efficient than the Skyline solver, and it is strongly recommended that the Pardiso solver be used.

mkl,
}:

let
stdenv' = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv;
in

stdenv'.mkDerivation (finalAttrs: {
pname = "FEBio";
version = "4.7";

src = fetchFromGitHub {
owner = "febiosoftware";
repo = "FEBio";
rev = "v${finalAttrs.version}";
hash = "sha256-RRdIOyXg4jYW76ABfJdMfVtCYMLYFdvyOI98nHXCof8=";
};

patches = [
# Fix library searching and installation
(substituteAll {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated: #237216, #301350

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointers! #301350 looks interesting. This is just inherited from the previous version of the derivation, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, hence "unrelated" -- no expectation for you to take any action.

src = ./fix-cmake.patch;
so = stdenv.hostPlatform.extensions.sharedLibrary;
})

# Fixed missing header include for strcpy
# https://github.com/febiosoftware/FEBio/pull/92
(fetchpatch2 {
url = "https://github.com/febiosoftware/FEBio/commit/ad9e80e2aa8737828855458a703822f578db2fd3.patch?full_index=1";
hash = "sha256-/uLnJB/oAwLQnsZtJnUlaAEpyZVLG6o2riRwwMCH8rI=";
})
];

cmakeFlags = lib.optionals mklSupport [
(lib.cmakeBool "USE_MKL" true)
(lib.cmakeFeature "MKLROOT" "${mkl}")
];

nativeBuildInputs = [
cmake
ninja
];

buildInputs =
[ zlib ]
++ lib.optionals mklSupport [ mkl ]
++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreGraphics
darwin.apple_sdk.frameworks.CoreVideo
darwin.apple_sdk.frameworks.Accelerate
];

meta = {
description = "FEBio Suite Solver";
license = with lib.licenses; [ mit ];
homepage = "https://febio.org/";
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ Scriptkiddi ];
};
})
Loading