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
|
2023-07-15 17:15:38 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "1.5.7";
|
2020-09-25 04:45:31 +00:00
|
|
|
pname = "draco";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "draco";
|
2023-07-15 17:15:38 +00:00
|
|
|
rev = finalAttrs.version;
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-p0Mn4kGeBBKL7Hoz4IBgb6Go6MdkgE7WZgxAnt1tE/0=";
|
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
|
|
|
];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
CXXFLAGS = [
|
|
|
|
# error: expected ')' before 'value' in 'explicit GltfValue(uint8_t value)'
|
|
|
|
"-include cstdint"
|
|
|
|
];
|
|
|
|
|
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/";
|
2024-05-15 15:35:15 +00:00
|
|
|
changelog = "https://github.com/google/draco/releases/tag/${finalAttrs.version}";
|
2020-09-25 04:45:31 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ jansol ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
2023-07-15 17:15:38 +00:00
|
|
|
})
|