CMakeLists.txt 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. remove_extra_strict_flags()
  2. set(INC
  3. ..
  4. )
  5. set(INC_SYS
  6. )
  7. set(SRC_CPU_KERNELS
  8. kernels/cpu/kernel.cpp
  9. kernels/cpu/kernel_sse2.cpp
  10. kernels/cpu/kernel_sse3.cpp
  11. kernels/cpu/kernel_sse41.cpp
  12. kernels/cpu/kernel_avx.cpp
  13. kernels/cpu/kernel_avx2.cpp
  14. kernels/cpu/kernel_split.cpp
  15. kernels/cpu/kernel_split_sse2.cpp
  16. kernels/cpu/kernel_split_sse3.cpp
  17. kernels/cpu/kernel_split_sse41.cpp
  18. kernels/cpu/kernel_split_avx.cpp
  19. kernels/cpu/kernel_split_avx2.cpp
  20. kernels/cpu/filter.cpp
  21. kernels/cpu/filter_sse2.cpp
  22. kernels/cpu/filter_sse3.cpp
  23. kernels/cpu/filter_sse41.cpp
  24. kernels/cpu/filter_avx.cpp
  25. kernels/cpu/filter_avx2.cpp
  26. )
  27. set(SRC_CUDA_KERNELS
  28. kernels/cuda/kernel.cu
  29. kernels/cuda/kernel_split.cu
  30. kernels/cuda/filter.cu
  31. )
  32. set(SRC_OPENCL_KERNELS
  33. kernels/opencl/kernel_bake.cl
  34. kernels/opencl/kernel_base.cl
  35. kernels/opencl/kernel_displace.cl
  36. kernels/opencl/kernel_background.cl
  37. kernels/opencl/kernel_state_buffer_size.cl
  38. kernels/opencl/kernel_split_bundle.cl
  39. kernels/opencl/kernel_data_init.cl
  40. kernels/opencl/kernel_path_init.cl
  41. kernels/opencl/kernel_queue_enqueue.cl
  42. kernels/opencl/kernel_scene_intersect.cl
  43. kernels/opencl/kernel_lamp_emission.cl
  44. kernels/opencl/kernel_do_volume.cl
  45. kernels/opencl/kernel_indirect_background.cl
  46. kernels/opencl/kernel_shader_setup.cl
  47. kernels/opencl/kernel_shader_sort.cl
  48. kernels/opencl/kernel_shader_eval.cl
  49. kernels/opencl/kernel_holdout_emission_blurring_pathtermination_ao.cl
  50. kernels/opencl/kernel_subsurface_scatter.cl
  51. kernels/opencl/kernel_direct_lighting.cl
  52. kernels/opencl/kernel_shadow_blocked_ao.cl
  53. kernels/opencl/kernel_shadow_blocked_dl.cl
  54. kernels/opencl/kernel_enqueue_inactive.cl
  55. kernels/opencl/kernel_next_iteration_setup.cl
  56. kernels/opencl/kernel_indirect_subsurface.cl
  57. kernels/opencl/kernel_buffer_update.cl
  58. kernels/opencl/filter.cl
  59. )
  60. set(SRC_BVH_HEADERS
  61. bvh/bvh.h
  62. bvh/bvh_nodes.h
  63. bvh/bvh_shadow_all.h
  64. bvh/bvh_local.h
  65. bvh/bvh_traversal.h
  66. bvh/bvh_types.h
  67. bvh/bvh_volume.h
  68. bvh/bvh_volume_all.h
  69. bvh/qbvh_nodes.h
  70. bvh/qbvh_shadow_all.h
  71. bvh/qbvh_local.h
  72. bvh/qbvh_traversal.h
  73. bvh/qbvh_volume.h
  74. bvh/qbvh_volume_all.h
  75. bvh/obvh_nodes.h
  76. bvh/obvh_shadow_all.h
  77. bvh/obvh_local.h
  78. bvh/obvh_traversal.h
  79. bvh/obvh_volume.h
  80. bvh/obvh_volume_all.h
  81. bvh/bvh_embree.h
  82. )
  83. set(SRC_HEADERS
  84. kernel_accumulate.h
  85. kernel_bake.h
  86. kernel_camera.h
  87. kernel_color.h
  88. kernel_compat_cpu.h
  89. kernel_compat_cuda.h
  90. kernel_compat_opencl.h
  91. kernel_differential.h
  92. kernel_emission.h
  93. kernel_film.h
  94. kernel_globals.h
  95. kernel_id_passes.h
  96. kernel_jitter.h
  97. kernel_light.h
  98. kernel_math.h
  99. kernel_montecarlo.h
  100. kernel_passes.h
  101. kernel_path.h
  102. kernel_path_branched.h
  103. kernel_path_common.h
  104. kernel_path_state.h
  105. kernel_path_surface.h
  106. kernel_path_subsurface.h
  107. kernel_path_volume.h
  108. kernel_profiling.h
  109. kernel_projection.h
  110. kernel_queues.h
  111. kernel_random.h
  112. kernel_shader.h
  113. kernel_shadow.h
  114. kernel_subsurface.h
  115. kernel_textures.h
  116. kernel_types.h
  117. kernel_volume.h
  118. kernel_work_stealing.h
  119. )
  120. set(SRC_KERNELS_CPU_HEADERS
  121. kernel.h
  122. kernels/cpu/kernel_cpu.h
  123. kernels/cpu/kernel_cpu_impl.h
  124. kernels/cpu/kernel_cpu_image.h
  125. kernels/cpu/filter_cpu.h
  126. kernels/cpu/filter_cpu_impl.h
  127. )
  128. set(SRC_KERNELS_CUDA_HEADERS
  129. kernels/cuda/kernel_config.h
  130. kernels/cuda/kernel_cuda_image.h
  131. )
  132. set(SRC_KERNELS_OPENCL_HEADERS
  133. kernels/opencl/kernel_split_function.h
  134. kernels/opencl/kernel_opencl_image.h
  135. )
  136. set(SRC_CLOSURE_HEADERS
  137. closure/alloc.h
  138. closure/bsdf.h
  139. closure/bsdf_ashikhmin_velvet.h
  140. closure/bsdf_diffuse.h
  141. closure/bsdf_diffuse_ramp.h
  142. closure/bsdf_microfacet.h
  143. closure/bsdf_microfacet_multi.h
  144. closure/bsdf_microfacet_multi_impl.h
  145. closure/bsdf_oren_nayar.h
  146. closure/bsdf_phong_ramp.h
  147. closure/bsdf_reflection.h
  148. closure/bsdf_refraction.h
  149. closure/bsdf_toon.h
  150. closure/bsdf_transparent.h
  151. closure/bsdf_util.h
  152. closure/bsdf_ashikhmin_shirley.h
  153. closure/bsdf_hair.h
  154. closure/bssrdf.h
  155. closure/emissive.h
  156. closure/volume.h
  157. closure/bsdf_principled_diffuse.h
  158. closure/bsdf_principled_sheen.h
  159. closure/bsdf_hair_principled.h
  160. )
  161. set(SRC_SVM_HEADERS
  162. svm/svm.h
  163. svm/svm_ao.h
  164. svm/svm_attribute.h
  165. svm/svm_bevel.h
  166. svm/svm_blackbody.h
  167. svm/svm_bump.h
  168. svm/svm_camera.h
  169. svm/svm_closure.h
  170. svm/svm_convert.h
  171. svm/svm_checker.h
  172. svm/svm_color_util.h
  173. svm/svm_brick.h
  174. svm/svm_displace.h
  175. svm/svm_fresnel.h
  176. svm/svm_wireframe.h
  177. svm/svm_wavelength.h
  178. svm/svm_gamma.h
  179. svm/svm_brightness.h
  180. svm/svm_geometry.h
  181. svm/svm_gradient.h
  182. svm/svm_hsv.h
  183. svm/svm_ies.h
  184. svm/svm_image.h
  185. svm/svm_invert.h
  186. svm/svm_light_path.h
  187. svm/svm_magic.h
  188. svm/svm_mapping.h
  189. svm/svm_math.h
  190. svm/svm_math_util.h
  191. svm/svm_mix.h
  192. svm/svm_musgrave.h
  193. svm/svm_noise.h
  194. svm/svm_noisetex.h
  195. svm/svm_normal.h
  196. svm/svm_ramp.h
  197. svm/svm_ramp_util.h
  198. svm/svm_sepcomb_hsv.h
  199. svm/svm_sepcomb_vector.h
  200. svm/svm_sky.h
  201. svm/svm_tex_coord.h
  202. svm/svm_texture.h
  203. svm/svm_types.h
  204. svm/svm_value.h
  205. svm/svm_vector_transform.h
  206. svm/svm_voronoi.h
  207. svm/svm_voxel.h
  208. svm/svm_wave.h
  209. )
  210. set(SRC_GEOM_HEADERS
  211. geom/geom.h
  212. geom/geom_attribute.h
  213. geom/geom_curve.h
  214. geom/geom_curve_intersect.h
  215. geom/geom_motion_curve.h
  216. geom/geom_motion_triangle.h
  217. geom/geom_motion_triangle_intersect.h
  218. geom/geom_motion_triangle_shader.h
  219. geom/geom_object.h
  220. geom/geom_patch.h
  221. geom/geom_primitive.h
  222. geom/geom_subd_triangle.h
  223. geom/geom_triangle.h
  224. geom/geom_triangle_intersect.h
  225. geom/geom_volume.h
  226. )
  227. set(SRC_FILTER_HEADERS
  228. filter/filter.h
  229. filter/filter_defines.h
  230. filter/filter_features.h
  231. filter/filter_features_sse.h
  232. filter/filter_kernel.h
  233. filter/filter_nlm_cpu.h
  234. filter/filter_nlm_gpu.h
  235. filter/filter_prefilter.h
  236. filter/filter_reconstruction.h
  237. filter/filter_transform.h
  238. filter/filter_transform_gpu.h
  239. filter/filter_transform_sse.h
  240. )
  241. set(SRC_UTIL_HEADERS
  242. ../util/util_atomic.h
  243. ../util/util_color.h
  244. ../util/util_defines.h
  245. ../util/util_half.h
  246. ../util/util_hash.h
  247. ../util/util_math.h
  248. ../util/util_math_fast.h
  249. ../util/util_math_intersect.h
  250. ../util/util_math_float2.h
  251. ../util/util_math_float3.h
  252. ../util/util_math_float4.h
  253. ../util/util_math_int2.h
  254. ../util/util_math_int3.h
  255. ../util/util_math_int4.h
  256. ../util/util_math_matrix.h
  257. ../util/util_projection.h
  258. ../util/util_rect.h
  259. ../util/util_static_assert.h
  260. ../util/util_transform.h
  261. ../util/util_texture.h
  262. ../util/util_types.h
  263. ../util/util_types_float2.h
  264. ../util/util_types_float2_impl.h
  265. ../util/util_types_float3.h
  266. ../util/util_types_float3_impl.h
  267. ../util/util_types_float4.h
  268. ../util/util_types_float4_impl.h
  269. ../util/util_types_float8.h
  270. ../util/util_types_float8_impl.h
  271. ../util/util_types_int2.h
  272. ../util/util_types_int2_impl.h
  273. ../util/util_types_int3.h
  274. ../util/util_types_int3_impl.h
  275. ../util/util_types_int4.h
  276. ../util/util_types_int4_impl.h
  277. ../util/util_types_uchar2.h
  278. ../util/util_types_uchar2_impl.h
  279. ../util/util_types_uchar3.h
  280. ../util/util_types_uchar3_impl.h
  281. ../util/util_types_uchar4.h
  282. ../util/util_types_uchar4_impl.h
  283. ../util/util_types_uint2.h
  284. ../util/util_types_uint2_impl.h
  285. ../util/util_types_uint3.h
  286. ../util/util_types_uint3_impl.h
  287. ../util/util_types_uint4.h
  288. ../util/util_types_uint4_impl.h
  289. ../util/util_types_ushort4.h
  290. ../util/util_types_vector3.h
  291. ../util/util_types_vector3_impl.h
  292. )
  293. set(SRC_SPLIT_HEADERS
  294. split/kernel_branched.h
  295. split/kernel_buffer_update.h
  296. split/kernel_data_init.h
  297. split/kernel_direct_lighting.h
  298. split/kernel_do_volume.h
  299. split/kernel_enqueue_inactive.h
  300. split/kernel_holdout_emission_blurring_pathtermination_ao.h
  301. split/kernel_indirect_background.h
  302. split/kernel_indirect_subsurface.h
  303. split/kernel_lamp_emission.h
  304. split/kernel_next_iteration_setup.h
  305. split/kernel_path_init.h
  306. split/kernel_queue_enqueue.h
  307. split/kernel_scene_intersect.h
  308. split/kernel_shader_setup.h
  309. split/kernel_shader_sort.h
  310. split/kernel_shader_eval.h
  311. split/kernel_shadow_blocked_ao.h
  312. split/kernel_shadow_blocked_dl.h
  313. split/kernel_split_common.h
  314. split/kernel_split_data.h
  315. split/kernel_split_data_types.h
  316. split/kernel_subsurface_scatter.h
  317. )
  318. set(LIB
  319. )
  320. # CUDA module
  321. if(WITH_CYCLES_CUDA_BINARIES)
  322. # 64 bit only
  323. set(CUDA_BITS 64)
  324. # CUDA version
  325. execute_process(COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
  326. string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR "${NVCC_OUT}")
  327. string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${NVCC_OUT}")
  328. set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")
  329. # warn for other versions
  330. if(CUDA_VERSION MATCHES "101")
  331. else()
  332. message(WARNING
  333. "CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
  334. "build may succeed but only CUDA 10.1 is officially supported")
  335. endif()
  336. # build for each arch
  337. set(cuda_sources kernels/cuda/kernel.cu kernels/cuda/kernel_split.cu
  338. ${SRC_HEADERS}
  339. ${SRC_KERNELS_CUDA_HEADERS}
  340. ${SRC_BVH_HEADERS}
  341. ${SRC_SVM_HEADERS}
  342. ${SRC_GEOM_HEADERS}
  343. ${SRC_CLOSURE_HEADERS}
  344. ${SRC_UTIL_HEADERS}
  345. )
  346. set(cuda_filter_sources kernels/cuda/filter.cu
  347. ${SRC_HEADERS}
  348. ${SRC_KERNELS_CUDA_HEADERS}
  349. ${SRC_FILTER_HEADERS}
  350. ${SRC_UTIL_HEADERS}
  351. )
  352. set(cuda_cubins)
  353. macro(CYCLES_CUDA_KERNEL_ADD arch prev_arch name flags sources experimental)
  354. set(cuda_cubin ${name}_${arch}.cubin)
  355. set(kernel_sources ${sources})
  356. if(NOT ${prev_arch} STREQUAL "none")
  357. set(kernel_sources ${kernel_sources} ${name}_${prev_arch}.cubin)
  358. endif()
  359. set(cuda_kernel_src "/kernels/cuda/${name}.cu")
  360. set(cuda_flags
  361. -D CCL_NAMESPACE_BEGIN=
  362. -D CCL_NAMESPACE_END=
  363. -D NVCC
  364. -m ${CUDA_BITS}
  365. -I ${CMAKE_CURRENT_SOURCE_DIR}/..
  366. -I ${CMAKE_CURRENT_SOURCE_DIR}/kernels/cuda
  367. --use_fast_math
  368. -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin})
  369. if(${experimental})
  370. set(cuda_flags ${cuda_flags} -D __KERNEL_EXPERIMENTAL__)
  371. set(name ${name}_experimental)
  372. endif()
  373. if(WITH_CYCLES_DEBUG)
  374. set(cuda_flags ${cuda_flags} -D __KERNEL_DEBUG__)
  375. endif()
  376. if(WITH_CYCLES_CUBIN_COMPILER)
  377. string(SUBSTRING ${arch} 3 -1 CUDA_ARCH)
  378. # Needed to find libnvrtc-builtins.so. Can't do it from inside
  379. # cycles_cubin_cc since the env variable is read before main()
  380. if(APPLE)
  381. set(CUBIN_CC_ENV ${CMAKE_COMMAND}
  382. -E env DYLD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib")
  383. elseif(UNIX)
  384. set(CUBIN_CC_ENV ${CMAKE_COMMAND}
  385. -E env LD_LIBRARY_PATH="${CUDA_TOOLKIT_ROOT_DIR}/lib64")
  386. endif()
  387. add_custom_command(
  388. OUTPUT ${cuda_cubin}
  389. COMMAND ${CUBIN_CC_ENV}
  390. "$<TARGET_FILE:cycles_cubin_cc>"
  391. -target ${CUDA_ARCH}
  392. -i ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src}
  393. ${cuda_flags}
  394. -v
  395. -cuda-toolkit-dir "${CUDA_TOOLKIT_ROOT_DIR}"
  396. DEPENDS ${kernel_sources} cycles_cubin_cc)
  397. else()
  398. add_custom_command(
  399. OUTPUT ${cuda_cubin}
  400. COMMAND ${CUDA_NVCC_EXECUTABLE}
  401. -arch=${arch}
  402. ${CUDA_NVCC_FLAGS}
  403. --cubin
  404. ${CMAKE_CURRENT_SOURCE_DIR}${cuda_kernel_src}
  405. --ptxas-options="-v"
  406. ${cuda_flags}
  407. DEPENDS ${kernel_sources})
  408. endif()
  409. delayed_install("${CMAKE_CURRENT_BINARY_DIR}" "${cuda_cubin}" ${CYCLES_INSTALL_PATH}/lib)
  410. list(APPEND cuda_cubins ${cuda_cubin})
  411. unset(cuda_debug_flags)
  412. endmacro()
  413. set(prev_arch "none")
  414. foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
  415. if(${arch} MATCHES "sm_2.")
  416. message(STATUS "CUDA binaries for ${arch} are no longer supported, skipped.")
  417. elseif(${arch} MATCHES "sm_7." AND ${CUDA_VERSION} LESS 100)
  418. message(STATUS "CUDA binaries for ${arch} require CUDA 10.0+, skipped.")
  419. else()
  420. # Compile regular kernel
  421. CYCLES_CUDA_KERNEL_ADD(${arch} ${prev_arch} filter "" "${cuda_filter_sources}" FALSE)
  422. CYCLES_CUDA_KERNEL_ADD(${arch} ${prev_arch} kernel "" "${cuda_sources}" FALSE)
  423. if(WITH_CYCLES_CUDA_SPLIT_KERNEL_BINARIES)
  424. # Compile split kernel
  425. CYCLES_CUDA_KERNEL_ADD(${arch} ${prev_arch} kernel_split "-D __SPLIT__" "${cuda_sources}" FALSE)
  426. endif()
  427. if(WITH_CYCLES_CUDA_BUILD_SERIAL)
  428. set(prev_arch ${arch})
  429. endif()
  430. endif()
  431. endforeach()
  432. add_custom_target(cycles_kernel_cuda ALL DEPENDS ${cuda_cubins})
  433. cycles_set_solution_folder(cycles_kernel_cuda)
  434. endif()
  435. # OSL module
  436. if(WITH_CYCLES_OSL)
  437. list(APPEND LIB
  438. cycles_kernel_osl
  439. )
  440. add_subdirectory(osl)
  441. add_subdirectory(shaders)
  442. endif()
  443. # CPU module
  444. include_directories(${INC})
  445. include_directories(SYSTEM ${INC_SYS})
  446. set_source_files_properties(kernels/cpu/kernel.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_KERNEL_FLAGS}")
  447. set_source_files_properties(kernels/cpu/kernel_split.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_KERNEL_FLAGS}")
  448. set_source_files_properties(kernels/cpu/filter.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_KERNEL_FLAGS}")
  449. if(CXX_HAS_SSE)
  450. set_source_files_properties(kernels/cpu/kernel_sse2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS}")
  451. set_source_files_properties(kernels/cpu/kernel_sse3.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE3_KERNEL_FLAGS}")
  452. set_source_files_properties(kernels/cpu/kernel_sse41.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE41_KERNEL_FLAGS}")
  453. set_source_files_properties(kernels/cpu/kernel_split_sse2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS}")
  454. set_source_files_properties(kernels/cpu/kernel_split_sse3.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE3_KERNEL_FLAGS}")
  455. set_source_files_properties(kernels/cpu/kernel_split_sse41.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE41_KERNEL_FLAGS}")
  456. set_source_files_properties(kernels/cpu/filter_sse2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE2_KERNEL_FLAGS}")
  457. set_source_files_properties(kernels/cpu/filter_sse3.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE3_KERNEL_FLAGS}")
  458. set_source_files_properties(kernels/cpu/filter_sse41.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_SSE41_KERNEL_FLAGS}")
  459. endif()
  460. if(CXX_HAS_AVX)
  461. set_source_files_properties(kernels/cpu/kernel_avx.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX_KERNEL_FLAGS}")
  462. set_source_files_properties(kernels/cpu/kernel_split_avx.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX_KERNEL_FLAGS}")
  463. set_source_files_properties(kernels/cpu/filter_avx.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX_KERNEL_FLAGS}")
  464. endif()
  465. if(CXX_HAS_AVX2)
  466. set_source_files_properties(kernels/cpu/kernel_avx2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
  467. set_source_files_properties(kernels/cpu/kernel_split_avx2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
  468. set_source_files_properties(kernels/cpu/filter_avx2.cpp PROPERTIES COMPILE_FLAGS "${CYCLES_AVX2_KERNEL_FLAGS}")
  469. endif()
  470. cycles_add_library(cycles_kernel "${LIB}"
  471. ${SRC_CPU_KERNELS}
  472. ${SRC_CUDA_KERNELS}
  473. ${SRC_OPENCL_KERNELS}
  474. ${SRC_HEADERS}
  475. ${SRC_KERNELS_CPU_HEADERS}
  476. ${SRC_KERNELS_CUDA_HEADERS}
  477. ${SRC_KERNELS_OPENCL_HEADERS}
  478. ${SRC_BVH_HEADERS}
  479. ${SRC_CLOSURE_HEADERS}
  480. ${SRC_FILTER_HEADERS}
  481. ${SRC_SVM_HEADERS}
  482. ${SRC_GEOM_HEADERS}
  483. ${SRC_SPLIT_HEADERS}
  484. )
  485. if(WITH_CYCLES_CUDA)
  486. add_dependencies(cycles_kernel cycles_kernel_cuda)
  487. endif()
  488. # OpenCL kernel
  489. #set(KERNEL_PREPROCESSED ${CMAKE_CURRENT_BINARY_DIR}/kernel_preprocessed.cl)
  490. #add_custom_command(
  491. # OUTPUT ${KERNEL_PREPROCESSED}
  492. # COMMAND gcc -x c++ -E ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cl -I ${CMAKE_CURRENT_SOURCE_DIR}/../util/ -DCCL_NAMESPACE_BEGIN= -DCCL_NAMESPACE_END= -o ${KERNEL_PREPROCESSED}
  493. # DEPENDS ${SRC_KERNEL} ${SRC_UTIL_HEADERS})
  494. #add_custom_target(cycles_kernel_preprocess ALL DEPENDS ${KERNEL_PREPROCESSED})
  495. #delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${KERNEL_PREPROCESSED}" ${CYCLES_INSTALL_PATH}/kernel)
  496. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_OPENCL_KERNELS}" ${CYCLES_INSTALL_PATH}/source/kernel/kernels/opencl)
  497. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_CUDA_KERNELS}" ${CYCLES_INSTALL_PATH}/source/kernel/kernels/cuda)
  498. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel)
  499. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNELS_OPENCL_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/kernels/opencl)
  500. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_KERNELS_CUDA_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/kernels/cuda)
  501. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_BVH_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/bvh)
  502. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_CLOSURE_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/closure)
  503. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_FILTER_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/filter)
  504. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SVM_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/svm)
  505. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_GEOM_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/geom)
  506. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_UTIL_HEADERS}" ${CYCLES_INSTALL_PATH}/source/util)
  507. delayed_install(${CMAKE_CURRENT_SOURCE_DIR} "${SRC_SPLIT_HEADERS}" ${CYCLES_INSTALL_PATH}/source/kernel/split)