Cycles: Synchronize changes with standalone repository
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 29 Dec 2014 09:48:21 +0000 (14:48 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 31 Dec 2014 20:31:07 +0000 (01:31 +0500)
This changes were done in original commit of the standalone Cycles repository
and needed here for easier patch synchronization.

CMakeLists.txt
intern/cycles/CMakeLists.txt
intern/cycles/app/CMakeLists.txt
intern/cycles/blender/CMakeLists.txt
intern/cycles/cmake/external_libs.cmake
intern/cycles/device/CMakeLists.txt
intern/cycles/render/CMakeLists.txt
intern/cycles/util/CMakeLists.txt

index 4ee277b9248d17a773a0ec8b1dd3341094bef5c4..126755303dda0f22731d86d18884dd7fa6d1798d 100644 (file)
@@ -1076,10 +1076,10 @@ if(UNIX AND NOT APPLE)
                # Note: --whole-archive is needed to force loading of all symbols in liboslexec,
                # otherwise LLVM is missing the osl_allocate_closure_component function
                list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -Wl,--whole-archive ${OSL_LIB_EXEC} -Wl,--no-whole-archive ${OSL_LIB_QUERY})
-               find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
+               find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
                find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
        
-               if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
+               if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
                        set(OSL_FOUND TRUE)
                else()
                        message(STATUS "OSL not found")
@@ -1760,10 +1760,10 @@ elseif(WIN32)
                find_library(OSL_LIB_COMP_DEBUG NAMES oslcomp_d PATHS ${CYCLES_OSL}/lib)
                find_library(OSL_LIB_QUERY_DEBUG NAMES oslquery_d PATHS ${CYCLES_OSL}/lib)
                list(APPEND OSL_LIBRARIES optimized ${OSL_LIB_COMP} optimized ${OSL_LIB_EXEC} optimized ${OSL_LIB_QUERY} debug ${OSL_LIB_EXEC_DEBUG} debug ${OSL_LIB_COMP_DEBUG} debug ${OSL_LIB_QUERY_DEBUG})
-               find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
+               find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
                find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
        
-               if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
+               if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
                        set(OSL_FOUND TRUE)
                else()
                        message(STATUS "OSL not found")
@@ -2054,10 +2054,10 @@ elseif(APPLE)
                find_library(OSL_LIB_QUERY NAMES oslquery PATHS ${CYCLES_OSL}/lib)
                # WARNING! depends on correct order of OSL libs linking
                list(APPEND OSL_LIBRARIES ${OSL_LIB_COMP} -force_load ${OSL_LIB_EXEC} ${OSL_LIB_QUERY})
