Created
May 22, 2020 01:42
-
-
Save zachlewis/da4b05a33425c8b8b1df4efa5c849a7a to your computer and use it in GitHub Desktop.
OpenEXR Rez package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = "openexr" | |
version = "2.5.1.z5" | |
authors = ["ILM"] | |
description = ( | |
"The professional-grade image storage format of the motion picture industry." | |
) | |
requires = ["numpy-1.16+"] | |
private_build_requires = ["cmake-3.12+<4", "gcc-4+<9"] | |
hashed_variants = True | |
@early() | |
def variants(): | |
from rez.package_py_utils import expand_requires | |
requires = ["platform-**", "arch-**", "os-**"] | |
boosts = ["boost-1.70.0"] | |
pythons = ["python-3.7.**", "python-2.7.**"] | |
return [ | |
expand_requires(*requires + [boost, python]) | |
for python in pythons | |
for boost in boosts | |
] | |
def pre_build_commands(): | |
openexr_ver = "{this.version.major}.{this.version.minor}.{this.version.patch}" | |
env.CXXFLAGS = "$CXXFLAGS -fPIC" | |
env.CFLAGS = "$CFLAGS -fPIC" | |
env.PYTHONUSERBASE = "$REZ_BUILD_INSTALL_PATH" | |
env.PYTHON_EXECUTABLE = ( | |
"{resolve.python.root}/bin/python{resolve.python.version.major}" | |
) | |
env.REZ_BUILD_CMAKE_ARGS = " ".join( | |
[ | |
"-DCMAKE_INSTALL_PREFIX={build.install_path}", | |
"-DCMAKE_INSTALL_LIBDIR={build.install_path}/lib", | |
"-DCMAKE_BUILD_TYPE=Release", | |
"-DILMBASE_BUILD_BOTH_STATIC_SHARED=ON", | |
"-DOPENEXR_BUILD_BOTH_STATIC_SHARED=ON", | |
] | |
) | |
env.REZ_BUILD_ARCHIVE_URL = "https://github.com/AcademySoftwareFoundation/openexr/archive/v{openexr_ver}.tar.gz" | |
env.REZ_BUILD_LOCAL_ARCHIVE_DIR = "$REZ_BUILD_SOURCE_PATH/src" | |
env.REZ_BUILD_LOCAL_ARCHIVE_FILE = ( | |
"$REZ_BUILD_LOCAL_ARCHIVE_DIR/openexr-{openexr_ver}.tar.gz" | |
) | |
build_command = """ | |
if [ ! -f $REZ_BUILD_LOCAL_ARCHIVE_FILE ]; then | |
mkdir -p $REZ_BUILD_LOCAL_ARCHIVE_DIR | |
curl --location $REZ_BUILD_ARCHIVE_URL -o $REZ_BUILD_LOCAL_ARCHIVE_FILE | |
fi | |
tar xf $REZ_BUILD_LOCAL_ARCHIVE_FILE --strip 1 | |
cmake $REZ_BUILD_CMAKE_ARGS | |
make {install} -j$REZ_BUILD_THREAD_COUNT | |
""" | |
def commands(): | |
env.PATH.append("{root}/bin") | |
env.PYTHONPATH.prepend( | |
"{root}/lib/python{resolve.python.version.major}." | |
"{resolve.python.version.minor}/site-packages" | |
) | |
if building: | |
env.CMAKE_MODULE_PATH.prepend("{root}/lib/cmake") | |
env.PKG_CONFIG_PATH.prepend("{root}/lib/pkgconfig") | |
env.LDFLAGS = "-L{root}/lib -Wl,-rpath,{root}/lib $LDFLAGS" | |
for c in ["CFLAGS", "CPPFLAGS", "CXXFLAGS"]: | |
setenv(c, "-I{root}/include $%s" % c) | |
@early() | |
def uuid(): | |
import uuid | |
return str(uuid.uuid5(uuid.NAMESPACE_DNS, name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment