1{ lib, stdenv, fetchFromGitHub, cmake, boost, jemalloc, c-blosc, tbb, zlib }:
2
3stdenv.mkDerivation rec
4{
5 pname = "openvdb";
6 version = "11.0.0";
7
8 outputs = [ "out" "dev" ];
9
10 src = fetchFromGitHub {
11 owner = "AcademySoftwareFoundation";
12 repo = "openvdb";
13 rev = "v${version}";
14 sha256 = "sha256-wDDjX0nKZ4/DIbEX33PoxR43dJDj2NF3fm+Egug62GQ=";
15 };
16
17 nativeBuildInputs = [ cmake ];
18
19 buildInputs = [ boost tbb jemalloc c-blosc zlib ];
20
21 cmakeFlags = [ "-DOPENVDB_CORE_STATIC=OFF" "-DOPENVDB_BUILD_NANOVDB=ON"];
22
23 # error: aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on macOS 10.13 or newer
24 env = lib.optionalAttrs (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinMinVersion "10.13" && lib.versionAtLeast tbb.version "2021.8.0") {
25 NIX_CFLAGS_COMPILE = "-faligned-allocation";
26 };
27
28 postFixup = ''
29 substituteInPlace $dev/lib/cmake/OpenVDB/FindOpenVDB.cmake \
30 --replace \''${OPENVDB_LIBRARYDIR} $out/lib \
31 --replace \''${OPENVDB_INCLUDEDIR} $dev/include
32 '';
33
34 meta = with lib; {
35 description = "Open framework for voxel";
36 mainProgram = "vdb_print";
37 homepage = "https://www.openvdb.org";
38 maintainers = [ maintainers.guibou ];
39 platforms = platforms.unix;
40 license = licenses.mpl20;
41 };
42}