Cycles: hook up the CMake build system.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 28 Apr 2011 13:47:27 +0000 (13:47 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 28 Apr 2011 13:47:27 +0000 (13:47 +0000)
New build instructions for Ubuntu Linux in the wiki:
http://wiki.blender.org/index.php/Dev:2.5/Source/Cycles

19 files changed:
CMakeLists.txt
intern/CMakeLists.txt
intern/cycles/CMakeLists.txt
intern/cycles/app/CMakeLists.txt
intern/cycles/app/cycles_test.cpp
intern/cycles/blender/CMakeLists.txt
intern/cycles/bvh/CMakeLists.txt
intern/cycles/cmake/create_dmg.py [deleted file]
intern/cycles/cmake/external_libs.cmake
intern/cycles/cmake/platforms.cmake
intern/cycles/device/CMakeLists.txt
intern/cycles/doc/CMakeLists.txt
intern/cycles/kernel/CMakeLists.txt
intern/cycles/kernel/kernel_types.h
intern/cycles/kernel/osl/nodes/CMakeLists.txt
intern/cycles/render/CMakeLists.txt
intern/cycles/subd/CMakeLists.txt
intern/cycles/util/CMakeLists.txt
intern/cycles/util/util_transform.cpp

index e24ce2990f46bf90fee2335caf5e9728d7c17786..8f4981d7e36617dd87278407cad4cad77bdfa569 100644 (file)
@@ -173,6 +173,9 @@ endif()
 option(WITH_PYTHON_INSTALL       "Copy system python into the blender install folder" ON)
 option(WITH_API_INSTALL     "Copy API header files into the blender install folder" ON)
 
+# Cycles
+option(WITH_CYCLES                     "Enable Cycles Render Engine" ON)
+
 # Debug
 option(WITH_CXX_GUARDEDALLOC "Enable GuardedAlloc for C++ memory allocation tracking (only enable for development)" OFF)
 mark_as_advanced(WITH_CXX_GUARDEDALLOC)
@@ -1177,13 +1180,19 @@ add_subdirectory(extern)
 # Blender Application
 add_subdirectory(source/creator)
 
-
 #-----------------------------------------------------------------------------
 # Blender Player
 if(WITH_PLAYER)
        add_subdirectory(source/blenderplayer)
 endif()
 
+#-----------------------------------------------------------------------------
+# Cycles
+
+if(WITH_CYCLES)
+       add_subdirectory(intern/cycles)
+endif()
+
 #-----------------------------------------------------------------------------
 # CPack for generating packages
 include(build_files/cmake/packaging.cmake)
index 33bf9bb476c00be323e1c4f3bd1b772f7db6efec..f731b7be46c126303487478d84c7cac7121e7085 100644 (file)
@@ -52,3 +52,4 @@ endif()
 if(WITH_IK_ITASC)
        add_subdirectory(itasc)
 endif()
+
index 406b4e6732bd88ca683e095e4b0d3e4c8771f40a..164f1e95297b6f776f4f7fe6bc77d70b18634138 100644 (file)
@@ -1,38 +1,57 @@
 
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(cycles)
 SET(CYCLES_VERSION_MAJOR 0)
 SET(CYCLES_VERSION_MINOR 0)
 SET(CYCLES_VERSION ${CYCLES_VERSION_MAJOR}.${CYCLES_VERSION_MINOR})
 
 # Options
 
-OPTION(WITH_OSL "Build with Open Shading Language support" OFF)
-OPTION(WITH_CUDA "Build with CUDA support" OFF)
-OPTION(WITH_OPENCL "Build with OpenCL support (not working)" OFF)
-OPTION(WITH_BLENDER "Build Blender Python extension" OFF)
-OPTION(WITH_PARTIO "Build with Partio point cloud support (unfinished)" OFF)
-OPTION(WITH_NETWORK "Build with network rendering support (unfinished)" OFF)
-OPTION(WITH_MULTI "Build with network rendering support (unfinished)" OFF)
-OPTION(WITH_DOCS "Build html documentation" OFF)
+OPTION(WITH_CYCLES_OSL "Build with Open Shading Language support" OFF)
+OPTION(WITH_CYCLES_CUDA "Build with CUDA support" OFF)
+OPTION(WITH_CYCLES_OPENCL "Build with OpenCL support (not working)" 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_MULTI "Build with network rendering support (unfinished)" OFF)
+OPTION(WITH_CYCLES_DOCS "Build html documentation" OFF)
 
 # Flags
-SET(CUDA_ARCH sm_10 sm_11 sm_12 sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build for")
-SET(CUDA_MAXREG 24 CACHE STRING "CUDA maximum number of register to use")
+
+SET(CYCLES_CUDA_ARCH sm_10 sm_11 sm_12 sm_13 sm_20 sm_21 CACHE STRING "CUDA architectures to build for")
+SET(CYCLES_CUDA_MAXREG 24 CACHE STRING "CUDA maximum number of register to use")
 
 # Paths
 
-SET(OSL_PATH "" CACHE PATH "Path to OpenShadingLanguage installation")
-SET(OIIO_PATH "" CACHE PATH "Path to OpenImageIO installation")
-SET(BOOST_PATH "/usr" CACHE PATH "Path to Boost installation")
-SET(CUDA_PATH "/usr/local/cuda" CACHE PATH "Path to CUDA installation")
-SET(OPENCL_PATH "" CACHE PATH "Path to OpenCL installation")
-SET(PYTHON_PATH "" CACHE PATH "Path to Python installation")
-SET(BLENDER_PATH "" CACHE PATH "Path to Blender installation")
-SET(PARTIO_PATH "" CACHE PATH "Path to Partio installation")
-SET(GLEW_PATH "" CACHE PATH "Path to GLEW installation")
-SET(GLUT_PATH "" CACHE PATH "Path to GLUT installation")
-SET(INSTALL_PATH "${CMAKE_BINARY_DIR}/install" CACHE PATH "Path to install to")
+SET(CYCLES_OSL "" CACHE PATH "Path to OpenShadingLanguage installation")
+SET(CYCLES_OIIO "" CACHE PATH "Path to OpenImageIO installation")
+SET(CYCLES_BOOST "/usr" CACHE PATH "Path to Boost installation")
+SET(CYCLES_CUDA "/usr/local/cuda" CACHE PATH "Path to CUDA installation")
+SET(CYCLES_OPENCL "" CACHE PATH "Path to OpenCL installation")
+SET(CYCLES_PARTIO "" CACHE PATH "Path to Partio installation")
+SET(CYCLES_GLEW "" CACHE PATH "Path to GLUT installation")
+
+# Install, todo: deduplicate install path code
+
+if(MSVC_IDE)
+       set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
+elseif(APPLE)
+       set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/\${BUILD_TYPE})
+else()
+       set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH})
+endif()
+
+if(UNIX AND NOT APPLE)
+       if(WITH_INSTALL_PORTABLE)
+               set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
+       else()
+               set(TARGETDIR_VER ${CMAKE_INSTALL_PREFIX}/share/blender/${BLENDER_VERSION})
+       endif()
+elseif(WIN32)
+       set(TARGETDIR_VER ${TARGETDIR}/${BLENDER_VERSION})
+elseif(APPLE)
+       set(TARGETDIR_VER ${TARGETDIR}/blender.app/Contents/MacOS/${BLENDER_VERSION})
+endif()
+
+SET(CYCLES_INSTALL_PATH "${TARGETDIR_VER}/scripts/addons")
 
 # External Libraries
 