-               find_path(OSL_INCLUDES OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
+               find_path(OSL_INCLUDE_DIR OSL/oslclosure.h PATHS ${CYCLES_OSL}/include)
                find_program(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
        
-               if(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
+               if(OSL_INCLUDE_DIR AND OSL_LIBRARIES AND OSL_COMPILER)
                        set(OSL_FOUND TRUE)
                else()
                        message(STATUS "OSL not found")
@@ -2629,7 +2629,7 @@ mark_as_advanced(
        OSL_COMPILER
        OSL_LIB_COMP
        OSL_LIB_QUERY
-       OSL_INCLUDES
+       OSL_INCLUDE_DIR
 )
 
 mark_as_advanced(
index c8c71fe68562048a0672c823518cdd9aad253225..01912019d804c80b7cd9dbedaf052f3d984c9037 100644 (file)
@@ -120,7 +120,7 @@ if(WITH_CYCLES_OSL)
        add_definitions(-DOSL_STATIC_LIBRARY)
        include_directories(
                SYSTEM
-               ${OSL_INCLUDES}
+               ${OSL_INCLUDE_DIR}
        )
 endif()
 
index c8464899725054b54be608ade61494635a5c27ac..3d4a72dc015ce9a357db0bd895f6c6001f4e5cc9 100644 (file)
@@ -22,7 +22,6 @@ set(LIBRARIES
        ${BOOST_LIBRARIES}
        ${OPENEXR_LIBRARIES}
        ${BLENDER_GL_LIBRARIES}
-       bf_intern_glew_mx
        ${CYCLES_APP_GLEW_LIBRARY}
        ${OPENIMAGEIO_LIBRARIES}
        ${PNG_LIBRARIES}
@@ -33,20 +32,30 @@ set(LIBRARIES
        extern_cuew
 )
 
+if(NOT CYCLES_STANDALONE_REPOSITORY)
+       list(APPEND LIBRARIES bf_intern_glew_mx)
+endif()
+
 add_definitions(${GL_DEFINITIONS})
 
 if(WIN32)
        list(APPEND LIBRARIES ${PTHREADS_LIBRARIES})
 endif()
 
-link_directories(${OPENIMAGEIO_LIBPATH} ${BOOST_LIBPATH} ${PNG_LIBPATH} ${JPEG_LIBPATH} ${ZLIB_LIBPATH} ${TIFF_LIBPATH})
+link_directories(${OPENIMAGEIO_LIBPATH}
+                 ${BOOST_LIBPATH}
+                 ${PNG_LIBPATH}
+                 ${JPEG_LIBPATH}
+                 ${ZLIB_LIBPATH}
+                 ${TIFF_LIBPATH}
+                 ${OPENEXR_LIBPATH})
 
 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
        list(APPEND LIBRARIES ${GLUT_LIBRARIES})
 endif()
 
 if(WITH_CYCLES_OSL)
-       list(APPEND LIBRARIES cycles_kernel_osl ${OSL_LIBRARIES} ${LLVM_LIBRARY})
+       list(APPEND LIBRARIES cycles_kernel_osl ${OSL_LIBRARIES} ${LLVM_LIBRARIES})
 endif()
 
 include_directories(${INC})
index e1d592d32b44b240236dd774dda15280f01c2e2a..fff9ed20bbafc7fbd65c008a91e5b1ce50311e5d 100644 (file)
@@ -17,7 +17,7 @@ set(INC
 
 set(INC_SYS
        ${PYTHON_INCLUDE_DIRS}
-       ${GLEW_INCLUDE_PATH}
+       ${GLEW_INCLUDE_DIR}
 )
 
 set(SRC
index 4f02b93f04a6891ca496d7cb821d5cac7f75994e..f92b51a9a385d3d046cf51049fb88a61038a3cb2 100644 (file)
@@ -16,6 +16,11 @@ endif()
 ###########################################################################
 # GLEW
 
+# Workaround for unconventional variable name use in Blender.
+if(NOT CYCLES_STANDALONE_REPOSITORY)
+       set(GLEW_INCLUDE_DIR "${GLEW_INCLUDE_PATH}")
+endif()
+
 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
        set(CYCLES_APP_GLEW_LIBRARY ${BLENDER_GLEW_LIBRARIES})
 endif()
@@ -32,3 +37,65 @@ if(WITH_CYCLES_CUDA_BINARIES)
                set(WITH_CYCLES_CUDA_BINARIES OFF)
        endif()
 endif()
+
+# Packages which are being found by Blender when building from inside Blender
+# source code. but which we need to take care of when building Cycles from a
+# standalone repository
+if(CYCLES_STANDALONE_REPOSITORY)
+       if(APPLE OR WIN32)
+               include(precompiled_libs)
+       endif()
+
+       ####
+       # OpenGL
+
+       # TODO(sergey): We currently re-use the same variable name as we use
+       # in Blender. Ideally we need to make it CYCLES_GL_LIBRARIES.
+       find_package(OpenGL REQUIRED)
+       find_package(GLEW REQUIRED)
+       list(APPEND BLENDER_GL_LIBRARIES
+               "${OPENGL_gl_LIBRARY}"
+               "${OPENGL_glu_LIBRARY}"
+               "${GLEW_LIBRARY}"
+       )
+
+       ####
+       # OpenImageIO
+       find_package(OpenImageIO REQUIRED)
+
+       # OIIO usually depends on OpenEXR, so find this library
+       # but don't make it required.
+       find_package(OpenEXR)
+
+       ####
+       # Boost
+       set(__boost_packages filesystem regex system thread date_time)
+       if(WITH_CYCLES_NETWORK)
+              list(APPEND __boost_packages serialization)
+       endif()
+       if(WITH_CYCLES_OSL AND APPLE)
+              list(APPEND __boost_packages wave)
+       endif()
+       find_package(Boost 1.48 COMPONENTS ${__boost_packages} REQUIRED)
+       if(NOT Boost_FOUND)
+               # Try to find non-multithreaded if -mt not found, this flag
+               # doesn't matter for us, it has nothing to do with thread
+               # safety, but keep it to not disturb build setups.
+               set(Boost_USE_MULTITHREADED OFF)
+               find_package(Boost 1.48 COMPONENTS ${__boost_packages})
+       endif()
+       unset(__boost_packages)
+       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")
+
+       ####
+       # OpenShadingLanguage
+       if(WITH_CYCLES_OSL)
+               find_package(OpenShadingLanguage REQUIRED)
+               find_package(LLVM REQUIRED)
+       endif()
+
+       unset(_lib_DIR)
+endif()
index 998b35351e30b0f3315492be8608d55d688c7fbd..b0fa283c1d8809a9506944799e3085f53f449f75 100644 (file)
@@ -10,7 +10,7 @@ set(INC
 )
 
 set(INC_SYS
-       ${GLEW_INCLUDE_PATH}
+       ${GLEW_INCLUDE_DIR}
        ../../../extern/cuew/include
        ../../../extern/clew/include
 )
index c3907da39d02bb5df3a188cdc727a4781307967d..2dc6962633d1d76eb60c39ed559556ac25a56822 100644 (file)
@@ -11,7 +11,7 @@ set(INC
 )
 
 set(INC_SYS
-       ${GLEW_INCLUDE_PATH}
+       ${GLEW_INCLUDE_DIR}
 )
 
 set(SRC
index a07deb68b15736a4bad8445d733fe98e42b4d032..336e5e1711d6e982c880df7409d668991268bfe9 100644 (file)
@@ -5,7 +5,7 @@ set(INC
 )
 
 set(INC_SYS
-       ${GLEW_INCLUDE_PATH}
+       ${GLEW_INCLUDE_DIR}
 )
 
 set(SRC