2021-12-19 01:06:50 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-03-30 09:31:56 +00:00
|
|
|
, nix-update-script
|
2021-12-19 01:06:50 +00:00
|
|
|
, cmake
|
|
|
|
, python3
|
2022-03-30 09:31:56 +00:00
|
|
|
, gtest
|
2021-12-19 01:06:50 +00:00
|
|
|
, withAnimation ? true
|
|
|
|
, withTranscoder ? true
|
2022-03-30 09:31:56 +00:00
|
|
|
, eigen
|
|
|
|
, ghc_filesystem
|
|
|
|
, tinygltf
|
2020-09-25 04:45:31 +00:00
|
|
|
}:
|
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
let
|
|
|
|
cmakeBool = b: if b then "ON" else "OFF";
|
|
|
|
in
|
2020-09-25 04:45:31 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2023-02-09 11:40:11 +00:00
|
|
|
version = "1.5.6";
|
2020-09-25 04:45:31 +00:00
|
|
|
pname = "draco";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "draco";
|
|
|
|
rev = version;
|
2023-02-09 11:40:11 +00:00
|
|
|
hash = "sha256-2YQMav0JJMbJ2bvnN/Xv90tjE/OWLbrZDO4WlaOvcfI=";
|
2021-12-19 01:06:50 +00:00
|
|
|
fetchSubmodules = true;
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
# ld: unknown option: --start-group
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace cmake/draco_targets.cmake \
|
|
|
|
--replace "^Clang" "^AppleClang"
|
|
|
|
'';
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
buildInputs = [ gtest ]
|
|
|
|
++ lib.optionals withTranscoder [ eigen ghc_filesystem tinygltf ];
|
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
nativeBuildInputs = [ cmake python3 ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
2021-12-19 01:06:50 +00:00
|
|
|
"-DDRACO_ANIMATION_ENCODING=${cmakeBool withAnimation}"
|
2022-03-30 09:31:56 +00:00
|
|
|
"-DDRACO_GOOGLETEST_PATH=${gtest}"
|
2021-12-19 01:06:50 +00:00
|
|
|
"-DBUILD_SHARED_LIBS=${cmakeBool true}"
|
2022-03-30 09:31:56 +00:00
|
|
|
"-DDRACO_TRANSCODER_SUPPORTED=${cmakeBool withTranscoder}"
|
|
|
|
] ++ lib.optionals withTranscoder [
|
|
|
|
"-DDRACO_EIGEN_PATH=${eigen}/include/eigen3"
|
|
|
|
"-DDRACO_FILESYSTEM_PATH=${ghc_filesystem}"
|
|
|
|
"-DDRACO_TINYGLTF_PATH=${tinygltf}"
|
2020-09-25 04:45:31 +00:00
|
|
|
];
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-09-25 04:45:31 +00:00
|
|
|
description = "Library for compressing and decompressing 3D geometric meshes and point clouds";
|
|
|
|
homepage = "https://google.github.io/draco/";
|
2022-11-04 12:27:35 +00:00
|
|
|
changelog = "https://github.com/google/draco/releases/tag/${version}";
|
2020-09-25 04:45:31 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ jansol ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|