From 12a475e648a01177ed7495e1410b2c0cb11ad7de Mon Sep 17 00:00:00 2001 From: Beat Reichenbach <44111292+beatreichenbach@users.noreply.github.com> Date: Sun, 27 Oct 2024 04:37:49 -0400 Subject: feat: Add OpenColorIO option to OpenImageIO (#47237) * feat: Add OpenColorIO option to OpenImageIO * style: Pep 8 --------- Co-authored-by: Beat Reichenbach --- .../repos/builtin/packages/opencolorio/package.py | 39 ++++++++++++++++++++++ .../repos/builtin/packages/openimageio/package.py | 3 ++ .../repos/builtin/packages/pystring/package.py | 21 ++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 var/spack/repos/builtin/packages/opencolorio/package.py create mode 100644 var/spack/repos/builtin/packages/pystring/package.py diff --git a/var/spack/repos/builtin/packages/opencolorio/package.py b/var/spack/repos/builtin/packages/opencolorio/package.py new file mode 100644 index 0000000000..bed7b22eb3 --- /dev/null +++ b/var/spack/repos/builtin/packages/opencolorio/package.py @@ -0,0 +1,39 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Opencolorio(CMakePackage): + """OpenColorIO (OCIO) is a complete color management solution geared towards motion + picture production with an emphasis on visual effects and computer animation.""" + + homepage = "https://opencolorio.readthedocs.io" + git = "https://github.com/AcademySoftwareFoundation/OpenColorIO" + url = ( + "https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/refs/tags/v2.4.0.tar.gz" + ) + license("Apache-2.0") + + version("2.4.0", sha256="0ff3966b9214da0941b2b1cbdab3975a00a51fc6f3417fa860f98f5358f2c282") + + # Core dependencies + depends_on("cmake@3.14:", type="build") + depends_on("expat@2.2.8:") + depends_on("yaml-cpp@0.6.3:") + depends_on("imath@3.0.5:") + depends_on("pystring@1.1.3:") + + # Optional dependencies + variant("lcms", default=False, description="Little CMS for ociobakelut") + depends_on("lcms@2.2:", when="+lcms") + + variant("python", default=False, description="Build python bindings") + extends("python", when="+python") + depends_on("py-pybind11", when="+python", type=("build", "run")) + + def cmake_args(self): + args = ["-DOCIO_BUILD_PYTHON={0}".format("ON" if "+python" in self.spec else "OFF")] + return args diff --git a/var/spack/repos/builtin/packages/openimageio/package.py b/var/spack/repos/builtin/packages/openimageio/package.py index 4f03b0df35..fe48959156 100644 --- a/var/spack/repos/builtin/packages/openimageio/package.py +++ b/var/spack/repos/builtin/packages/openimageio/package.py @@ -42,6 +42,9 @@ class Openimageio(CMakePackage): variant("qt", default=False, description="Build qt viewer") depends_on("qt@5.6.0:+opengl", when="+qt") + variant("ocio", default=False, description="Support video frames") + depends_on("opencolorio@2.2:", when="+ocio") + def url_for_version(self, version): if version >= Version("2"): return super().url_for_version(version) diff --git a/var/spack/repos/builtin/packages/pystring/package.py b/var/spack/repos/builtin/packages/pystring/package.py new file mode 100644 index 0000000000..9d69f87adb --- /dev/null +++ b/var/spack/repos/builtin/packages/pystring/package.py @@ -0,0 +1,21 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class Pystring(CMakePackage): + """Pystring is a collection of C++ functions which match the interface and behavior + of python's string class methods using std::string.""" + + git = "https://github.com/imageworks/pystring" + url = "https://github.com/imageworks/pystring/archive/refs/tags/v1.1.4.tar.gz" + + license("Apache-2.0") + + version("1.1.4", sha256="49da0fe2a049340d3c45cce530df63a2278af936003642330287b68cefd788fb") + + # Core dependencies + depends_on("cmake@3.27.9:", type="build") -- cgit v1.2.3-70-g09d2