Cycles: svn merge -r41467:41531 ^/trunk/blender
[blender.git] / CMakeLists.txt
index 0e06f39e7187267081979e683737820a6e2aa42a..0230fb34d0c7a58cdf336467cdd17122f508ba93 100644 (file)
@@ -105,6 +105,7 @@ enable_testing()
 
 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin CACHE INTERNAL "" FORCE )
 set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib CACHE INTERNAL "" FORCE )
+set(INCLUDE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/include CACHE INTERNAL "" FORCE )
 
 #-----------------------------------------------------------------------------
 # Set default config options
@@ -210,6 +211,15 @@ if(UNIX AND NOT APPLE)
 endif()
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
 
+# Cycles
+option(WITH_CYCLES                     "Enable Cycles Render Engine" ON)
+OPTION(WITH_CYCLES_OSL         "Build with Open Shading Language support" OFF)
+OPTION(WITH_CYCLES_CUDA                "Build with CUDA binaries" OFF)
+OPTION(WITH_CYCLES_BLENDER     "Build Blender Python extension" ON)
+OPTION(WITH_CYCLES_PARTIO      "Build with Partio point cloud support (unfinished)" OFF)
+OPTION(WITH_CYCLES_NETWORK     "Build with network rendering support (unfinished)" OFF)
+OPTION(WITH_CYCLES_TEST                "Build cycles test application" OFF)
+
 # disable for now, but plan to support on all platforms eventually
 option(WITH_MEM_JEMALLOC   "Enable malloc replacement (http://www.canonware.com/jemalloc)" OFF)
 mark_as_advanced(WITH_MEM_JEMALLOC)
@@ -281,6 +291,16 @@ if(WITH_PYTHON_MODULE)
        set(WITH_HEADLESS ON)
 endif()
 
+# auto enable openimageio and boost for cycles
+if(WITH_CYCLES)
+       set(WITH_OPENIMAGEIO ON)
+       set(WITH_BOOST ON)
+endif()
+
+if(WITH_OPENIMAGEIO)
+       set(WITH_BOOST ON)
+endif()
+
 TEST_SSE_SUPPORT(COMPILER_SSE_FLAG COMPILER_SSE2_FLAG)
 
 # don't store paths to libs for portable distrobution
@@ -488,6 +508,47 @@ if(UNIX AND NOT APPLE)
                endif()
        endif()
 
+       if(WITH_BOOST)
+               if(CYCLES_BOOST)
+                       set(BOOST ${CYCLES_BOOST} CACHE PATH "Boost Directory")
+                       unset(CYCLES_BOOST CACHE)
+               else()
+                       set(BOOST "/usr" CACHE PATH "Boost Directory")
+               endif()
+
+               if(NOT BOOST_CUSTOM)
+                       set(BOOST_ROOT ${BOOST})
+                       set(Boost_USE_MULTITHREADED ON)
+                       find_package(Boost 1.34 REQUIRED COMPONENTS filesystem regex system thread)
+               endif()
+
+               set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS})
+               set(BOOST_LIBRARIES ${Boost_LIBRARIES})
+               set(BOOST_LIBPATH ${Boost_LIBRARY_DIRS})
+               set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
+       endif()
+
+       if(WITH_OPENIMAGEIO)
+
+               # temp, update
+               if(CYCLES_OIIO)
+                       set(OPENIMAGEIO ${CYCLES_OIIO})
+                       unset(CYCLES_OIIO CACHE)
+               endif()
+
+               set(OPENIMAGEIO_ROOT_DIR ${OPENIMAGEIO})
+               find_package(OpenImageIO REQUIRED)
+
+               set(OPENIMAGEIO_LIBRARIES ${OPENIMAGEIO_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES} ${BOOST_LIBRARIES})
+               set(OPENIMAGEIO_LIBPATH)  # TODO, remove and reference the absolute path everywhere
+               set(OPENIMAGEIO_DEFINITIONS)
+
+               if(NOT OPENIMAGEIO_FOUND)
+                       set(WITH_OPENIMAGEIO OFF)
+               endif()
+
+       endif()
+
        # OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
        set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread -lstdc++")
 
@@ -774,6 +835,33 @@ elseif(WIN32)
                        set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
                endif()
 
