anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / development / libraries / draco / default.nix
blob677c7e636986db9e679386ea2bd183302c4d23fb
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , nix-update-script
5 , cmake
6 , python3
7 , gtest
8 , withAnimation ? true
9 , withTranscoder ? true
10 , eigen
11 , ghc_filesystem
12 , tinygltf
15 let
16   cmakeBool = b: if b then "ON" else "OFF";
18 stdenv.mkDerivation (finalAttrs: {
19   version = "1.5.7";
20   pname = "draco";
22   src = fetchFromGitHub {
23     owner = "google";
24     repo = "draco";
25     rev = finalAttrs.version;
26     hash = "sha256-p0Mn4kGeBBKL7Hoz4IBgb6Go6MdkgE7WZgxAnt1tE/0=";
27     fetchSubmodules = true;
28   };
30   # ld: unknown option: --start-group
31   postPatch = ''
32     substituteInPlace cmake/draco_targets.cmake \
33       --replace "^Clang" "^AppleClang"
34   '';
36   buildInputs = [ gtest ]
37     ++ lib.optionals withTranscoder [ eigen ghc_filesystem tinygltf ];
39   nativeBuildInputs = [ cmake python3 ];
41   cmakeFlags = [
42     "-DDRACO_ANIMATION_ENCODING=${cmakeBool withAnimation}"
43     "-DDRACO_GOOGLETEST_PATH=${gtest}"
44     "-DBUILD_SHARED_LIBS=${cmakeBool true}"
45     "-DDRACO_TRANSCODER_SUPPORTED=${cmakeBool withTranscoder}"
46   ] ++ lib.optionals withTranscoder [
47     "-DDRACO_EIGEN_PATH=${eigen}/include/eigen3"
48     "-DDRACO_FILESYSTEM_PATH=${ghc_filesystem}"
49     "-DDRACO_TINYGLTF_PATH=${tinygltf}"
50   ];
52   CXXFLAGS = [
53     # error: expected ')' before 'value' in 'explicit GltfValue(uint8_t value)'
54     "-include cstdint"
55   ];
57   passthru.updateScript = nix-update-script { };
59   meta = with lib; {
60     description = "Library for compressing and decompressing 3D geometric meshes and point clouds";
61     homepage = "https://google.github.io/draco/";
62     changelog = "https://github.com/google/draco/releases/tag/${finalAttrs.version}";
63     license = licenses.asl20;
64     maintainers = with maintainers; [ jansol ];
65     platforms = platforms.all;
66   };