1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 cmake,
7 setuptools,
8 libX11,
9 libXt,
10 libGL,
11 openimageio,
12 imath,
13 python,
14 apple-sdk_14,
15}:
16
17buildPythonPackage rec {
18 pname = "materialx";
19 version = "1.39.4";
20
21 src = fetchFromGitHub {
22 owner = "AcademySoftwareFoundation";
23 repo = "MaterialX";
24 rev = "v${version}";
25 hash = "sha256-XNfXOC76zM5Ns2DyyE3mKCJ1iJaszs1M0rBdVLRDo8E=";
26 };
27
28 format = "other";
29
30 nativeBuildInputs = [
31 cmake
32 setuptools
33 ];
34
35 buildInputs = [
36 openimageio
37 imath
38 ]
39 ++ lib.optionals stdenv.hostPlatform.isDarwin [
40 apple-sdk_14
41 ]
42 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
43 libX11
44 libXt
45 libGL
46 ];
47
48 cmakeFlags = [
49 (lib.cmakeBool "MATERIALX_BUILD_OIIO" true)
50 (lib.cmakeBool "MATERIALX_BUILD_SHARED_LIBS" true)
51 (lib.cmakeBool "MATERIALX_BUILD_PYTHON" true)
52 (lib.cmakeBool "MATERIALX_BUILD_GEN_MSL" (
53 stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin
54 ))
55 ];
56
57 pythonImportsCheck = [ "MaterialX" ];
58
59 postInstall = ''
60 # Make python lib properly accessible
61 target_dir=$out/${python.sitePackages}
62 mkdir -p $(dirname $target_dir)
63 # required for cmake to find the bindings, when included in other projects
64 ln -s $out/python $target_dir
65 '';
66
67 meta = {
68 changelog = "https://github.com/AcademySoftwareFoundation/MaterialX/blob/${src.rev}/CHANGELOG.md";
69 description = "Open standard for representing rich material and look-development content in computer graphics";
70 homepage = "https://materialx.org";
71 maintainers = [ lib.maintainers.gador ];
72 platforms = lib.platforms.unix;
73 license = lib.licenses.mpl20;
74 };
75}