svn merge ^/trunk/blender -r48333:48370
[blender.git] / CMakeLists.txt
index dd843e1..72a5ebc 100644 (file)
@@ -130,6 +130,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)
 
 # GHOST Windowing Library Options
 option(WITH_GHOST_DEBUG   "Enable debugging output for the GHOST library" OFF)
@@ -671,6 +672,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()
+
        # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
        set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread -lstdc++")
 
@@ -1017,6 +1036,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
@@ -1186,6 +1213,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 
@@ -1432,6 +1467,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)
+               set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
+               set(OPENCOLORIO_DEFINITIONS "-DOCIO_STATIC_BUILD")
+       endif()
+
        set(EXETYPE MACOSX_BUNDLE)
 
        set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")