about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/openusd/default.nix
blob: 590bae1823c97d00f7a88f7b71d87e37799b2f65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
{ buildPythonPackage
, fetchFromGitHub
, lib
, writeShellScriptBin
, cmake
, doxygen
, draco
, graphviz-nox
, ninja
, setuptools
, pyqt6
, pyopengl
, jinja2
, pyside6
, boost
, numpy
, git
, tbb
, opensubdiv
, openimageio
, opencolorio
, osl
, ptex
, embree
, alembic
, imath
, flex
, bison
, qt6
, python
, darwin
}:
let
  # Matches the pyside6-uic implementation
  # https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/pyside-tools/pyside_tool.py?id=e501cad66146a49c7a259579c7bb94bc93a67a08#n82
  pyside-tools-uic = writeShellScriptBin "pyside6-uic" ''
    exec ${qt6.qtbase}/libexec/uic -g python "$@"
  '';
in
buildPythonPackage rec {
  pname = "OpenUSD";
  version = "23.11";
  src = fetchFromGitHub {
    owner = "PixarAnimationStudios";
    repo = pname;
    rev = "refs/tags/v${version}";
    hash = "sha256-5zQrfB14kXs75WbL3s4eyhxELglhLNxU2L2aVXiyVjg=";
  };

  stdenv = if python.stdenv.isDarwin then
    darwin.apple_sdk_11_0.stdenv
  else
    python.stdenv;

  outputs = ["out" "doc"];

  format = "other";

  propagatedBuildInputs = [
    setuptools
    pyqt6
    pyopengl
    jinja2
    pyside6
    pyside-tools-uic
    boost
    numpy
  ];

  cmakeFlags = [
    "-DPXR_BUILD_EXAMPLES=OFF"
    "-DPXR_BUILD_TUTORIALS=OFF"
    "-DPXR_BUILD_USD_TOOLS=ON"
    "-DPXR_BUILD_IMAGING=ON"
    "-DPXR_BUILD_USD_IMAGING=ON"
    "-DPXR_BUILD_USDVIEW=ON"
    "-DPXR_BUILD_DOCUMENTATION=ON"
    "-DPXR_BUILD_PYTHON_DOCUMENTATION=ON"
    "-DPXR_BUILD_EMBREE_PLUGIN=ON"
    "-DPXR_BUILD_ALEMBIC_PLUGIN=ON"
    "-DPXR_BUILD_DRACO_PLUGIN=ON"
    "-DPXR_BUILD_MONOLITHIC=ON" # Seems to be commonly linked to monolithically
    (lib.cmakeBool "PXR_ENABLE_OSL_SUPPORT" (!stdenv.isDarwin))
  ];

  nativeBuildInputs = [
    cmake
    ninja
    git
    qt6.wrapQtAppsHook
    doxygen
    graphviz-nox
  ];
  buildInputs = [
    tbb
    opensubdiv
    openimageio
    opencolorio
    osl
    ptex
    embree
    alembic.dev
    imath
    flex
    bison
    boost
    draco
    qt6.qtbase
  ]
    ++ lib.optionals stdenv.isLinux [ qt6.qtwayland ]
    ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk_11_0.frameworks; [
      Cocoa
    ])
  ;

  pythonImportsCheck = [ "pxr" "pxr.Usd" ];

  postInstall = ''
    # Make python lib properly accessible
    target_dir=$out/${python.sitePackages}
    mkdir -p $(dirname $target_dir)
    mv $out/lib/python $target_dir

    mv $out/docs $doc

    rm $out/share -r # only examples
    rm $out/tests -r
  '';

  meta = {
    description = "Universal Scene Description";
    longDescription = ''
      Universal Scene Description (USD) is an efficient, scalable system
      for authoring, reading, and streaming time-sampled scene description
      for interchange between graphics applications.
    '';
    homepage = "https://openusd.org/";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ shaddydc ];
  };
}