opensplat: 1.1.2 -> 1.1.3

This commit is contained in:
Julius Michaelis 2024-04-30 22:13:19 +09:00
parent 507aeeb037
commit a43dc6418a

View File

@ -4,13 +4,13 @@
cmake,
ninja,
fetchFromGitHub,
fetchpatch,
python3,
opencv,
nlohmann_json,
nanoflann,
glm,
cxxopts,
nix-update-script,
config,
# Upstream has rocm/hip support, too. anyone?
cudaSupport ? config.cudaSupport,
@ -18,7 +18,7 @@
autoAddDriverRunpath,
}:
let
version = "1.1.2";
version = "1.1.3";
torch = python3.pkgs.torch.override { inherit cudaSupport; };
# Using a normal stdenv with cuda torch gives
# ld: /nix/store/k1l7y96gv0nc685cg7i3g43i4icmddzk-python3.11-torch-2.2.1-lib/lib/libc10.so: undefined reference to `std::ios_base_library_init()@GLIBCXX_3.4.32'
@ -32,25 +32,12 @@ stdenv'.mkDerivation {
owner = "pierotofy";
repo = "OpenSplat";
rev = "refs/tags/v${version}";
hash = "sha256-3tk62b5fSf6wzuc5TwkdfAKgUMrw3ZxetCJa2RVMS/s=";
hash = "sha256-2NcKb2SWU/vNsnd2KhdU85J60fJPuc44ZxIle/1UT6g=";
};
patches = [
(fetchpatch {
name = "install-executables.patch";
url = "https://github.com/pierotofy/OpenSplat/commit/b4c4176819b508978583b7ebf66306171807a8e6.patch";
hash = "sha256-BUgPMcO3lt3ZEzv24u36k3aTEIoloOhxrCGi1KQ5Epk=";
})
];
postPatch = ''
# the two vendored gsplats are so heavily modified they may be considered a fork
find vendor ! -name 'gsplat*' -maxdepth 1 -mindepth 1 -exec rm -rf {} +
mkdir vendor/{nanoflann,glm}
ln -s ${glm}/include/glm vendor/glm/glm
ln -s ${nanoflann}/include/nanoflann.hpp vendor/nanoflann/nanoflann.hpp
ln -s ${nlohmann_json}/include/nlohmann vendor/json
ln -s ${cxxopts}/include/cxxopts.hpp vendor/cxxopts.hpp
substituteInPlace CMakeLists.txt \
--replace-fail glm::glm-header-only glm::glm
'';
nativeBuildInputs = [
@ -63,6 +50,9 @@ stdenv'.mkDerivation {
buildInputs = [
nlohmann_json
nanoflann
glm
cxxopts
torch.cxxdev
torch
opencv
@ -74,15 +64,23 @@ stdenv'.mkDerivation {
cmakeFlags = [
(lib.cmakeBool "CMAKE_SKIP_RPATH" true)
(lib.cmakeFeature "FETCHCONTENT_TRY_FIND_PACKAGE_MODE" "ALWAYS")
] ++ lib.optionals cudaSupport [
(lib.cmakeFeature "GPU_RUNTIME" "CUDA")
(lib.cmakeFeature "CUDA_TOOLKIT_ROOT_DIR" "${cudaPackages.cudatoolkit}/")
];
passthru.updateScript = nix-update-script { };
meta = {
description = "Production-grade 3D gaussian splatting";
homepage = "https://github.com/pierotofy/OpenSplat/";
license = lib.licenses.mit;
license = [
# main
lib.licenses.agpl3Only
# vendored+modified gsplat
lib.licenses.asl20
];
maintainers = [ lib.maintainers.jcaesar ];
platforms = lib.platforms.linux ++ lib.optionals (!cudaSupport) lib.platforms.darwin;
};