nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 185 lines 4.4 kB view raw
1{ 2 alembic, 3 bison, 4 boost, 5 buildPythonPackage, 6 cmake, 7 distutils, 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 libXt, 22 materialx, 23 ninja, 24 numpy, 25 opencolorio, 26 openimageio, 27 opensubdiv, 28 osl, 29 ptex, 30 pyopengl, 31 pyqt6, 32 pyside6, 33 python, 34 qt6, 35 setuptools, 36 stdenv, 37 onetbb, 38 withDocs ? false, 39 withOsl ? true, 40 withTools ? false, 41 withUsdView ? false, 42 writeShellScriptBin, 43}: 44 45let 46 # Matches the pyside6-uic implementation 47 # https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside-tools/pyside_tool.py?id=e501cad66146a49c7a259579c7bb94bc93a67a08#n82 48 pyside-tools-uic = writeShellScriptBin "pyside6-uic" '' 49 exec ${qt6.qtbase}/libexec/uic -g python "$@" 50 ''; 51in 52 53buildPythonPackage rec { 54 pname = "openusd"; 55 version = "25.11"; 56 pyproject = false; 57 58 src = fetchFromGitHub { 59 owner = "PixarAnimationStudios"; 60 repo = "OpenUSD"; 61 tag = "v${version}"; 62 hash = "sha256-Oj9mtKF8TyXbXVKT7MME+ju/0+VyyB0N2iv/LBaktjA="; 63 }; 64 65 outputs = [ "out" ] ++ lib.optional withDocs "doc"; 66 67 patches = [ 68 (fetchpatch { 69 name = "port-to-embree-4.patch"; 70 # https://github.com/PixarAnimationStudios/OpenUSD/pull/2266 71 url = "https://github.com/PixarAnimationStudios/OpenUSD/commit/9ea3bc1ab550ec46c426dab04292d9667ccd2518.patch?full_index=1"; 72 hash = "sha256-QjA3kjUDsSleUr+S/bQLb+QK723SNFvnmRPT+ojjgq8="; 73 }) 74 (fetchpatch { 75 # https://github.com/PixarAnimationStudios/OpenUSD/pull/3648 76 name = "propagate-dependencies-opengl.patch"; 77 url = "https://gitlab.archlinux.org/archlinux/packaging/packages/usd/-/raw/41469f20113d3550c5b42e67d1139dedc1062b8c/usd-find-dependency-OpenGL.patch?full_index=1"; 78 hash = "sha256-aUWGKn365qov0ttGOq5GgNxYGIGZ4DfmeMJfakbOugQ="; 79 }) 80 ]; 81 82 env.OSL_LOCATION = "${osl}"; 83 84 cmakeFlags = [ 85 "-DPXR_BUILD_ALEMBIC_PLUGIN=ON" 86 "-DPXR_BUILD_DRACO_PLUGIN=ON" 87 "-DPXR_BUILD_EMBREE_PLUGIN=ON" 88 "-DPXR_BUILD_EXAMPLES=OFF" 89 "-DPXR_BUILD_IMAGING=ON" 90 "-DPXR_BUILD_MONOLITHIC=ON" # Seems to be commonly linked to monolithically 91 "-DPXR_BUILD_TESTS=OFF" 92 "-DPXR_BUILD_TUTORIALS=OFF" 93 "-DPXR_BUILD_USD_IMAGING=ON" 94 "-DPYSIDE_BIN_DIR=${pyside-tools-uic}/bin" 95 (lib.cmakeBool "PXR_BUILD_DOCUMENTATION" withDocs) 96 (lib.cmakeBool "PXR_BUILD_PYTHON_DOCUMENTATION" withDocs) 97 (lib.cmakeBool "PXR_BUILD_USDVIEW" withUsdView) 98 (lib.cmakeBool "PXR_BUILD_USD_TOOLS" withTools) 99 (lib.cmakeBool "PXR_ENABLE_MATERIALX_SUPPORT" true) 100 (lib.cmakeBool "PXR_ENABLE_OSL_SUPPORT" (!stdenv.hostPlatform.isDarwin && withOsl)) 101 ]; 102 103 nativeBuildInputs = [ 104 cmake 105 ninja 106 setuptools 107 opensubdiv.dev 108 opensubdiv.static 109 ] 110 ++ lib.optionals withDocs [ 111 git 112 graphviz-nox 113 doxygen 114 ] 115 ++ lib.optionals withUsdView [ qt6.wrapQtAppsHook ]; 116 117 buildInputs = [ 118 alembic.dev 119 bison 120 draco 121 embree 122 flex 123 imath 124 materialx 125 opencolorio 126 openimageio 127 ptex 128 onetbb 129 ] 130 ++ lib.optionals stdenv.hostPlatform.isLinux [ 131 libX11 132 libXt 133 ] 134 ++ lib.optionals withOsl [ osl ] 135 ++ lib.optionals withUsdView [ qt6.qtbase ] 136 ++ lib.optionals (withUsdView && stdenv.hostPlatform.isLinux) [ qt6.qtwayland ]; 137 138 propagatedBuildInputs = [ 139 boost 140 jinja2 141 numpy 142 opensubdiv 143 pyopengl 144 distutils 145 ] 146 ++ lib.optionals stdenv.hostPlatform.isLinux [ 147 libGL 148 ] 149 ++ lib.optionals (withTools || withUsdView) [ 150 pyside-tools-uic 151 pyside6 152 ] 153 ++ lib.optionals withUsdView [ pyqt6 ]; 154 155 pythonImportsCheck = [ 156 "pxr" 157 "pxr.Usd" 158 ]; 159 160 postInstall = '' 161 # Make python lib properly accessible 162 target_dir=$out/${python.sitePackages} 163 mkdir -p $(dirname $target_dir) 164 mv $out/lib/python $target_dir 165 '' 166 + lib.optionalString withDocs '' 167 mv $out/docs $doc 168 ''; 169 170 meta = { 171 description = "Universal Scene Description"; 172 longDescription = '' 173 Universal Scene Description (USD) is an efficient, scalable system 174 for authoring, reading, and streaming time-sampled scene description 175 for interchange between graphics applications. 176 ''; 177 homepage = "https://openusd.org/"; 178 changelog = "https://github.com/PixarAnimationStudios/OpenUSD/${src.tag}/CHANGELOG.md"; 179 license = lib.licenses.tost; 180 maintainers = with lib.maintainers; [ 181 shaddydc 182 gador 183 ]; 184 }; 185}