<commit_before>
set(INC
	.
	../util
	osl
	svm
)

set(INC_SYS

)

set(SRC
	kernel.cpp
	kernel.cl
	kernel.cu
)

set(SRC_HEADERS
	kernel.h
	kernel_accumulate.h
	kernel_bake.h
	kernel_camera.h
	kernel_compat_cpu.h
	kernel_compat_cuda.h
	kernel_compat_opencl.h
	kernel_differential.h
	kernel_emission.h
	kernel_film.h
	kernel_globals.h
	kernel_jitter.h
	kernel_light.h
	kernel_math.h
	kernel_montecarlo.h
	kernel_passes.h
	kernel_path.h
	kernel_path_state.h
	kernel_path_surface.h
	kernel_path_volume.h
	kernel_projection.h
	kernel_random.h
	kernel_shader.h
	kernel_shadow.h
	kernel_subsurface.h
	kernel_textures.h
	kernel_types.h
	kernel_volume.h
)

set(SRC_CLOSURE_HEADERS
	closure/bsdf.h
	closure/bsdf_ashikhmin_velvet.h
	closure/bsdf_diffuse.h
	closure/bsdf_diffuse_ramp.h
	closure/bsdf_microfacet.h
	closure/bsdf_oren_nayar.h
	closure/bsdf_phong_ramp.h
	closure/bsdf_reflection.h
	closure/bsdf_refraction.h
	closure/bsdf_toon.h
	closure/bsdf_transparent.h
	closure/bsdf_util.h
	closure/bsdf_ashikhmin_shirley.h
	closure/bsdf_westin.h
	closure/bsdf_hair.h
	closure/bssrdf.h
	closure/emissive.h
	closure/volume.h
)
set(SRC_SVM_HEADERS
	svm/svm.h
	svm/svm_attribute.h
	svm/svm_blackbody.h
	svm/svm_camera.h
	svm/svm_closure.h
	svm/svm_convert.h
	svm/svm_checker.h
	svm/svm_brick.h
	svm/svm_displace.h
	svm/svm_fresnel.h
	svm/svm_wireframe.h
	svm/svm_wavelength.h
	svm/svm_gamma.h
	svm/svm_brightness.h
	svm/svm_geometry.h
	svm/svm_gradient.h
	svm/svm_hsv.h
	svm/svm_image.h
	svm/svm_invert.h
	svm/svm_light_path.h
	svm/svm_magic.h
	svm/svm_mapping.h
	svm/svm_math.h
	svm/svm_mix.h
	svm/svm_musgrave.h
	svm/svm_noise.h
	svm/svm_noisetex.h
	svm/svm_normal.h
	svm/svm_ramp.h
	svm/svm_sepcomb_hsv.h
	svm/svm_sepcomb_vector.h
	svm/svm_sky.h
	svm/svm_tex_coord.h
	svm/svm_texture.h
	svm/svm_types.h
	svm/svm_value.h
	svm/svm_vector_transform.h
	svm/svm_voronoi.h
	svm/svm_wave.h
)

set(SRC_GEOM_HEADERS
	geom/geom.h
	geom/geom_attribute.h
	geom/geom_bvh.h
	geom/geom_bvh_shadow.h
	geom/geom_bvh_subsurface.h
	geom/geom_bvh_traversal.h
	geom/geom_curve.h
	geom/geom_motion_curve.h
	geom/geom_motion_triangle.h
	geom/geom_object.h
	geom/geom_primitive.h
	geom/geom_triangle.h
	geom/geom_volume.h
)

set(SRC_UTIL_HEADERS
	../util/util_color.h
	../util/util_half.h
	../util/util_math.h
	../util/util_transform.h
	../util/util_types.h
)
# CUDA module

if(WITH_CYCLES_CUDA_BINARIES)
	# 32 bit or 64 bit
	if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
		set(CUDA_BITS 64)
	else()
		set(CUDA_BITS 32)
	endif()

	# CUDA version
	execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
	string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT})
	string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT})
	set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")

	# warn for other versions
	if(CUDA_VERSION MATCHES "60")
	else()
		message(WARNING
			"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
			"build may succeed but only CUDA 6.0 is officially supported")
	endif()

	# build for each arch
	set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_GEOM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
	set(cuda_cubins)

	foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
		set(cuda_cubin kernel_${arch}.cubin)

		set(cuda_version_flags "-D__KERNEL_CUDA_VERSION__=${CUDA_VERSION}")
		set(cuda_math_flags "--use_fast_math")

		if(CUDA_VERSION LESS 60 AND ${arch} MATCHES "sm_50")
			message(WARNING "Can't build kernel for CUDA sm_50 architecture, skipping")
		elseif(CUDA_VERSION LESS 50 AND ${arch} MATCHES "sm_35")
			message(WARNING "Can't build kernel for CUDA sm_35 architecture, skipping")
		else()
			add_custom_command(
				OUTPUT ${cuda_cubin}
				COMMAND ${CUDA_NVCC_EXECUTABLE}
				        -arch=${arch}
				        -m${CUDA_BITS}
				        --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu
				        -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin}<commit_msg>Cmake: Remove warning for pre CUDA 5.0 Toolkit, not supported anymore<commit_after>
set(INC
	.
	../util
	osl
	svm
)

set(INC_SYS

)

set(SRC
	kernel.cpp
	kernel.cl
	kernel.cu
)

