Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / openusd / default.nix
blobbc67c43a6b0b8596040a33b55657bda7128c253e
2   alembic,
3   bison,
4   boost,
5   buildPythonPackage,
6   cmake,
7   darwin,
8   doxygen,
9   draco,
10   embree,
11   fetchFromGitHub,
12   fetchpatch,
13   flex,
14   git,
15   graphviz-nox,
16   imath,
17   jinja2,
18   lib,
19   libGL,
20   libX11,
21   ninja,
22   numpy,
23   opencolorio,
24   openimageio,
25   opensubdiv,
26   osl,
27   ptex,
28   pyopengl,
29   pyqt6,
30   pyside6,
31   python,
32   qt6,
33   setuptools,
34   tbb,
35   withDocs ? false,
36   withOsl ? true,
37   withTools ? false,
38   withUsdView ? false,
39   writeShellScriptBin,
42 let
43   # Matches the pyside6-uic implementation
44   # https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside-tools/pyside_tool.py?id=e501cad66146a49c7a259579c7bb94bc93a67a08#n82
45   pyside-tools-uic = writeShellScriptBin "pyside6-uic" ''
46     exec ${qt6.qtbase}/libexec/uic -g python "$@"
47   '';
50 buildPythonPackage rec {
51   pname = "openusd";
52   version = "24.03";
54   src = fetchFromGitHub {
55     owner = "PixarAnimationStudios";
56     repo = "OpenUSD";
57     rev = "refs/tags/v${version}";
58     hash = "sha256-EYf8GhXhsAx0Wxz9ibDZEV4E5scL3GPiu3Nje7N5C/I=";
59   };
61   stdenv = if python.stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else python.stdenv;
63   outputs = [ "out" ] ++ lib.optional withDocs "doc";
65   format = "other";
67   patches = [
68     (fetchpatch {
69       name = "port-to-embree-4.patch";
70       url = "https://github.com/PixarAnimationStudios/OpenUSD/pull/2266/commits/4b6c23d459c602fdac5e0ebc9b7722cbd5475e86.patch";
71       hash = "sha256-yjqdGAVqfEsOX1W/tG6c+GgQLYya5U9xgUe/sNIuDbw=";
72     })
73   ];
75   cmakeFlags = [
76     "-DPXR_BUILD_ALEMBIC_PLUGIN=ON"
77     "-DPXR_BUILD_DRACO_PLUGIN=ON"
78     "-DPXR_BUILD_EMBREE_PLUGIN=ON"
79     "-DPXR_BUILD_EXAMPLES=OFF"
80     "-DPXR_BUILD_IMAGING=ON"
81     "-DPXR_BUILD_MONOLITHIC=ON" # Seems to be commonly linked to monolithically
82     "-DPXR_BUILD_TESTS=OFF"
83     "-DPXR_BUILD_TUTORIALS=OFF"
84     "-DPXR_BUILD_USD_IMAGING=ON"
85     (lib.cmakeBool "PXR_BUILD_DOCUMENTATION" withDocs)
86     (lib.cmakeBool "PXR_BUILD_PYTHON_DOCUMENTATION" withDocs)
87     (lib.cmakeBool "PXR_BUILD_USDVIEW" withUsdView)
88     (lib.cmakeBool "PXR_BUILD_USD_TOOLS" withTools)
89     (lib.cmakeBool "PXR_ENABLE_OSL_SUPPORT" (!stdenv.isDarwin && withOsl))
90   ];
92   nativeBuildInputs =
93     [
94       cmake
95       ninja
96       setuptools
97     ]
98     ++ lib.optionals withDocs [
99       git
100       graphviz-nox
101       doxygen
102     ]
103     ++ lib.optionals withUsdView [ qt6.wrapQtAppsHook ];
105   buildInputs =
106     [
107       alembic.dev
108       bison
109       boost
110       draco
111       embree
112       flex
113       imath
114       opencolorio
115       openimageio
116       opensubdiv
117       ptex
118       tbb
119     ]
120     ++ lib.optionals stdenv.isLinux [
121       libGL
122       libX11
123     ]
124     ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk_11_0.frameworks; [ Cocoa ])
125     ++ lib.optionals withOsl [ osl ]
126     ++ lib.optionals withUsdView [ qt6.qtbase ]
127     ++ lib.optionals (withUsdView && stdenv.isLinux) [
128       qt6.qtbase
129       qt6.qtwayland
130     ];
132   propagatedBuildInputs =
133     [
134       boost
135       jinja2
136       numpy
137       pyopengl
138     ]
139     ++ lib.optionals (withTools || withUsdView) [
140       pyside-tools-uic
141       pyside6
142     ]
143     ++ lib.optionals withUsdView [ pyqt6 ];
145   pythonImportsCheck = [
146     "pxr"
147     "pxr.Usd"
148   ];
150   postInstall =
151     ''
152       # Make python lib properly accessible
153       target_dir=$out/${python.sitePackages}
154       mkdir -p $(dirname $target_dir)
155       mv $out/lib/python $target_dir
156     ''
157     + lib.optionalString withDocs ''
158       mv $out/docs $doc
159     '';
161   meta = {
162     description = "Universal Scene Description";
163     longDescription = ''
164       Universal Scene Description (USD) is an efficient, scalable system
165       for authoring, reading, and streaming time-sampled scene description
166       for interchange between graphics applications.
167     '';
168     homepage = "https://openusd.org/";
169     license = lib.licenses.asl20;
170     maintainers = with lib.maintainers; [ shaddydc ];
171   };