Color Management, Stage 1: Initial OpenColorIO library integration

This commit integrates support of OpenColorIO library into build systems.

It also contains C-API for OpenColorIO library which could be used by Blender.

CMake has got find rules familiar to OpenImageIO's one which makes it easier
for build system to find needed libraries and includes. Scons only could use
explicitly defined paths to libraries and includes.

C-API would be compiled and Blender would be linked against C-API and OpenColorIO
but it wouldn't affect on Blender behavior at all.

OpenColorIO could be disabled by setting up WITH_OCIO to Off in CMake and
setting WITH_BF_OCIO in Scons.
This commit is contained in:
Sergey Sharybin
2012-09-15 10:03:17 +00:00
parent 8add19d3ec
commit b93da9b01e
38 changed files with 381405 additions and 0 deletions

View File

@@ -131,6 +131,7 @@ option(WITH_FFTW3 "Enable FFTW3 support (Used for smoke and audio effect
option(WITH_BULLET "Enable Bullet (Physics Engine)" ON)
option(WITH_GAMEENGINE "Enable Game Engine" ON)
option(WITH_PLAYER "Build Player" OFF)
option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ON)
option(WITH_COMPOSITOR "Enable the tile based nodal compositor" ON)
option(WITH_COMPOSITOR_LEGACY "Enable legacy compositor" OFF)
@@ -672,6 +673,24 @@ if(UNIX AND NOT APPLE)
endif()
endif()
if(WITH_OPENCOLORIO)
# use lib dir if available and nothing else specified
if(LIBDIR AND NOT OPENCOLORIO_ROOT_DIR)
set(OPENCOLORIO_ROOT_DIR ${LIBDIR}/ocio)
endif()
find_package(OpenColorIO)
set(OPENCOLORIO_LIBRARIES ${OPENCOLORIO_LIBRARIES})
set(OPENCOLORIO_LIBPATH) # TODO, remove and reference the absolute path everywhere
set(OPENCOLORIO_DEFINITIONS)
if(NOT OPENCOLORIO_FOUND)
set(WITH_OPENCOLORIO OFF)
message(STATUS "OpenColorIO not found")
endif()
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
@@ -1065,6 +1084,14 @@ elseif(WIN32)
set(OPENIMAGEIO_DEFINITIONS)
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO)
set_lib_path(OPENCOLORIO_LIBPATH "opencolorio/lib")
set(OPENCOLORIO_DEFINITIONS)
endif()
set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
# MSVC only, Mingw doesnt need
@@ -1236,6 +1263,14 @@ elseif(WIN32)
set(OPENIMAGEIO_DEFINITIONS)
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
set(OPENCOLORIO_DEFINITIONS)
endif()
set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
## DISABLE - causes linking errors
@@ -1482,6 +1517,14 @@ elseif(APPLE)
set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
endif()
if(WITH_OPENCOLORIO)
set(OPENCOLORIO ${LIBDIR}/opencolorio)
set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
set(OPENCOLORIO_LIBRARIES OpenColorIO tinyxml yaml-cpp)
set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
endif()
if(WITH_CYCLES_OSL)
set(CYCLES_OSL ${LIBDIR}/osl CACHE PATH "Path to OpenShadingLanguage installation")
@@ -1885,6 +1928,7 @@ if(FIRST_RUN)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_INPUT_NDOF)
info_cfg_option(WITH_CYCLES)
info_cfg_option(WITH_OPENCOLORIO)
info_cfg_text("Compiler Options:")
info_cfg_option(WITH_BUILDINFO)