@@ -44,9 +63,9 @@ INCLUDE(cmake/platforms.cmake)
 
 # Subdirectories
 
-IF(WITH_BLENDER)
+IF(WITH_CYCLES_BLENDER)
        ADD_SUBDIRECTORY(blender)
-ENDIF(WITH_BLENDER)
+ENDIF(WITH_CYCLES_BLENDER)
 
 ADD_SUBDIRECTORY(app)
 ADD_SUBDIRECTORY(bvh)
index b1f73ed74a31f38ef3c688a8e96b9e74442e35c3..d90ebf0a8b5e222ad12fc8c585b97366d5054cfd 100644 (file)
@@ -1,48 +1,54 @@
 
-INCLUDE_DIRECTORIES(. ../device ../kernel ../kernel/svm ../bvh ../util ../render ../subd)
+INCLUDE_DIRECTORIES(
+       .
+       ../device
+       ../kernel
+       ../kernel/svm
+       ../bvh
+       ../util
+       ../render
+       ../subd)
 
 SET(LIBRARIES
-       device
-       kernel
-       render
-       bvh
-       subd
-       util
+       cycles_device
+       cycles_kernel
+       cycles_render
+       cycles_bvh
+       cycles_subd
+       cycles_util
        ${Boost_LIBRARIES}
        ${OPENGL_LIBRARIES}
-       ${GLEW_LIBRARIES}
+       ${GLEW_LIBRARY}
        ${OPENIMAGEIO_LIBRARY}
        ${GLUT_LIBRARIES})
 
