1{ lib, stdenv, fetchurl, fetchFromGitHub, cmake, pkgconfig, xorg, libGLU
2, libGL, glew, ocl-icd, python3
3, cudaSupport ? false, cudatoolkit
4}:
5
6stdenv.mkDerivation rec {
7 name = "opensubdiv-${version}";
8 version = "3.3.0";
9
10 src = fetchFromGitHub {
11 owner = "PixarAnimationStudios";
12 repo = "OpenSubdiv";
13 rev = "v${lib.replaceChars ["."] ["_"] version}";
14 sha256 = "0wpjwfik4q9s4r30hndhzmfyzv968mmg5lgng0123l07mn47d2yl";
15 };
16
17 outputs = [ "out" "dev" ];
18
19 buildInputs =
20 [ cmake pkgconfig libGLU libGL ocl-icd python3
21 # FIXME: these are not actually needed, but the configure script wants them.
22 glew xorg.libX11 xorg.libXrandr xorg.libXxf86vm xorg.libXcursor
23 xorg.libXinerama xorg.libXi
24 ]
25 ++ lib.optional cudaSupport cudatoolkit;
26
27 cmakeFlags =
28 [ "-DNO_TUTORIALS=1"
29 "-DNO_REGRESSION=1"
30 "-DNO_EXAMPLES=1"
31 "-DGLEW_INCLUDE_DIR=${glew.dev}/include"
32 "-DGLEW_LIBRARY=${glew.dev}/lib"
33 ] ++ lib.optionals cudaSupport [
34 "-DOSD_CUDA_NVCC_FLAGS=--gpu-architecture=compute_30"
35 "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/cc"
36 ];
37
38 enableParallelBuilding = true;
39
40 postInstall = "rm $out/lib/*.a";
41
42 meta = {
43 description = "An Open-Source subdivision surface library";
44 homepage = http://graphics.pixar.com/opensubdiv;
45 platforms = lib.platforms.linux;
46 maintainers = [ lib.maintainers.eelco ];
47 license = lib.licenses.asl20;
48 };
49}