Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-09-15 14:03:17 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-09-15 14:03:17 +0400
commitb93da9b01e163158a830872d29f8bd874f63d54d (patch)
tree59730d1145eba4638a5128d0cc2c5fe3215007ab /build_files
parent8add19d3ece8526f5334acec90fd4c1f1155218c (diff)
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.
Diffstat (limited to 'build_files')
-rw-r--r--build_files/cmake/Modules/FindOpenColorIO.cmake85
-rw-r--r--build_files/cmake/macros.cmake6
-rw-r--r--build_files/scons/config/darwin-config.py6
-rw-r--r--build_files/scons/config/linux-config.py10
-rw-r--r--build_files/scons/config/win32-mingw-config.py6
-rw-r--r--build_files/scons/config/win32-vc-config.py6
-rw-r--r--build_files/scons/config/win64-mingw-config.py6
-rw-r--r--build_files/scons/config/win64-vc-config.py7
-rw-r--r--build_files/scons/tools/Blender.py12
-rw-r--r--build_files/scons/tools/btools.py9
10 files changed, 153 insertions, 0 deletions
diff --git a/build_files/cmake/Modules/FindOpenColorIO.cmake b/build_files/cmake/Modules/FindOpenColorIO.cmake
new file mode 100644
index 00000000000..79bc0127674
--- /dev/null
+++ b/build_files/cmake/Modules/FindOpenColorIO.cmake
@@ -0,0 +1,85 @@
+# - Find OpenColorIO library
+# Find the native OpenColorIO includes and library
+# This module defines
+# OPENCOLORIO_INCLUDE_DIRS, where to find OpenColorIO.h, Set when
+# OPENCOLORIO_INCLUDE_DIR is found.
+# OPENCOLORIO_LIBRARIES, libraries to link against to use OpenColorIO.
+# OPENCOLORIO_ROOT_DIR, The base directory to search for OpenColorIO.
+# This can also be an environment variable.
+# OPENCOLORIO_FOUND, If false, do not try to use OpenColorIO.
+#
+# also defined, but not for general use are
+# OPENCOLORIO_LIBRARY, where to find the OpenColorIO library.
+
+#=============================================================================
+# Copyright 2012 Blender Foundation.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+
+# If OPENCOLORIO_ROOT_DIR was defined in the environment, use it.
+IF(NOT OPENCOLORIO_ROOT_DIR AND NOT $ENV{OPENCOLORIO_ROOT_DIR} STREQUAL "")
+ SET(OPENCOLORIO_ROOT_DIR $ENV{OPENCOLORIO_ROOT_DIR})
+ENDIF()
+
+SET(_opencolorio_FIND_COMPONENTS
+ OpenColorIO
+ yaml-cpp
+ tinyxml
+)
+
+SET(_opencolorio_SEARCH_DIRS
+ ${OPENCOLORIO_ROOT_DIR}
+ /usr/local
+ /sw # Fink
+ /opt/local # DarwinPorts
+ /opt/csw # Blastwave
+)
+
+FIND_PATH(OPENCOLORIO_INCLUDE_DIR
+ NAMES
+ OpenColorIO/OpenColorIO.h
+ HINTS
+ ${_opencolorio_SEARCH_DIRS}
+ PATH_SUFFIXES
+ include
+)
+
+SET(_opencolorio_LIBRARIES)
+FOREACH(COMPONENT ${_opencolorio_FIND_COMPONENTS})
+ STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+ FIND_LIBRARY(OPENCOLORIO_${UPPERCOMPONENT}_LIBRARY
+ NAMES
+ ${COMPONENT}
+ HINTS
+ ${_opencolorio_SEARCH_DIRS}
+ PATH_SUFFIXES
+ lib64 lib
+ )
+ if(OPENCOLORIO_${UPPERCOMPONENT}_LIBRARY)
+ LIST(APPEND _opencolorio_LIBRARIES "${OPENCOLORIO_${UPPERCOMPONENT}_LIBRARY}")
+ endif()
+ENDFOREACH()
+
+# handle the QUIETLY and REQUIRED arguments and set OPENCOLORIO_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenColorIO DEFAULT_MSG
+ _opencolorio_LIBRARIES OPENCOLORIO_INCLUDE_DIR)
+
+IF(OPENCOLORIO_FOUND)
+ SET(OPENCOLORIO_LIBRARIES ${_opencolorio_LIBRARIES})
+ SET(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO_INCLUDE_DIR})
+ENDIF(OPENCOLORIO_FOUND)
+
+MARK_AS_ADVANCED(
+ OPENCOLORIO_INCLUDE_DIR
+ OPENCOLORIO_LIBRARY
+)
+
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 0d4a19705a2..43cfb31c03c 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -218,6 +218,9 @@ macro(SETUP_LIBDIRS)
if(WITH_OPENIMAGEIO)
link_directories(${OPENIMAGEIO_LIBPATH})
endif()
+ if(WITH_OPENCOLORIO)
+ link_directories(${OPENCOLORIO_LIBPATH})
+ endif()
if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
link_directories(${OPENJPEG_LIBPATH})
endif()
@@ -313,6 +316,9 @@ macro(setup_liblinks
if(WITH_OPENIMAGEIO)
target_link_libraries(${target} ${OPENIMAGEIO_LIBRARIES})
endif()
+ if(WITH_OPENCOLORIO)
+ target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
+ endif()
if(WITH_BOOST)
target_link_libraries(${target} ${BOOST_LIBRARIES})
endif()
diff --git a/build_files/scons/config/darwin-config.py b/build_files/scons/config/darwin-config.py
index 1ce9416d5c4..afab4131de8 100644
--- a/build_files/scons/config/darwin-config.py
+++ b/build_files/scons/config/darwin-config.py
@@ -287,6 +287,12 @@ BF_OIIO_INC = BF_OIIO + '/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = BF_OIIO + '/lib'
+WITH_BF_OCIO = True
+BF_OCIO = LIBDIR + '/opencolorio'
+BF_OCIO_INC = BF_OCIO + '/include'
+BF_OCIO_LIB = 'OpenColorIO tinyxml yaml-cpp'
+BF_OCIO_LIBPATH = BF_OCIO + '/lib'
+
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = BF_BOOST + '/include'
diff --git a/build_files/scons/config/linux-config.py b/build_files/scons/config/linux-config.py
index e97c3b8b9d7..5c16baa2ee8 100644
--- a/build_files/scons/config/linux-config.py
+++ b/build_files/scons/config/linux-config.py
@@ -215,6 +215,16 @@ BF_OIIO_INC = BF_OIIO + '/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = BF_OIIO + '/lib'
+WITH_BF_OCIO = True
+WITH_BF_STATICOCIO = False
+BF_OCIO = LIBDIR + '/ocio'
+if not os.path.exists(LCGDIR + '/ocio'):
+ WITH_BF_OCIO = False
+ BF_OCIO = '/usr'
+BF_OCIO_INC = BF_OCIO + '/include'
+BF_OCIO_LIB = 'OpenColorIO yaml-cpp tinyxml'
+BF_OCIO_LIBPATH = BF_OCIO + '/lib'
+
WITH_BF_BOOST = True
WITH_BF_STATICBOOST = False
BF_BOOST = LIBDIR + '/boost'
diff --git a/build_files/scons/config/win32-mingw-config.py b/build_files/scons/config/win32-mingw-config.py
index d46aaca5a07..95b2329f426 100644
--- a/build_files/scons/config/win32-mingw-config.py
+++ b/build_files/scons/config/win32-mingw-config.py
@@ -159,6 +159,12 @@ BF_OIIO_INC = BF_OIIO + '/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = BF_OIIO + '/lib'
+WITH_BF_OCIO = False
+BF_OCIO = LIBDIR + '/opencolorio'
+BF_OCIO_INC = BF_OCIO + '/include'
+BF_OCIO_LIB = 'OpenColorIO'
+BF_OCIO_LIBPATH = BF_OCIO + '/lib'
+
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = BF_BOOST + '/include'
diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py
index 452bbaaf54f..b77ff8e70e0 100644
--- a/build_files/scons/config/win32-vc-config.py
+++ b/build_files/scons/config/win32-vc-config.py
@@ -161,6 +161,12 @@ BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+WITH_BF_OCIO = True
+BF_OCIO = '${LIBDIR}/opencolorio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB = 'OpenColorIO'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
diff --git a/build_files/scons/config/win64-mingw-config.py b/build_files/scons/config/win64-mingw-config.py
index 66ec65bb6ca..c2bf2df6d00 100644
--- a/build_files/scons/config/win64-mingw-config.py
+++ b/build_files/scons/config/win64-mingw-config.py
@@ -159,6 +159,12 @@ BF_OIIO_INC = '${BF_OIIO}/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+WITH_BF_OCIO = False
+BF_OCIO = LIBDIR + '/opencolorio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB = 'OpenColorIO'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = BF_BOOST + '/include'
diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py
index b6a3c108cdb..4b719469c39 100644
--- a/build_files/scons/config/win64-vc-config.py
+++ b/build_files/scons/config/win64-vc-config.py
@@ -158,6 +158,13 @@ BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
BF_OIIO_LIBPATH = '${BF_OIIO}/lib'
+WITH_BF_OCIO = True
+BF_OCIO = '${LIBDIR}/opencolorio'
+BF_OCIO_INC = '${BF_OCIO}/include'
+BF_OCIO_LIB = 'OpenColorIO'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+BF_OCIO_LIBPATH = '${BF_OCIO}/lib'
+
WITH_BF_BOOST = True
BF_BOOST = '${LIBDIR}/boost'
BF_BOOST_INC = '${BF_BOOST}/include'
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index 4ab020dc26a..1e114a43ae0 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -204,6 +204,11 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_STATICOIIO']:
statlibs += Split(lenv['BF_OIIO_LIB_STATIC'])
+ if lenv['WITH_BF_OCIO']:
+ libincs += Split(lenv['BF_OCIO_LIBPATH'])
+ if lenv['WITH_BF_STATICOCIO']:
+ statlibs += Split(lenv['BF_OCIO_LIB_STATIC'])
+
if lenv['WITH_BF_BOOST']:
libincs += Split(lenv['BF_BOOST_LIBPATH'])
if lenv['WITH_BF_STATICBOOST']:
@@ -252,6 +257,10 @@ def setup_syslibs(lenv):
if not lenv['WITH_BF_STATICOIIO']:
syslibs += Split(lenv['BF_OIIO_LIB'])
+ if lenv['WITH_BF_OCIO']:
+ if not lenv['WITH_BF_STATICOCIO']:
+ syslibs += Split(lenv['BF_OCIO_LIB'])
+
if lenv['WITH_BF_OPENEXR'] and not lenv['WITH_BF_STATICOPENEXR']:
syslibs += Split(lenv['BF_OPENEXR_LIB'])
if lenv['WITH_BF_TIFF'] and not lenv['WITH_BF_STATICTIFF']:
@@ -584,6 +593,9 @@ def AppIt(target=None, source=None, env=None):
commands.getoutput(cmd)
cmd = 'cp -R %s/release/datafiles/fonts %s/%s.app/Contents/MacOS/%s/datafiles/'%(bldroot,installdir,binary,VERSION)
commands.getoutput(cmd)
+ if env['WITH_BF_OCIO']:
+ cmd = 'cp -R %s/release/datafiles/colormanagement %s/%s.app/Contents/MacOS/%s/datafiles/'%(bldroot,installdir,binary,VERSION)
+ commands.getoutput(cmd)
cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/MacOS/%s/'%(bldroot,installdir,binary,VERSION)
commands.getoutput(cmd)
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index 2fa503f3f26..633492ba0ee 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -163,6 +163,7 @@ def validate_arguments(args, bc):
'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC',
'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES', 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE',
'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
+ 'WITH_BF_OCIO', 'WITH_BF_STATICOCIO', 'BF_OCIO', 'BF_OCIO_INC', 'BF_OCIO_LIB', 'BF_OCIO_LIB_STATIC', 'BF_OCIO_LIBPATH',
'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH',
'WITH_BF_LIBMV'
]
@@ -575,6 +576,14 @@ def read_opts(env, cfg, args):
('BF_OIIO_LIBPATH', 'OIIO library path', ''),
('BF_OIIO_LIB_STATIC', 'OIIO static library', ''),
+ (BoolVariable('WITH_BF_OCIO', 'Build with OpenColorIO', False)),
+ (BoolVariable('WITH_BF_STATICOCIO', 'Staticly link to OpenColorIO', False)),
+ ('BF_OCIO', 'OCIO root path', ''),
+ ('BF_OCIO_INC', 'OCIO include path', ''),
+ ('BF_OCIO_LIB', 'OCIO library', ''),
+ ('BF_OCIO_LIBPATH', 'OCIO library path', ''),
+ ('BF_OCIO_LIB_STATIC', 'OCIO static library', ''),
+
(BoolVariable('WITH_BF_BOOST', 'Build with Boost', False)),
(BoolVariable('WITH_BF_STATICBOOST', 'Staticly link to boost', False)),
('BF_BOOST', 'Boost root path', ''),