Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 184 lines 4.2 kB view raw
1{ 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 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 = "24.08"; 55 pyproject = false; 56 57 src = fetchFromGitHub { 58 owner = "PixarAnimationStudios"; 59 repo = "OpenUSD"; 60 rev = "refs/tags/v${version}"; 61 hash = "sha256-slBJleeDi0mCVThty4NUX4M9vaCLV+E8rnp1Ab77TmE="; 62 }; 63 64 stdenv = 65 if python.stdenv.hostPlatform.isDarwin then darwin.apple_sdk_11_0.stdenv else python.stdenv; 66 67 outputs = [ "out" ] ++ lib.optional withDocs "doc"; 68 69 patches = [ 70 (fetchpatch { 71 name = "port-to-embree-4.patch"; 72 # https://github.com/PixarAnimationStudios/OpenUSD/pull/2266 73 url = "https://github.com/PixarAnimationStudios/OpenUSD/commit/c8fec1342e05dca98a1afd4ea93c7a5f0b41e25b.patch?full_index=1"; 74 hash = "sha256-pK1TUwmVv9zsZkOypq25pl+FJDxJJvozUtVP9ystGtI="; 75 }) 76 ]; 77 78 env.OSL_LOCATION = "${osl}"; 79 80 cmakeFlags = [ 81 "-DPXR_BUILD_ALEMBIC_PLUGIN=ON" 82 "-DPXR_BUILD_DRACO_PLUGIN=ON" 83 "-DPXR_BUILD_EMBREE_PLUGIN=ON" 84 "-DPXR_BUILD_EXAMPLES=OFF" 85 "-DPXR_BUILD_IMAGING=ON" 86 "-DPXR_BUILD_MONOLITHIC=ON" # Seems to be commonly linked to monolithically 87 "-DPXR_BUILD_TESTS=OFF" 88 "-DPXR_BUILD_TUTORIALS=OFF" 89 "-DPXR_BUILD_USD_IMAGING=ON" 90 "-DPYSIDE_BIN_DIR=${pyside-tools-uic}/bin" 91 (lib.cmakeBool "PXR_BUILD_DOCUMENTATION" withDocs) 92 (lib.cmakeBool "PXR_BUILD_PYTHON_DOCUMENTATION" withDocs) 93 (lib.cmakeBool "PXR_BUILD_USDVIEW" withUsdView) 94 (lib.cmakeBool "PXR_BUILD_USD_TOOLS" withTools) 95 (lib.cmakeBool "PXR_ENABLE_MATERIALX_SUPPORT" true) 96 (lib.cmakeBool "PXR_ENABLE_OSL_SUPPORT" (!stdenv.hostPlatform.isDarwin && withOsl)) 97 ]; 98 99 nativeBuildInputs = 100 [ 101 cmake 102 ninja 103 setuptools 104 ] 105 ++ lib.optionals withDocs [ 106 git 107 graphviz-nox 108 doxygen 109 ] 110 ++ lib.optionals withUsdView [ qt6.wrapQtAppsHook ]; 111 112 buildInputs = 113 [ 114 alembic.dev 115 bison 116 boost 117 draco 118 embree 119 flex 120 imath 121 materialx 122 opencolorio 123 openimageio 124 opensubdiv 125 ptex 126 tbb 127 ] 128 ++ lib.optionals stdenv.hostPlatform.isLinux [ 129 libGL 130 libX11 131 libXt 132 ] 133 ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk_11_0.frameworks; [ Cocoa ]) 134 ++ lib.optionals withOsl [ osl ] 135 ++ lib.optionals withUsdView [ qt6.qtbase ] 136 ++ lib.optionals (withUsdView && stdenv.hostPlatform.isLinux) [ 137 qt6.qtbase 138 qt6.qtwayland 139 ]; 140 141 propagatedBuildInputs = 142 [ 143 boost 144 jinja2 145 numpy 146 pyopengl 147 ] 148 ++ lib.optionals (withTools || withUsdView) [ 149 pyside-tools-uic 150 pyside6 151 ] 152 ++ lib.optionals withUsdView [ pyqt6 ]; 153 154 pythonImportsCheck = [ 155 "pxr" 156 "pxr.Usd" 157 ]; 158 159 postInstall = 160 '' 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 license = lib.licenses.tost; 179 maintainers = with lib.maintainers; [ 180 shaddydc 181 gador 182 ]; 183 }; 184}