1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 nix-update-script,
7}:
8
9let
10 basis_universal = fetchFromGitHub {
11 owner = "zeux";
12 repo = "basis_universal";
13 rev = "8903f6d69849fd782b72a551a4dd04a264434e20";
14 hash = "sha256-o3dCxAAkpMoNkvkM7qD75cPn/obDc/fJ8u7KLPm1G6g=";
15 };
16in
17stdenv.mkDerivation rec {
18 pname = "meshoptimizer";
19 version = "0.24";
20 src = fetchFromGitHub {
21 owner = "zeux";
22 repo = "meshoptimizer";
23 rev = "v${version}";
24 hash = "sha256-mNZOlo0GD6Bf+aYmHL4E6yBkLJ2VRArEQ1FM1BD2+ow=";
25 };
26
27 nativeBuildInputs = [ cmake ];
28
29 outputs = [
30 "bin"
31 "dev"
32 "out"
33 ];
34
35 cmakeFlags = [
36 "-DMESHOPT_BUILD_GLTFPACK=ON"
37 "-DMESHOPT_BASISU_PATH=${basis_universal}"
38 ]
39 ++ lib.optional (!stdenv.hostPlatform.isStatic) "-DMESHOPT_BUILD_SHARED_LIBS:BOOL=ON";
40
41 passthru.updateScript = nix-update-script { };
42
43 meta = with lib; {
44 description = "Mesh optimization library that makes meshes smaller and faster to render";
45 homepage = "https://github.com/zeux/meshoptimizer";
46 license = licenses.mit;
47 maintainers = with maintainers; [
48 bouk
49 lillycham
50 ];
51 platforms = platforms.all;
52 mainProgram = "gltfpack";
53 };
54}