(define-module (vfx packages usd)
#:use-module (gnu packages)
#:use-module (gnu packages commencement)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages boost)
#:use-module (gnu packages tbb)
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages xorg)
#:use-module (gnu packages vulkan)
#:use-module (gnu packages gl)
#:use-module (gnu packages glib)
#:use-module (gnu packages qt)
#:use-module (gnu packages image)
#:use-module (gnu packages image-processing)
#:use-module (gnu packages compression)
#:use-module (gnu packages graphics)
#:use-module (gnu packages documentation)
#:use-module (guix)
#:use-module (guix gexp)
#:use-module (guix git-download)
#:use-module (guix build-system gnu)
#:use-module (guix build-system cmake)
#:use-module ((guix licenses) #:prefix licenses:))
(define-public python-pyside-6-tools
(package
(name "python-pyside-6-tools")
(version (package-version python-shiboken-6))
(source (package-source python-shiboken-6))
(build-system cmake-build-system)
(native-inputs
(list python-wrapper qtbase qtdeclarative qttools))
(inputs
(list python-pyside-6 python-shiboken-6))
(arguments
(list
#:tests? #f
#:configure-flags
#~(list "-DBUILD_TESTS=off"
(string-append "-DPYTHON_EXECUTABLE="
(search-input-file %build-inputs
"/bin/python")))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'go-to-source-dir
(lambda _ (chdir "sources/pyside-tools")))
(add-after 'go-to-source-dir 'set-paths-for-guix
(lambda _
(substitute* "CMakeLists.txt"
(("\\$\\{LIBEXEC_PATH\\}/qmltyperegistrar")
(string-append
(assoc-ref %build-inputs "qtdeclarative")
"/lib/qt6/libexec/qmltyperegistrar"))
(("\\$\\{TOOLS_PATH\\}/lrelease")
(string-append
(assoc-ref %build-inputs "qttools")
"/bin/lrelease"))
(("\\$\\{TOOLS_PATH\\}/lupdate")
(string-append
(assoc-ref %build-inputs "qttools")
"/bin/lupdate"))
(("\\$\\{TOOLS_PATH\\}/qmllint")
(string-append
(assoc-ref %build-inputs "qtdeclarative")
"/bin/qmllint"))
(("\\$\\{TOOLS_PATH\\}/assistant")
(string-append
(assoc-ref %build-inputs "qttools")
"/bin/assistant"))
(("\\$\\{TOOLS_PATH\\}/designer")
(string-append
(assoc-ref %build-inputs "qttools")
"/bin/designer"))
(("\\$\\{TOOLS_PATH\\}/linguist")
(string-append
(assoc-ref %build-inputs "qttools")
"/bin/linguist"))))))))
(home-page "https://wiki.qt.io/Qt_for_Python")
(synopsis
"Command line tools for PySide6")
(description
"Python-pyside-6-tools contains lupdate, rcc and uic tools for PySide6")
(license licenses:gpl2)))
(define-public ptex
(package
(name "ptex")
(version "2.4.2")
(source
(origin
(method url-fetch)
(uri
(string-append "https://github.com/wdas/ptex/archive/refs/tags/"
"v" version ".tar.gz"))
(sha256
(base32 "1qcyjzrqcl3w2gajmqy5hrla8av6bd6s0klghh8gn74j1jrmy8y8"))))
(build-system cmake-build-system)
(native-inputs
(list pkg-config doxygen))
(inputs
(list zlib))
(home-page "https://ptex.us/")
(synopsis "Ptex texture mapping system")
(description "Ptex is a texture mapping system developed by Walt
Disney Animation Studios for production-quality rendering.
No UV assignment is required! Ptex applies a separate texture to each
face of a subdivision or polygon mesh.
The Ptex file format can efficiently store hundreds of thousands of
texture images in a single file.
The Ptex API provides cached file I/O and high-quality filtering -
everything that is needed to easily add Ptex support to a
production-quality renderer or texture authoring application.")
(license licenses:bsd-3)))
(define-public materialx
(package
(name "materialx")
(version "1.38.6")
(source
(origin
(method url-fetch)
(uri
(string-append "https://github.com/AcademySoftwareFoundation/MaterialX/releases/"
"download/v" version "/MaterialX-" version ".tar.gz"))
(sha256
;;(base32 "1rrbcmlg40lb19zlfggr46yi2zv13gbx69pj60rcs9qnd76f26ma")))) ;; 1.38.4
(base32 "10y19ia12bcz43ccji8n8xflnd4jmkwfrwd15x9080499mwfhass")))) ;; 1.38.6
(build-system cmake-build-system)
(arguments
'(#:tests? #f))
(inputs
(list libx11 libxt mesa glu))
(home-page "https://materialx.org/")
(synopsis "MaterialX rich computer graphic materials open standard")
(description "MaterialX is an open standard for representing rich material
and look-development content in computer graphics, enabling its
platform independent description
and exchange across applications and renderers.")
(license licenses:asl2.0)))
(define-public usd
(package
(name "usd")
(version "22.11")
(source (origin
(method url-fetch)
(uri (string-append "https://github.com/PixarAnimationStudios/USD/"
"archive/refs/tags/v" version ".tar.gz"))
(sha256 (base32 "1bma37dj2sxwdgp1bsnbhywigx8kqwn2gzp2jjg5lf5rbd3jcj7k"))
(patches (search-patches "vfx/patches/usd-fix-hgiinterop-vulkan.patch"))))
(build-system cmake-build-system)
(arguments
`(#:tests? #f
#:validate-runpath? #f
#:configure-flags
(list "-DBUILD_SHARED_LIBS=ON"
"-DTBB_USE_DEBUG_BUILD=OFF"
"-DPXR_PREFER_SAFETY_OVER_SPEED=OFF"
"-DPXR_ENABLE_VULKAN_SUPPORT=OFF"
;; so far causing segmentation fault when importing pxr.Usdviewq in python
;;(string-append "-DPXR_MALLOC_LIBRARY="
;; (search-input-file %build-inputs "lib/libjemalloc.so"))
"-DPXR_BUILD_DOCUMENTATION=OFF"
"-DPXR_BUILD_TESTS=OFF"
"-DPXR_BUILD_EXAMPLES=OFF"
"-DPXR_BUILD_TUTORIALS=OFF"
"-DPXR_BUILD_USD_IMAGING=ON"
"-DPXR_BUILD_USDVIEW=ON"
"-DPXR_ENABLE_PYTHON_SUPPORT=ON"
"-DPXR_USE_PYTHON_3=ON"
"-DPXR_USE_DEBUG_PYTHON=OFF"
"-DPXR_ENABLE_OPENVDB_SUPPORT=OFF"
"-DPXR_ENABLE_MATERIALX_SUPPORT=OFF"
"-DPXR_ENABLE_PTEX_SUPPORT=OFF"
"-DPXR_BUILD_OPENIMAGEIO_PLUGIN=OFF"
"-DPXR_BUILD_OPENCOLORIO_PLUGIN=OFF"
"-DPXR_BUILD_EMBREE_PLUGIN=OFF"
"-DPXR_BUILD_PRMAN_PLUGIN=OFF"
"-DPXR_BUILD_ALEMBIC_PLUGIN=OFF"
"-DPXR_BUILD_DRACO_PLUGIN=OFF"
"-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON")
#:phases
(modify-phases %standard-phases
;; USD build system needs those environment variables
(add-before 'configure 'set-env-vars
(lambda _
;;(setenv "MaterialX_DIR" (assoc-ref %build-inputs "materialx"))
(setenv "VULKAN_SDK" (assoc-ref %build-inputs "vulkan-headers"))
#t)))))
;;(native-inputs (list python-2.7))
(inputs (list
;;jemalloc
tbb-2020
boost
mesa
vulkan-headers
vulkan-loader
spirv-headers
spirv-cross
shaderc
glu
freeglut
libx11
libxi
libxrender
glib
python
python-jinja2
python-pyside-6
python-pyside-6-tools
python-pyopengl
imath
ilmbase
openexr
;;opencolorio
;;openimageio
opensubdiv
;;openvdb
;;materialx
;;ptex
;;embree
openjpeg
libjpeg-turbo
libpng
libtiff
zlib))
(home-page "https://graphics.pixar.com/usd/")
(synopsis "Pixar's Universal Scene Description libraries and tools")
(description
"USD is a high-performance extensible software platform
for collaboratively constructing animated 3D scenes,
designed to meet the needs of large-scale film and visual effects production.")
(license licenses:asl2.0)))