Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 182 lines 4.1 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 ]; 76 77 env.OSL_LOCATION = "${osl}"; 78 79 cmakeFlags = [ 80 "-DPXR_BUILD_ALEMBIC_PLUGIN=ON" 81 "-DPXR_BUILD_DRACO_PLUGIN=ON" 82 "-DPXR_BUILD_EMBREE_PLUGIN=ON" 83 "-DPXR_BUILD_EXAMPLES=OFF" 84 "-DPXR_BUILD_IMAGING=ON" 85 "-DPXR_BUILD_MONOLITHIC=ON" # Seems to be commonly linked to monolithically 86 "-DPXR_BUILD_TESTS=OFF" 87 "-DPXR_BUILD_TUTORIALS=OFF" 88 "-DPXR_BUILD_USD_IMAGING=ON" 89 "-DPYSIDE_BIN_DIR=${pyside-tools-uic}/bin" 90 (lib.cmakeBool "PXR_BUILD_DOCUMENTATION" withDocs) 91 (lib.cmakeBool "PXR_BUILD_PYTHON_DOCUMENTATION" withDocs) 92 (lib.cmakeBool "PXR_BUILD_USDVIEW" withUsdView) 93 (lib.cmakeBool "PXR_BUILD_USD_TOOLS" withTools) 94 (lib.cmakeBool "PXR_ENABLE_MATERIALX_SUPPORT" true) 95 (lib.cmakeBool "PXR_ENABLE_OSL_SUPPORT" (!stdenv.hostPlatform.isDarwin && withOsl)) 96 ]; 97 98 nativeBuildInputs = 99 [ 100 cmake 101 ninja 102 setuptools 103 opensubdiv.dev 104 opensubdiv.static 105 ] 106 ++ lib.optionals withDocs [ 107 git 108 graphviz-nox 109 doxygen 110 ] 111 ++ lib.optionals withUsdView [ qt6.wrapQtAppsHook ]; 112 113 buildInputs = 114 [ 115 alembic.dev 116 bison 117 draco 118 embree 119 flex 120 imath 121 materialx 122 opencolorio 123 openimageio 124 ptex 125 tbb 126 ] 127 ++ lib.optionals stdenv.hostPlatform.isLinux [ 128 libGL 129 libX11 130 libXt 131 ] 132 ++ lib.optionals withOsl [ osl ] 133 ++ lib.optionals withUsdView [ qt6.qtbase ] 134 ++ lib.optionals (withUsdView && stdenv.hostPlatform.isLinux) [ qt6.qtwayland ]; 135 136 propagatedBuildInputs = 137 [ 138 boost 139 jinja2 140 numpy 141 opensubdiv 142 pyopengl 143 distutils 144 ] 145 ++ lib.optionals (withTools || withUsdView) [ 146 pyside-tools-uic 147 pyside6 148 ] 149 ++ lib.optionals withUsdView [ pyqt6 ]; 150 151 pythonImportsCheck = [ 152 "pxr" 153 "pxr.Usd" 154 ]; 155 156 postInstall = 157 '' 158 # Make python lib properly accessible 159 target_dir=$out/${python.sitePackages} 160 mkdir -p $(dirname $target_dir) 161 mv $out/lib/python $target_dir 162 '' 163 + lib.optionalString withDocs '' 164 mv $out/docs $doc 165 ''; 166 167 meta = { 168 description = "Universal Scene Description"; 169 longDescription = '' 170 Universal Scene Description (USD) is an efficient, scalable system 171 for authoring, reading, and streaming time-sampled scene description 172 for interchange between graphics applications. 173 ''; 174 homepage = "https://openusd.org/"; 175 changelog = "https://github.com/PixarAnimationStudios/OpenUSD/${src.tag}/CHANGELOG.md"; 176 license = lib.licenses.tost; 177 maintainers = with lib.maintainers; [ 178 shaddydc 179 gador 180 ]; 181 }; 182}