diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-08-16 20:15:34 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-08-16 20:15:34 +0400 |
commit | 360fcd73fe2868ba32c65697e21ed1bbab8b649a (patch) | |
tree | 29c77024343a26c0358b814e581efaf388a3030a /intern/cycles/kernel | |
parent | 18387f3e3fc4e3fbb9f2cd27d49d12e56975e87c (diff) |
Cycles:
* add some (disabled) test code for using OpenImageIO in imbuf
* link cycles, openimageio and boost into blender instead of a shared library
* some cmakefile changes to simplify the code and follow conventions better
* this may solve running cycles problems on windows XP, or give a different
and hopefully more useful error message
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/CMakeLists.txt | 77 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/CMakeLists.txt | 12 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/nodes/CMakeLists.txt | 24 |
3 files changed, 57 insertions, 56 deletions
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt index b6d758369cc..7c77bf7ff82 100644 --- a/intern/cycles/kernel/CMakeLists.txt +++ b/intern/cycles/kernel/CMakeLists.txt @@ -1,10 +1,10 @@ -SET(sources +set(sources kernel.cpp kernel.cl kernel.cu) -SET(headers +set(headers kernel.h kernel_bvh.h kernel_camera.h @@ -29,7 +29,7 @@ SET(headers kernel_triangle.h kernel_types.h) -SET(svm_headers +set(svm_headers svm/bsdf.h svm/bsdf_ashikhmin_velvet.h svm/bsdf_diffuse.h @@ -72,7 +72,7 @@ SET(svm_headers svm/volume.h ) -SET(util_headers +set(util_headers ../util/util_color.h ../util/util_math.h ../util/util_transform.h @@ -80,60 +80,61 @@ SET(util_headers # CUDA module -IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - SET(CUDA_BITS 64) -ELSE() - SET(CUDA_BITS 32) -ENDIF() +if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(CUDA_BITS 64) +else() + set(CUDA_BITS 32) +endif() -IF(WITH_CYCLES_CUDA) - SET(cuda_sources kernel.cu ${headers} ${svm_headers}) - SET(cuda_cubins) +if(WITH_CYCLES_CUDA) + set(cuda_sources kernel.cu ${headers} ${svm_headers}) + set(cuda_cubins) - FOREACH(arch ${CYCLES_CUDA_ARCH}) - SET(cuda_cubin kernel_${arch}.cubin) + foreach(arch ${CYCLES_CUDA_ARCH}) + set(cuda_cubin kernel_${arch}.cubin) - ADD_CUSTOM_COMMAND( + add_custom_command( OUTPUT ${cuda_cubin} COMMAND ${CUDA_NVCC} -arch=${arch} -m${CUDA_BITS} --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= -DNVCC DEPENDS ${cuda_sources}) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin} DESTINATION ${CYCLES_INSTALL_PATH}/cycles/lib) - LIST(APPEND cuda_cubins ${cuda_cubin}) - ENDFOREACH() + delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_cubin}" ${CYCLES_INSTALL_PATH}/lib) + list(APPEND cuda_cubins ${cuda_cubin}) + endforeach() - ADD_CUSTOM_TARGET(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins}) -ENDIF() + add_custom_target(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins}) +endif() # OSL module -IF(WITH_CYCLES_OSL) - ADD_SUBDIRECTORY(osl) -ENDIF() +if(WITH_CYCLES_OSL) + add_subdirectory(osl) +endif() # CPU module -INCLUDE_DIRECTORIES(. ../util osl svm) +include_directories(. ../util osl svm) -ADD_LIBRARY(cycles_kernel ${sources} ${headers} ${svm_headers}) +add_library(cycles_kernel ${sources} ${headers} ${svm_headers}) -IF(WITH_CYCLES_CUDA) - ADD_DEPENDENCIES(cycles_kernel cycles_kernel_cuda) -ENDIF() +if(WITH_CYCLES_CUDA) + add_dependencies(cycles_kernel cycles_kernel_cuda) +endif() # OPENCL kernel -IF(WITH_CYCLES_OPENCL) - #SET(kernel_preprocessed ${CMAKE_CURRENT_BINARY_DIR}/kernel_preprocessed.cl) - #ADD_CUSTOM_COMMAND( +if(WITH_CYCLES_OPENCL) + #set(kernel_preprocessed ${CMAKE_CURRENT_BINARY_DIR}/kernel_preprocessed.cl) + #add_custom_command( # OUTPUT ${kernel_preprocessed} # COMMAND gcc -x c++ -E ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cl -I ${CMAKE_CURRENT_SOURCE_DIR}/../util/ -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DWITH_OPENCL -o ${kernel_preprocessed} # DEPENDS ${kernel_sources} ${util_headers}) - #ADD_CUSTOM_TARGET(cycles_kernel_preprocess ALL DEPENDS ${kernel_preprocessed}) - #INSTALL(FILES ${kernel_preprocessed} DESTINATION ${CYCLES_INSTALL_PATH}/cycles/kernel) - - INSTALL(FILES kernel.cl ${headers} DESTINATION ${CYCLES_INSTALL_PATH}/cycles/kernel) - INSTALL(FILES ${svm_headers} DESTINATION ${CYCLES_INSTALL_PATH}/cycles/kernel/svm) - INSTALL(FILES ${util_headers} DESTINATION ${CYCLES_INSTALL_PATH}/cycles/kernel) -ENDIF() + #add_custom_target(cycles_kernel_preprocess ALL DEPENDS ${kernel_preprocessed}) + #delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${kernel_preprocessed}" ${CYCLES_INSTALL_PATH}/kernel) + + delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cl" ${CYCLES_INSTALL_PATH}/kernel) + delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${headers}" ${CYCLES_INSTALL_PATH}/kernel) + delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${svm_headers}" ${CYCLES_INSTALL_PATH}/kernel/svm) + delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${util_headers}" ${CYCLES_INSTALL_PATH}/kernel) +endif() diff --git a/intern/cycles/kernel/osl/CMakeLists.txt b/intern/cycles/kernel/osl/CMakeLists.txt index 31a162bdd0e..4a3a6f6798a 100644 --- a/intern/cycles/kernel/osl/CMakeLists.txt +++ b/intern/cycles/kernel/osl/CMakeLists.txt @@ -1,7 +1,7 @@ -INCLUDE_DIRECTORIES(. ../ ../svm ../../render ../../util ../../device) +include_directories(. ../ ../svm ../../render ../../util ../../device) -SET(sources +set(sources background.cpp bsdf_ashikhmin_velvet.cpp bsdf_diffuse.cpp @@ -19,15 +19,15 @@ SET(sources osl_shader.cpp vol_subsurface.cpp) -SET(headers +set(headers osl_closures.h osl_globals.h osl_services.h osl_shader.h) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RTTI_DISABLE_FLAGS}") -ADD_LIBRARY(cycles_kernel_osl ${sources} ${headers}) +add_library(cycles_kernel_osl ${sources} ${headers}) -ADD_SUBDIRECTORY(nodes) +add_subdirectory(nodes) diff --git a/intern/cycles/kernel/osl/nodes/CMakeLists.txt b/intern/cycles/kernel/osl/nodes/CMakeLists.txt index 56e8ba0b5b6..365cc42ad6b 100644 --- a/intern/cycles/kernel/osl/nodes/CMakeLists.txt +++ b/intern/cycles/kernel/osl/nodes/CMakeLists.txt @@ -1,7 +1,7 @@ # OSL node shaders -SET(osl_sources +set(osl_sources node_add_closure.osl node_attribute.osl node_background.osl @@ -46,24 +46,24 @@ SET(osl_sources node_ward_bsdf.osl node_wood_texture.osl) -SET(osl_headers +set(osl_headers node_texture.h stdosl.h) -SET(oso_sources) +set(oso_sources) -FOREACH(_file ${osl_sources}) - SET(osl_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) - STRING(REPLACE ".osl" ".oso" oso_file ${osl_file}) - STRING(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} oso_file ${oso_file}) - ADD_CUSTOM_COMMAND( +foreach(_file ${osl_sources}) + set(osl_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file}) + string(REPLACE ".osl" ".oso" oso_file ${osl_file}) + string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} oso_file ${oso_file}) + add_custom_command( OUTPUT ${oso_file} COMMAND ${OSL_COMPILER} -O2 ${osl_file} DEPENDS ${osl_file} ${osl_headers}) - LIST(APPEND oso_sources ${oso_file}) -ENDFOREACH() + list(APPEND oso_sources ${oso_file}) +endforeach() -ADD_CUSTOM_TARGET(shader ALL DEPENDS ${oso_sources} ${osl_headers}) +add_custom_target(shader ALL DEPENDS ${oso_sources} ${osl_headers}) -INSTALL(FILES ${oso_sources} DESTINATION ${CYCLES_INSTALL_PATH}/cycles/shader) +delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${oso_sources}" ${CYCLES_INSTALL_PATH}/shader) |