Invert Color Cycles Node
[blender.git] / intern / cycles / kernel / CMakeLists.txt
1
2 set(INC
3         .
4         ../util
5         osl
6         svm
7 )
8
9 set(SRC
10         kernel.cpp
11         kernel_optimized.cpp
12         kernel.cl
13         kernel.cu
14 )
15
16 set(SRC_HEADERS
17         kernel.h
18         kernel_bvh.h
19         kernel_camera.h
20         kernel_compat_cpu.h
21         kernel_compat_cuda.h
22         kernel_compat_opencl.h
23         kernel_differential.h
24         kernel_displace.h
25         kernel_emission.h
26         kernel_film.h
27         kernel_globals.h
28         kernel_light.h
29         kernel_math.h
30         kernel_mbvh.h
31         kernel_montecarlo.h
32         kernel_object.h
33         kernel_path.h
34         kernel_qbvh.h
35         kernel_random.h
36         kernel_shader.h
37         kernel_textures.h
38         kernel_triangle.h
39         kernel_types.h
40 )
41
42 set(SRC_SVM_HEADERS
43         svm/bsdf.h
44         svm/bsdf_ashikhmin_velvet.h
45         svm/bsdf_diffuse.h
46         svm/bsdf_oren_nayar.h
47         svm/bsdf_microfacet.h
48         svm/bsdf_reflection.h
49         svm/bsdf_refraction.h
50         svm/bsdf_transparent.h
51         svm/bsdf_ward.h
52         svm/bsdf_westin.h
53         svm/emissive.h
54         svm/svm.h
55         svm/svm_attribute.h
56         svm/svm_bsdf.h
57         svm/svm_camera.h
58         svm/svm_closure.h
59         svm/svm_convert.h
60         svm/svm_displace.h
61         svm/svm_fresnel.h
62         svm/svm_geometry.h
63         svm/svm_gradient.h
64         svm/svm_hsv.h
65         svm/svm_image.h
66         svm/svm_invert.h
67         svm/svm_light_path.h
68         svm/svm_magic.h
69         svm/svm_mapping.h
70         svm/svm_math.h
71         svm/svm_mix.h
72         svm/svm_musgrave.h
73         svm/svm_noise.h
74         svm/svm_noisetex.h
75         svm/svm_sepcomb_rgb.h
76         svm/svm_sky.h
77         svm/svm_tex_coord.h
78         svm/svm_texture.h
79         svm/svm_types.h
80         svm/svm_value.h
81         svm/svm_voronoi.h
82         svm/svm_wave.h
83         svm/volume.h
84 )
85
86 set(SRC_UTIL_HEADERS
87         ../util/util_color.h
88         ../util/util_math.h
89         ../util/util_transform.h
90         ../util/util_types.h
91 )
92 # CUDA module
93
94 if(WITH_CYCLES_CUDA_BINARIES)
95         if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
96                 set(CUDA_BITS 64)
97         else()
98                 set(CUDA_BITS 32)
99         endif()
100
101         set(cuda_sources kernel.cu ${headers} ${svm_headers})
102         set(cuda_cubins)
103
104         foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
105                 set(cuda_cubin kernel_${arch}.cubin)
106
107                 add_custom_command(
108                         OUTPUT ${cuda_cubin}
109                         COMMAND ${CUDA_NVCC_EXECUTABLE} -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=24 --opencc-options -OPT:Olimit=0 -I${CMAKE_CURRENT_SOURCE_DIR}/../util -I${CMAKE_CURRENT_SOURCE_DIR}/svm -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -DNVCC
110                         DEPENDS ${cuda_sources})
111
112                 delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_cubin}" ${CYCLES_INSTALL_PATH}/lib)
113                 list(APPEND cuda_cubins ${cuda_cubin})
114         endforeach()
115
116         add_custom_target(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins})
117 endif()
118
119 # OSL module
120
121 if(WITH_CYCLES_OSL)
122         add_subdirectory(osl)
123 endif()
124
125 # CPU module
126
127 include_directories(${INC})
128
129 add_library(cycles_kernel ${SRC} ${SRC_HEADERS} ${SRC_SVM_HEADERS})
130
131 if(WITH_CYCLES_OPTIMIZED_KERNEL)
132         SET_SOURCE_FILES_PROPERTIES(kernel_optimized.cpp PROPERTIES COMPILE_FLAGS ${CYCLES_OPTIMIZED_KERNEL_FLAGS})
133 endif()
134
135 if(WITH_CYCLES_CUDA)
136         add_dependencies(cycles_kernel cycles_kernel_cuda)
137 endif()
138
139 # OpenCL kernel
140
141 #set(KERNEL_PREPROCESSED ${CMAKE_CURRENT_BINARY_DIR}/kernel_preprocessed.cl)
142 #add_custom_command(
143 #       OUTPUT ${KERNEL_PREPROCESSED}
144 #       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}
145 #       DEPENDS ${SRC_KERNEL} ${SRC_UTIL_HEADERS})
146 #add_custom_target(cycles_kernel_preprocess ALL DEPENDS ${KERNEL_PREPROCESSED})
147 #delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${KERNEL_PREPROCESSED}" ${CYCLES_INSTALL_PATH}/kernel)
148
149 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cl" ${CYCLES_INSTALL_PATH}/kernel)
150 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "kernel.cu" ${CYCLES_INSTALL_PATH}/kernel)
151 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
152 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel/svm)
153 delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/kernel)
154