-IF(WITH_OSL)
-       LIST(APPEND LIBRARIES kernel_osl ${OSL_LIBRARIES})
-ENDIF(WITH_OSL)
+IF(WITH_CYCLES_OSL)
+       LIST(APPEND LIBRARIES cycles_kernel_osl ${OSL_LIBRARIES})
+ENDIF()
 
-IF(WITH_PARTIO)
+IF(WITH_CYCLES_PARTIO)
        LIST(APPEND LIBRARIES ${PARTIO_LIBRARIES})
-ENDIF(WITH_PARTIO)
+ENDIF()
 
-IF(WITH_OPENCL)
+IF(WITH_CYCLES_OPENCL)
        LIST(APPEND LIBRARIES ${OPENCL_LIBRARIES})
-ENDIF(WITH_OPENCL)
+ENDIF()
 
 ADD_EXECUTABLE(cycles_test cycles_test.cpp cycles_xml.cpp cycles_xml.h)
 TARGET_LINK_LIBRARIES(cycles_test ${LIBRARIES})
-INSTALL(TARGETS cycles_test DESTINATION ${INSTALL_PATH}/cycles)
+INSTALL(TARGETS cycles_test DESTINATION ${CYCLES_INSTALL_PATH}/cycles)
 
 IF(UNIX AND NOT APPLE)
        SET_TARGET_PROPERTIES(cycles_test PROPERTIES INSTALL_RPATH $ORIGIN/lib)
 ENDIF()
 
-IF(WITH_NETWORK)
+IF(WITH_CYCLES_NETWORK)
        ADD_EXECUTABLE(cycles_server cycles_server.cpp)
        TARGET_LINK_LIBRARIES(cycles_server ${LIBRARIES})
-       INSTALL(TARGETS cycles_server DESTINATION ${INSTALL_PATH}/cycles)
+       INSTALL(TARGETS cycles_server DESTINATION ${CYCLES_INSTALL_PATH}/cycles)
 
        IF(UNIX AND NOT APPLE)
                SET_TARGET_PROPERTIES(cycles_server PROPERTIES INSTALL_RPATH $ORIGIN/lib)
        ENDIF()
 ENDIF()
 
