Last active
February 15, 2021 18:55
-
-
Save zachlewis/397c2c622042646c6cbe150824858212 to your computer and use it in GitHub Desktop.
OpenColorIO rez package build script
This file contains 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 = "OpenColorIO" | |
version = "2.0.0.0" | |
description = """ | |
A complete color management solution geared towards motion picture | |
production with an emphasis on visual effects and computer animation. | |
""" | |
authors = ["Academy Software Foundation"] | |
help = "http//opencolorio.org" | |
# tools = [ | |
# "ociobakelut", | |
# "ociocheck", | |
# "ociochecklut", | |
# "ocioconvert", | |
# "ociodisplay", | |
# "ociolutimage", | |
# "ociomakeclf", | |
# "ocioperf", | |
# "ociowrite", | |
# ] | |
@early() | |
def variants(): | |
from rez.package_py_utils import expand_requires | |
requires = ["platform-**", "arch-**", "os-**"] | |
pys = [ | |
'python-3.7', | |
'python-3.8', | |
'python-2.7', | |
] | |
ephemerals = [ | |
'.shared-0', | |
'.shared-1', | |
] | |
return [expand_requires(*requires + [e, py]) for e in ephemerals for py in pys] | |
requires = [ | |
'numpy', | |
#'~openexr-2.4.1+', | |
'~nuke-11|12', | |
'~OpenImageIO-2.1', | |
] | |
private_build_requires = [ | |
#"llvm-8", | |
"gcc-7", | |
"cmake-3", | |
"ninja", | |
## optional stuff | |
### third-party | |
#"pybind11-2.6.0+", | |
#"lcms2-2", | |
#'yamlcpp-0.6.3+<1', | |
#'pystring-1.1.3+', | |
#'libexpat-2.2.5+', | |
#"OpenImageIO-2.1.17.0.z0", # shared | |
### system | |
#"GLEW-2.1.0", | |
#"GLFW-3.3.2", | |
#"freeglut-3", | |
### tests | |
#"numpy", | |
### docs | |
# 'Sphinx', | |
# 'sphinx_press_theme', | |
# 'testresources', | |
# 'recommonmark', | |
# 'doxygen', | |
# 'sphinx_tabs', | |
# 'breathe', | |
] | |
def pre_build_commands(): | |
# options | |
build_docs = False | |
build_ofx = False | |
build_tests = False | |
build_headless = True | |
build_shared = intersects(ephemerals.get('shared', '0'), '1') | |
build_python = 'python' in resolve | |
build_nuke = 'nuke' in resolve | |
build_apps = 'OpenImageIO' in resolve | |
env.LDFLAGS = ('-Wl,%s-rpath,{build.install_path}/lib $LDFLAGS' % | |
('--enable-new-dtags,' if system.platform == 'linux' else '')) | |
env.CXXFLAGS = '$CXXFLAGS -Wno-deprecated-declarations -Wno-unused-variable -fPIC' | |
# dependencies | |
env.OpenImageIO_ROOT = '$REZ_OPENIMAGEIO_ROOT' | |
env.Python_ROOT = resolve.python.root if 'python' in resolve else '' | |
env.pystring_ROOT = resolve.pystring.root if 'pystring' in resolve else '' | |
env.Pybind11_ROOT = resolve.pybind11.root if 'pybind11' in resolve else '' | |
env.Half_ROOT = resolve.openexr.root if 'openexr' in resolve else '' | |
env.Expat_ROOT = resolve.libexpat.root if 'libexpat' in resolve else '' | |
if 'yamlcpp' in resolve: | |
env.CMAKE_PREFIX_PATH.append(resolve.yamlcpp.root) | |
env.REZ_BUILD_CMAKE_ARGS = ' '.join([ | |
'-DBUILD_SHARED_LIBS={build_shared}', | |
'-DOCIO_BUILD_APPS={build_apps}', | |
'-DOCIO_BUILD_NUKE={build_nuke}', | |
'-DOCIO_BUILD_DOCS={build_docs}', | |
#'-DOCIO_BUILD_OFX={build_ofx}', | |
'-DOCIO_BUILD_TESTS={build_tests}', | |
'-DOCIO_BUILD_GPU_TESTS={build_tests}', | |
'-DOCIO_USE_HEADLESS={build_headless}', | |
'-DOCIO_BUILD_PYTHON={build_python}', | |
'-DOCIO_BUILD_JAVA=OFF', | |
'-DCMAKE_INSTALL_PREFIX={build.install_path}', | |
'-DCMAKE_BUILD_TYPE=Release', | |
'-DCMAKE_CXX_STANDARD=14', | |
'-DOCIO_INSTALL_EXT_PACKAGES=MISSING', | |
'-DOCIO_WARNING_AS_ERROR=OFF', | |
#'-DOCIO_NAMESPACE=OpenColorIO', | |
#'-DOCIO_LIBNAME_SUFFIX=""', | |
]) | |
build_command_local = """ | |
cmake -d {root} $REZ_BUILD_CMAKE_ARGS | |
make {install} -j$REZ_BUILD_THREAD_COUNT | |
""" | |
build_command = """ | |
git clone https://github.com/AcademySoftwareFoundation/OpenColorIO.git | |
cmake OpenColorIO $REZ_BUILD_CMAKE_ARGS | |
make {install} -j$REZ_BUILD_THREAD_COUNT | |
""" | |
def commands(): | |
env.PATH.prepend("{root}/bin") | |
if 'python' in resolve: | |
python_version = "{resolve.python.version.major}.{resolve.python.version.minor}" | |
env.PYTHONPATH.append("{root}/lib/python{python_version}/site-packages") | |
if "nuke" in resolve: | |
nuke_version = "{resolve.nuke.version.major}.{resolve.nuke.version.minor}" | |
env.NUKE_PATH.prepend('{root}/share/nuke:{root}/lib/nuke/{nuke_version}') | |
if building: | |
env.CFLAGS.set("-I{root}/include $CFLAGS") | |
env.CPPFLAGS.set("-I{root}/include $CPPFLAGS") | |
env.CXXFLAGS.set("-I{root}/include $CXXFLAGS") | |
env.LDFLAGS.set("-L{root}/lib -Wl,-rpath,{root}/lib $LDFLAGS") | |
env.CMAKE_INCLUDE_PATH.prepend("{root}/include") | |
env.CMAKE_LIBRARY_PATH.prepend("{root}/lib") | |
env.OpenColorIO_ROOT = '{root}' | |
env.OpenColorIO_INCLUDE_DIRS = '{root}/include' | |
hashed_variants = True | |
@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