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