set(SRC_HEADERS
	kernel.h
	kernel_accumulate.h
	kernel_bake.h
	kernel_camera.h
	kernel_compat_cpu.h
	kernel_compat_cuda.h
	kernel_compat_opencl.h
	kernel_differential.h
	kernel_emission.h
	kernel_film.h
	kernel_globals.h
	kernel_jitter.h
	kernel_light.h
	kernel_math.h
	kernel_montecarlo.h
	kernel_passes.h
	kernel_path.h
	kernel_path_state.h
	kernel_path_surface.h
	kernel_path_volume.h
	kernel_projection.h
	kernel_random.h
	kernel_shader.h
	kernel_shadow.h
	kernel_subsurface.h
	kernel_textures.h
	kernel_types.h
	kernel_volume.h
)

set(SRC_CLOSURE_HEADERS
	closure/bsdf.h
	closure/bsdf_ashikhmin_velvet.h
	closure/bsdf_diffuse.h
	closure/bsdf_diffuse_ramp.h
	closure/bsdf_microfacet.h
	closure/bsdf_oren_nayar.h
	closure/bsdf_phong_ramp.h
	closure/bsdf_reflection.h
	closure/bsdf_refraction.h
	closure/bsdf_toon.h
	closure/bsdf_transparent.h
	closure/bsdf_util.h
	closure/bsdf_ashikhmin_shirley.h
	closure/bsdf_westin.h
	closure/bsdf_hair.h
	closure/bssrdf.h
	closure/emissive.h
	closure/volume.h
)
set(SRC_SVM_HEADERS
	svm/svm.h
	svm/svm_attribute.h
	svm/svm_blackbody.h
	svm/svm_camera.h
	svm/svm_closure.h
	svm/svm_convert.h
	svm/svm_checker.h
	svm/svm_brick.h
	svm/svm_displace.h
	svm/svm_fresnel.h
	svm/svm_wireframe.h
	svm/svm_wavelength.h
	svm/svm_gamma.h
	svm/svm_brightness.h
	svm/svm_geometry.h
	svm/svm_gradient.h
	svm/svm_hsv.h
	svm/svm_image.h
	svm/svm_invert.h
	svm/svm_light_path.h
	svm/svm_magic.h
	svm/svm_mapping.h
	svm/svm_math.h
	svm/svm_mix.h
	svm/svm_musgrave.h
	svm/svm_noise.h
	svm/svm_noisetex.h
	svm/svm_normal.h
	svm/svm_ramp.h
	svm/svm_sepcomb_hsv.h
	svm/svm_sepcomb_vector.h
	svm/svm_sky.h
	svm/svm_tex_coord.h
	svm/svm_texture.h
	svm/svm_types.h
	svm/svm_value.h
	svm/svm_vector_transform.h
	svm/svm_voronoi.h
	svm/svm_wave.h
)

set(SRC_GEOM_HEADERS
	geom/geom.h
	geom/geom_attribute.h
	geom/geom_bvh.h
	geom/geom_bvh_shadow.h
	geom/geom_bvh_subsurface.h
	geom/geom_bvh_traversal.h
	geom/geom_curve.h
	geom/geom_motion_curve.h
	geom/geom_motion_triangle.h
	geom/geom_object.h
	geom/geom_primitive.h
	geom/geom_triangle.h
	geom/geom_volume.h
)

set(SRC_UTIL_HEADERS
	../util/util_color.h
	../util/util_half.h
	../util/util_math.h
	../util/util_transform.h
	../util/util_types.h
)
# CUDA module

if(WITH_CYCLES_CUDA_BINARIES)
	# 32 bit or 64 bit
	if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
		set(CUDA_BITS 64)
	else()
		set(CUDA_BITS 32)
	endif()

	# CUDA version
	execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
	string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT})
	string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT})
	set(CUDA_VERSION "${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}")

	# warn for other versions
	if(CUDA_VERSION MATCHES "60")
	else()
		message(WARNING
			"CUDA version ${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR} detected, "
			"build may succeed but only CUDA 6.0 is officially supported")
	endif()

	# build for each arch
	set(cuda_sources kernel.cu ${SRC_HEADERS} ${SRC_SVM_HEADERS} ${SRC_GEOM_HEADERS} ${SRC_CLOSURE_HEADERS} ${SRC_UTIL_HEADERS})
	set(cuda_cubins)

	foreach(arch ${CYCLES_CUDA_BINARIES_ARCH})
		set(cuda_cubin kernel_${arch}.cubin)

		set(cuda_version_flags "-D__KERNEL_CUDA_VERSION__=${CUDA_VERSION}")
		set(cuda_math_flags "--use_fast_math")

		if(CUDA_VERSION LESS 60 AND ${arch} MATCHES "sm_50")
			message(WARNING "Can't build kernel for CUDA sm_50 architecture, skipping")
		else()
			add_custom_command(
				OUTPUT ${cuda_cubin}
				COMMAND ${CUDA_NVCC_EXECUTABLE}
				        -arch=${arch}
				        -m${CUDA_BITS}
				        --cubin ${CMAKE_CURRENT_SOURCE_DIR}/kernel.cu
				        -o ${CMAKE_CURRENT_BINARY_DIR}/${cuda_cubin}
{'fraction_non_alphanumeric': 0.11285822977428354, 'fraction_numerical': 0.008369261983261477, 'mean_word_length': 4.465696465696466, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1837539', 'n_tokens_mistral': 3903, 'n_tokens_neox': 3686, 'n_words': 487}