-INSTALL(CODE "FILE(MAKE_DIRECTORY ${INSTALL_PATH}/cycles/cache)")
-
index 96072ac3da6001e42663114d9fe10fd4c1c9abb3..2603458f08846411974d5af15c8fb40e67a31b77 100644 (file)
@@ -185,7 +185,7 @@ static void options_parse(int argc, const char **argv)
 {
        options.width= 1024;
        options.height= 512;
-       options.filepath = path_get("../../../test/models/elephants.xml");
+       options.filepath = "";
        options.session = NULL;
        options.quiet = false;
 
index a75f7295e312e6f270b402f40a85e57f214f84c1..93a043a54a24e78c2e333fcd6eea044a16de193c 100644 (file)
@@ -32,12 +32,12 @@ INCLUDE_DIRECTORIES(
        ${PYTHON_INCLUDE_DIRS})
 
 SET(LIBRARIES
-       render
-       bvh
-       device
-       kernel
-       util
-       subd
+       cycles_render
+       cycles_bvh
+       cycles_device
+       cycles_kernel
+       cycles_util
+       cycles_subd
        ${Boost_LIBRARIES}
        ${OPENGL_LIBRARIES}
        ${OPENIMAGEIO_LIBRARY}
@@ -46,25 +46,25 @@ SET(LIBRARIES
        ${GLEW_LIBRARIES}
        ${BLENDER_LIBRARIES})
 
-IF(WITH_OSL)
-       LIST(APPEND LIBRARIES kernel_osl ${OSL_LIBRARIES})
-ENDIF(WITH_OSL)
+IF(WITH_CYCLES_OSL)
+       LIST(APPEND LIBRARIES cycles_kernel_osl ${OSL_LIBRARIES})
+ENDIF()
 
-IF(WITH_PARTIO)
+IF(WITH_CYCLES_PARTIO)
        LIST(APPEND LIBRARIES ${PARTIO_LIBRARIES})
-ENDIF(WITH_PARTIO)
+ENDIF()
 
-IF(WITH_OPENCL)
+IF(WITH_CYCLES_OPENCL)
        LIST(APPEND LIBRARIES ${OPENCL_LIBRARIES})
-ENDIF(WITH_OPENCL)
+ENDIF()
 
 SET(CMAKE_MODULE_LINKER_FLAGS ${PYTHON_MODULE_FLAGS})
 
 ADD_LIBRARY(cycles_blender MODULE ${sources} ${headers})
 TARGET_LINK_LIBRARIES(cycles_blender ${LIBRARIES})
 
-INSTALL(FILES ${addonfiles} DESTINATION ${INSTALL_PATH}/cycles)
-INSTALL(TARGETS cycles_blender LIBRARY DESTINATION ${INSTALL_PATH}/cycles)
+INSTALL(FILES ${addonfiles} DESTINATION ${CYCLES_INSTALL_PATH}/cycles)
+INSTALL(TARGETS cycles_blender LIBRARY DESTINATION ${CYCLES_INSTALL_PATH}/cycles)
 
 IF(UNIX AND NOT APPLE)
        SET_TARGET_PROPERTIES(cycles_blender PROPERTIES INSTALL_RPATH $ORIGIN/lib)
index c934cded6da5a43e484595801516b579171b51ea..9ea3bc77461d13ab4eb6c593149e0430348acdcd 100644 (file)
@@ -14,5 +14,5 @@ SET(headers
        bvh_params.h
        bvh_sort.h)
 
-ADD_LIBRARY(bvh ${sources} ${headers})
+ADD_LIBRARY(cycles_bvh ${sources} ${headers})
 
diff --git a/intern/cycles/cmake/create_dmg.py b/intern/cycles/cmake/create_dmg.py
deleted file mode 100755 (executable)
index bba7f8d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/python 
-
-import os
-import string
-import sys
-
-name = string.replace(sys.argv[1], ".zip", "")
-
-os.system("rm -f %s.dmg" % (name))
-os.system("mkdir -p /tmp/cycles_dmg")
-os.system("rm /tmp/cycles_dmg/*")
-os.system("cp %s.zip /tmp/cycles_dmg/" % (name))
-os.system("/usr/bin/hdiutil create -fs HFS+ -srcfolder /tmp/cycles_dmg -volname %s %s.dmg" % (name, name))
-
index 6f6f00ed6bc9632499b1ebcd7540b7f22c82555c..da2331cfe9a8a17022c406d1415898a7a71de432 100644 (file)
@@ -1,8 +1,8 @@
 ###########################################################################
 # Boost setup
 
-MESSAGE(STATUS "BOOST_PATH ${BOOST_PATH}")
-SET(BOOST_ROOT ${BOOST_PATH})
+MESSAGE(STATUS "CYCLES_BOOST ${CYCLES_BOOST}")
+SET(BOOST_ROOT ${CYCLES_BOOST})
 
 SET(Boost_ADDITIONAL_VERSIONS "1.45" "1.44" 
                                "1.43" "1.43.0" "1.42" "1.42.0" 
@@ -26,22 +26,22 @@ MESSAGE(STATUS "Boost libraries ${Boost_LIBRARIES}")
 INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
 LINK_DIRECTORIES("${Boost_LIBRARY_DIRS}")
 
-IF(WITH_NETWORK)
+IF(WITH_CYCLES_NETWORK)
        ADD_DEFINITIONS(-DWITH_NETWORK)
 ENDIF()
 
-IF(WITH_MULTI)
+IF(WITH_CYCLES_MULTI)
        ADD_DEFINITIONS(-DWITH_MULTI)
 ENDIF()
 
 ###########################################################################
 # OpenImageIO
 
-MESSAGE(STATUS "OIIO_PATH = ${OIIO_PATH}")
+MESSAGE(STATUS "CYCLES_OIIO = ${CYCLES_OIIO}")
 
-FIND_LIBRARY(OPENIMAGEIO_LIBRARY NAMES OpenImageIO PATHS ${OIIO_PATH}/lib)
-FIND_PATH(OPENIMAGEIO_INCLUDES OpenImageIO/imageio.h ${OIIO_PATH}/include)
-FIND_PROGRAM(OPENIMAGEIO_IDIFF NAMES idiff PATHS ${OIIO_PATH}/bin)
+FIND_LIBRARY(OPENIMAGEIO_LIBRARY NAMES OpenImageIO PATHS ${CYCLES_OIIO}/lib)
+FIND_PATH(OPENIMAGEIO_INCLUDES OpenImageIO/imageio.h ${CYCLES_OIIO}/include)
+FIND_PROGRAM(OPENIMAGEIO_IDIFF NAMES idiff PATHS ${CYCLES_OIIO}/bin)
 
 IF(OPENIMAGEIO_INCLUDES AND OPENIMAGEIO_LIBRARY)
        SET(OPENIMAGEIO_FOUND TRUE)
@@ -54,50 +54,26 @@ ENDIF()
 ADD_DEFINITIONS(-DWITH_OIIO)
 INCLUDE_DIRECTORIES(${OPENIMAGEIO_INCLUDES} ${OPENIMAGEIO_INCLUDES}/OpenImageIO)
 
-###########################################################################
-# OpenGL
-
-FIND_PACKAGE(OpenGL)
-MESSAGE(STATUS "OPENGL_FOUND=${OPENGL_FOUND}")
-
-INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
-
 ###########################################################################
 # GLUT
 
-SET(GLUT_ROOT_PATH ${GLUT_PATH})
+SET(GLUT_ROOT_PATH ${CYCLES_GLUT})
 
 FIND_PACKAGE(GLUT)
 MESSAGE(STATUS "GLUT_FOUND=${GLUT_FOUND}")
 
 INCLUDE_DIRECTORIES(${GLUT_INCLUDE_DIR})
 
-###########################################################################
-# GLEW
-
-SET(GLEW_VERSION 1.5.1)
-FIND_LIBRARY(GLEW_LIBRARIES NAMES GLEW PATHS ${GLEW_PATH}/lib)
-FIND_PATH(GLEW_INCLUDES NAMES glew.h PATH_SUFFIXES GL PATHS ${GLEW_PATH}/include)
-
-IF(GLEW_INCLUDES AND GLEW_LIBRARIES)
-       MESSAGE(STATUS "GLEW includes = ${GLEW_INCLUDES}")
-       MESSAGE(STATUS "GLEW library = ${GLEW_LIBRARIES}")
-ELSE()
-       MESSAGE(STATUS "GLEW not found")
-ENDIF()
-
-INCLUDE_DIRECTORIES("${GLEW_INCLUDES}")
-
 ###########################################################################
 # OpenShadingLanguage
 
-IF(WITH_OSL)
+IF(WITH_CYCLES_OSL)
 
-       MESSAGE(STATUS "OSL_PATH = ${OSL_PATH}")
+       MESSAGE(STATUS "CYCLES_OSL = ${CYCLES_OSL}")
 
-       FIND_LIBRARY(OSL_LIBRARIES NAMES oslexec oslcomp oslquery PATHS ${OSL_PATH}/lib)
-       FIND_PATH(OSL_INCLUDES OSL/oslclosure.h ${OSL_PATH}/include)
-       FIND_PROGRAM(OSL_COMPILER NAMES oslc PATHS ${OSL_PATH}/bin)
+       FIND_LIBRARY(OSL_LIBRARIES NAMES oslexec oslcomp oslquery PATHS ${CYCLES_OSL}/lib)
+       FIND_PATH(OSL_INCLUDES OSL/oslclosure.h ${CYCLES_OSL}/include)
+       FIND_PROGRAM(OSL_COMPILER NAMES oslc PATHS ${CYCLES_OSL}/bin)
 
        IF(OSL_INCLUDES AND OSL_LIBRARIES AND OSL_COMPILER)
                SET(OSL_FOUND TRUE)
@@ -116,12 +92,12 @@ ENDIF()
 ###########################################################################
 # Partio
 
-IF(WITH_PARTIO)
+IF(WITH_CYCLES_PARTIO)
 
-       MESSAGE(STATUS "PARTIO_PATH = ${PARTIO_PATH}")
+       MESSAGE(STATUS "CYCLES_PARTIO = ${CYCLES_PARTIO}")
 
-       FIND_LIBRARY(PARTIO_LIBRARIES NAMES partio PATHS ${PARTIO_PATH}/lib)
-       FIND_PATH(PARTIO_INCLUDES Partio.h ${PARTIO_PATH}/include)
+       FIND_LIBRARY(PARTIO_LIBRARIES NAMES partio PATHS ${CYCLES_PARTIO}/lib)
+       FIND_PATH(PARTIO_INCLUDES Partio.h ${CYCLES_PARTIO}/include)
 
        FIND_PACKAGE(ZLIB)
 
@@ -139,36 +115,24 @@ IF(WITH_PARTIO)
 
 ENDIF()
 
-###########################################################################
-# Python
-
-IF(WITH_BLENDER)
-
-       FIND_PATH(PYTHON_INCLUDE_DIRS Python.h PATHS ${PYTHON_PATH} ${PYTHON_PATH}/include ${PYTHON_PATH}/include/python3.1 ${PYTHON_PATH}/include/python3.2 NO_DEFAULT_PATH)
-       IF(WIN32)
-               FIND_LIBRARY(PYTHON_LIBRARIES NAMES python31 PATHS ${PYTHON_PATH}/lib)
-       ENDIF()
-
-ENDIF()
-
 ###########################################################################
 # Blender
 
-IF(WITH_BLENDER)
-       FIND_PATH(BLENDER_INCLUDE_DIRS RNA_blender.h PATHS ${BLENDER_PATH}/include)
+IF(WITH_CYCLES_BLENDER)
+       FIND_PATH(BLENDER_INCLUDE_DIRS RNA_blender.h PATHS ${CMAKE_BINARY_DIR}/include)
        IF(WIN32)
-               SET(BLENDER_LIBRARIES ${BLENDER_PATH}/bin/Release/blender.lib)
+               SET(BLENDER_LIBRARIES ${CMAKE_BINARY_DIR}/bin/Release/blender.lib)
        ENDIF()
 ENDIF()
 
 ###########################################################################
 # CUDA
 
-IF(WITH_CUDA)
+IF(WITH_CYCLES_CUDA)
 
-       FIND_LIBRARY(CUDA_LIBRARIES NAMES cuda PATHS ${CUDA_PATH}/lib ${CUDA_PATH}/lib/Win32 NO_DEFAULT_PATH)
-       FIND_PATH(CUDA_INCLUDES cuda.h ${CUDA_PATH}/include NO_DEFAULT_PATH)
-       FIND_PROGRAM(CUDA_NVCC NAMES nvcc PATHS ${CUDA_PATH}/bin NO_DEFAULT_PATH)
+       FIND_LIBRARY(CUDA_LIBRARIES NAMES cuda PATHS ${CYCLES_CUDA}/lib ${CYCLES_CUDA}/lib/Win32 NO_DEFAULT_PATH)
+       FIND_PATH(CUDA_INCLUDES cuda.h ${CYCLES_CUDA}/include NO_DEFAULT_PATH)
+       FIND_PROGRAM(CUDA_NVCC NAMES nvcc PATHS ${CYCLES_CUDA}/bin NO_DEFAULT_PATH)
 
        IF(CUDA_INCLUDES AND CUDA_LIBRARIES AND CUDA_NVCC)
                MESSAGE(STATUS "CUDA includes = ${CUDA_INCLUDES}")
@@ -186,7 +150,7 @@ ENDIF()
 ###########################################################################
 # OpenCL
 
-IF(WITH_OPENCL)
+IF(WITH_CYCLES_OPENCL)
 
        IF(APPLE)
                SET(OPENCL_INCLUDES "/System/Library/Frameworks/OpenCL.framework/Headers")
@@ -199,7 +163,7 @@ IF(WITH_OPENCL)
        ENDIF()
 
        IF(UNIX AND NOT APPLE)
-               SET(OPENCL_INCLUDES ${OPENCL_PATH})
+               SET(OPENCL_INCLUDES ${CYCLES_OPENCL})
                SET(OPENCL_LIRBARIES "OpenCL")
        ENDIF()
 
index ebc4b01edbc0a492efe0d7e5e8d6d085f7bda366..075b4761a85199dfd7f78da25a9232bbf16dd86d 100644 (file)
@@ -1,7 +1,7 @@
 
 # Platform specific build flags
 
-SET(GCC_WARNING_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-long-long") # -pedantic
+SET(GCC_WARNING_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-long-long")
 SET(GCC_OPTIM_FLAGS "-ffast-math -fPIC -msse -msse2 -msse3 -mtune=native")
 
 IF(APPLE)
index ab72548fc4f92ea41f2bcce288179e961d6f7d38..0885cd6fc204f76ace4e3bb4168b12bc0f22c18e 100644 (file)
@@ -1,5 +1,13 @@
 
-INCLUDE_DIRECTORIES(. ../kernel ../kernel/svm ../kernel/osl ../util ../render)
+INCLUDE_DIRECTORIES(
+       .
+       ../kernel
+       ../kernel/svm
+       ../kernel/osl
+       ../util
+       ../render
+       ${OPENGL_INCLUDE_DIR}
+       ${GLEW_INCLUDE_DIR})
 
 SET(sources
        device.cpp
@@ -14,5 +22,5 @@ SET(headers
        device_intern.h
        device_network.h)
 
-ADD_LIBRARY(device ${sources} ${headers})
+ADD_LIBRARY(cycles_device ${sources} ${headers})
 
index 116ca5e5b9f5f8e135955a1a6ec5fb37aa49bce2..d6e487663c3fbed21482aa13f8992058b14ff719 100644 (file)
@@ -1,5 +1,5 @@
 
-INSTALL(DIRECTORY license DESTINATION ${INSTALL_PATH}/cycles)
+INSTALL(DIRECTORY license DESTINATION ${CYCLES_INSTALL_PATH}/cycles PATTERN ".svn" EXCLUDE)
 
 SET(doc_sources
        index.html
@@ -76,12 +76,12 @@ SET(doc_templates
        templates/nodes.html
        templates/reference.html)
 
-IF(WITH_DOCS)
+IF(WITH_CYCLES_DOCS)
        MACRO(install_doc_file source_file html_file)
                GET_FILENAME_COMPONENT(subdir ${source_file} PATH)
                INSTALL(
                        FILES ${html_file}
-                       DESTINATION ${INSTALL_PATH}/cycles/doc/${subdir})
+                       DESTINATION ${CYCLES_INSTALL_PATH}/cycles/doc/${subdir})
        ENDMACRO()
 
        FOREACH(_file ${doc_sources})
@@ -100,6 +100,6 @@ IF(WITH_DOCS)
                install_doc_file(${_file} ${_file})
        ENDFOREACH()
 
-       ADD_CUSTOM_TARGET(doc ALL DEPENDS ${html_files})
+       ADD_CUSTOM_TARGET(cycles_doc ALL DEPENDS ${html_files})
 ENDIF()
 
index 30b618eb1adc5b0e90333dd52d76bc08acf73d7e..6c247a9a645250c59a10b0baf59f80d83e84417a 100644 (file)
@@ -71,34 +71,38 @@ SET(headers
 
 # CUDA module
 
-IF(WITH_CUDA)
+IF(WITH_CYCLES_CUDA)
        SET(cuda_sources kernel.cu ${headers})
        SET(cuda_cubins)
 
-       FOREACH(arch ${CUDA_ARCH})
+       FOREACH(arch ${CYCLES_CUDA_ARCH})
                SET(cuda_cubin kernel_${arch}.cubin)
 
                ADD_CUSTOM_COMMAND(
                        OUTPUT ${cuda_cubin}
-                       COMMAND ${CUDA_NVCC} -arch=${arch} -m64 --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu --use_fast_math -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} --ptxas-options="-v" --maxrregcount=${CUDA_MAXREG} --opencc-options -OPT:Olimit=0 -I${CMAKE_CURRENT_SOURCE_DIR}/../util -I${CMAKE_CURRENT_SOURCE_DIR}/svm -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END=
+                       COMMAND ${CUDA_NVCC} -arch=${arch} -m64 --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu --use_fast_math -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} --ptxas-options="-v" --maxrregcount=${CYCLES_CUDA_MAXREG} --opencc-options -OPT:Olimit=0 -I${CMAKE_CURRENT_SOURCE_DIR}/../util -I${CMAKE_CURRENT_SOURCE_DIR}/svm -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END=
                        DEPENDS ${cuda_sources})
 
-               INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} DESTINATION ${INSTALL_PATH}/cycles/lib)
+               INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} DESTINATION ${CYCLES_INSTALL_PATH}/cycles/lib)
                LIST(APPEND cuda_cubins ${cuda_cubin})
        ENDFOREACH()
 
-       ADD_CUSTOM_TARGET(kernel_cuda ALL DEPENDS ${cuda_cubins})
-ENDIF(WITH_CUDA)
+       ADD_CUSTOM_TARGET(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins})
+ENDIF()
 
 # OSL module
 