+               if(WITH_BOOST)
+                       set(BOOST ${LIBDIR}/boost)
+                       set(BOOST_INCLUDE_DIR ${BOOST}/include)
+                       if(CMAKE_CL_64)
+                               set(BOOST_POSTFIX "vc90-mt-s-1_45.lib")
+                               set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_45.lib")
+                       else()
+                               set(BOOST_POSTFIX "vc90-mt-s-1_46_1.lib")
+                               set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_46_1.lib")
+                       endif()
+                       set(BOOST_LIBRARIES
+                               optimized libboost_date_time-${BOOST_POSTFIX} libboost_filesystem-${BOOST_POSTFIX}
+                               libboost_regex-${BOOST_POSTFIX} libboost_system-${BOOST_POSTFIX} libboost_thread-${BOOST_POSTFIX}
+                               debug libboost_date_time-${BOOST_DEBUG_POSTFIX} libboost_filesystem-${BOOST_DEBUG_POSTFIX}
+                               libboost_regex-${BOOST_DEBUG_POSTFIX} libboost_system-${BOOST_DEBUG_POSTFIX} libboost_thread-${BOOST_DEBUG_POSTFIX})
+                       set(BOOST_LIBPATH ${BOOST}/lib)
+                       set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
+               endif()
+                       
+               if(WITH_OPENIMAGEIO)
+                       set(OPENIMAGEIO ${LIBDIR}/openimageio)
+                       set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
+                       set(OPENIMAGEIO_LIBRARIES OpenImageIO)
+                       set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
+                       set(OPENIMAGEIO_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
@@ -884,6 +972,28 @@ elseif(WIN32)
                        set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
                endif()
 
+               if(WITH_BOOST)
+                       set(BOOST ${LIBDIR}/boost)
+                       set(BOOST_INCLUDE_DIR ${BOOST}/include)
+                       set(BOOST_POSTFIX "vc90-mt-s-1_46_1")
+                       set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_46_1")
+                       set(BOOST_LIBRARIES
+                               optimized libboost_date_time-${BOOST_POSTFIX} libboost_filesystem-${BOOST_POSTFIX}
+                               libboost_regex-${BOOST_POSTFIX} libboost_system-${BOOST_POSTFIX} libboost_thread-${BOOST_POSTFIX}
+                               debug libboost_date_time-${BOOST_DEBUG_POSTFIX} libboost_filesystem-${BOOST_DEBUG_POSTFIX}
+                               libboost_regex-${BOOST_DEBUG_POSTFIX} libboost_system-${BOOST_DEBUG_POSTFIX} libboost_thread-${BOOST_DEBUG_POSTFIX})
+                       set(BOOST_LIBPATH ${BOOST}/lib)
+                       set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
+               endif()
+                       
+               if(WITH_OPENIMAGEIO)
+                       set(OPENIMAGEIO ${LIBDIR}/openimageio)
+                       set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
+                       set(OPENIMAGEIO_LIBRARIES OpenImageIO)
+                       set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
+                       set(OPENIMAGEIO_DEFINITIONS)
+               endif()
+
                set(PLATFORM_LINKFLAGS "--stack,2097152")
 
        endif()
@@ -1087,6 +1197,22 @@ elseif(APPLE)
                # linker needs "-weak_framework 3DconnexionClient"
        endif()
 
+       if(WITH_BOOST)
+               set(BOOST ${LIBDIR}/boost)
+               set(BOOST_INCLUDE_DIR ${BOOST}/include)
+               set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt)
+               set(BOOST_LIBPATH ${BOOST}/lib)
+               set(BOOST_DEFINITIONS)
+       endif()
+
+       if(WITH_OPENIMAGEIO)
+               set(OPENIMAGEIO ${LIBDIR}/openimageio)
+               set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
+               set(OPENIMAGEIO_LIBRARIES OpenImageIO ${PNG_LIBRARIES} ${JPEG_LIBRARIES} ${TIFF_LIBRARY} ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES})
+               set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib ${JPEG_LIBPATH} ${PNG_LIBPATH} ${TIFF_LIBPATH} ${OPENEXR_LIBPATH} ${ZLIB_LIBPATH})
+               set(OPENIMAGEIO_DEFINITIONS "-DOIIO_STATIC_BUILD")
+       endif()
+
        set(EXETYPE MACOSX_BUNDLE)
 
        set(CMAKE_C_FLAGS_DEBUG "-fno-strict-aliasing -g")
@@ -1406,6 +1532,7 @@ if(FIRST_RUN)
        info_cfg_option(WITH_IMAGE_OPENJPEG)
        info_cfg_option(WITH_IMAGE_REDCODE)
        info_cfg_option(WITH_IMAGE_TIFF)
+       info_cfg_option(WITH_OPENIMAGEIO)
 
        info_cfg_text("Audio:")
        info_cfg_option(WITH_OPENAL)