add_executable(Primitives
	main.cpp

	Averager.cpp
	Convert8BitSamples.cpp
	Convert16BitSamples.cpp
	DualFFT.cpp
	EdgeDetection.cpp
	KernelFusion.cpp
	Sampling.cpp
)

target_link_libraries(Primitives
	scopehal
	scopeprotocols
	Catch2::Catch2
	glslang::glslang
	glslang::glslang-default-resource-limits
	)

#Needed because Windows does not support RPATH and will otherwise not be able to find DLLs when catch_discover_tests runs the executable
if(WIN32)
add_custom_command(TARGET Primitives POST_BUILD
	COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_RUNTIME_DLLS:Primitives> $<TARGET_FILE_DIR:Primitives>
	COMMAND_EXPAND_LISTS
	)
endif()

if(${SECOND_TEST})
	catch_discover_tests(Primitives PROPERTIES ENVIRONMENT "SCOPEHAL_VULKAN_DEVICE_OVERRIDE=${SECOND_TEST_DEVICE}")
else()
	catch_discover_tests(Primitives)
endif()

add_dependencies(Primitives
	ngprotoshaders
	nghalshaders
	)

if(TARGET glslang::SPIRV)
	target_link_libraries(Primitives
		glslang::SPIRV
	)
endif()