-IF(WITH_OSL)
+IF(WITH_CYCLES_OSL)
        ADD_SUBDIRECTORY(osl)
-ENDIF(WITH_OSL)
+ENDIF()
 
 # CPU module
 
 INCLUDE_DIRECTORIES(. ../util osl svm)
 
-ADD_LIBRARY(kernel ${sources} ${headers})
+ADD_LIBRARY(cycles_kernel ${sources} ${headers})
+
+IF(WITH_CYCLES_CUDA)
+       add_dependencies(cycles_kernel cycles_kernel_cuda)
+ENDIF()
 
index 8e378d2871bc0c48c8569958d6950750dd66fe80..bd337eb95e1ed200ca797a734b6579cc602030c5 100644 (file)
@@ -217,8 +217,7 @@ typedef struct ShaderData {
        /* primitive id if there is one, ~0 otherwise */
        int prim;
        /* parametric coordinates
-        * - barycentric weights for triangles
-        * - latlong coordinates for background */
+        * - barycentric weights for triangles */
        float u, v;
        /* object id if there is one, ~0 otherwise */
        int object;
index 435acc5f680be8788736a2d1aa233d219d398910..56e8ba0b5b688dcce30d597be1075b964d2e0670 100644 (file)
@@ -65,5 +65,5 @@ ENDFOREACH()
 
 ADD_CUSTOM_TARGET(shader ALL DEPENDS ${oso_sources} ${osl_headers})
 
-INSTALL(FILES ${oso_sources} DESTINATION ${INSTALL_PATH}/cycles/shader)
+INSTALL(FILES ${oso_sources} DESTINATION ${CYCLES_INSTALL_PATH}/cycles/shader)
 
index f31e9bfbcb2a11ec1e6e91a374b66917be019d8e..f2342c9032a76da474ec968b197e947f48ab860f 100644 (file)
@@ -50,5 +50,5 @@ SET(headers
 
 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}")
 
-ADD_LIBRARY(render ${sources} ${headers})
+ADD_LIBRARY(cycles_render ${sources} ${headers})
 
index a14bf7896d8899e320aad5689e21e74ea9502fde..5357df4fab7234414b51551e0838bc3d9ac4306c 100644 (file)
@@ -22,5 +22,5 @@ SET(headers
        subd_stencil.h
        subd_vert.h)
 
-ADD_LIBRARY(subd ${sources} ${headers})
+ADD_LIBRARY(cycles_subd ${sources} ${headers})
 
index 3fea6182a973f0da1b4690bc75f096e16121a1ab..4137c73a39a9a05b2efcb5d082848ca787f17e71 100644 (file)
@@ -1,5 +1,8 @@
 
-INCLUDE_DIRECTORIES(.)
+INCLUDE_DIRECTORIES(
+       .
+       ${GLEW_INCLUDE_PATH}
+       ${OPENGL_INCLUDE_DIR})
 
 SET(sources
        util_cache.cpp
@@ -43,5 +46,5 @@ SET(headers
        util_vector.h
        util_xml.h)
 
-ADD_LIBRARY(util ${sources} ${headers})
+ADD_LIBRARY(cycles_util ${sources} ${headers})
 
index 5c2f28af31887bcd524a756bf359899a29cc19d1..8c5eac2cbb95fa0d269d08fc207bac90b6d268b6 100644 (file)
@@ -129,13 +129,15 @@ static bool transform_matrix4_gj_inverse(float R[][4], float M[][4])
 
 Transform transform_inverse(const Transform& tfm)
 {
-       Transform R = transform_identity();
-       Transform M = tfm;
+       union { Transform T; float M[4][4]; } R, M;
+       
+       R.T = transform_identity();
+       M.T = tfm;
 
-       if(!transform_matrix4_gj_inverse((float(*)[4])&R, (float(*)[4])&M))
+       if(!transform_matrix4_gj_inverse(R.M, M.M))
                return transform_identity();
 
-       return R;
+       return R.T;
 }
 
 CCL_NAMESPACE_END