if (NOT WIN32)
    add_executable(test_hardcoding test_hardcoding.cpp)
    target_link_libraries(test_hardcoding sphericart)
    target_compile_features(test_hardcoding PRIVATE cxx_std_17)
endif()

add_executable(test_samples test_samples.cpp)
target_link_libraries(test_samples sphericart)
target_compile_features(test_samples PRIVATE cxx_std_17)

add_executable(test_derivatives test_derivatives.cpp)
target_link_libraries(test_derivatives sphericart)
target_compile_features(test_derivatives PRIVATE cxx_std_17)

if (SPHERICART_ENABLE_SYCL)
     add_executable(test_derivatives_sycl test_derivatives_sycl.cpp)
     target_link_libraries(test_derivatives_sycl sphericart)
     target_compile_features(test_derivatives_sycl PRIVATE cxx_std_17)
endif()


if (SPHERICART_ENABLE_HIP)
     add_executable(test_derivatives_hip test_derivatives_hip.cpp)
     target_link_libraries(test_derivatives_hip sphericart ${ROCM_HIP_LIBRARY})
     target_include_directories(test_derivatives_hip PRIVATE ${ROCM_HIP_INCLUDE_DIR})
     target_compile_definitions(test_derivatives_hip PRIVATE __HIP_PLATFORM_AMD__=1)
     target_compile_features(test_derivatives_hip PRIVATE cxx_std_17)

     add_executable(test_hip_async test_hip_async.cpp)
     target_link_libraries(test_hip_async sphericart ${ROCM_HIP_LIBRARY})
     target_include_directories(test_hip_async PRIVATE ${ROCM_HIP_INCLUDE_DIR})
     target_compile_definitions(test_hip_async PRIVATE __HIP_PLATFORM_AMD__=1)
     target_compile_features(test_hip_async PRIVATE cxx_std_17)
endif()

if (NOT WIN32)
    add_test(NAME test_hardcoding COMMAND ./test_hardcoding)
endif()
add_test(NAME test_samples COMMAND ./test_samples)
add_test(NAME test_derivatives COMMAND ./test_derivatives)
if (SPHERICART_ENABLE_SYCL)
     add_test(NAME test_derivatives_sycl COMMAND ./test_derivatives_sycl)
endif()
if (SPHERICART_ENABLE_HIP)
     add_test(NAME test_derivatives_hip COMMAND ./test_derivatives_hip)
     add_test(NAME test_hip_async COMMAND ./test_hip_async)
endif()

if (SPHERICART_ENABLE_CUDA)
    add_executable(test_cuda_async test_cuda_async.cpp)
    target_link_libraries(test_cuda_async sphericart gpulite)
    target_compile_features(test_cuda_async PRIVATE cxx_std_17)
    add_test(NAME test_cuda_async COMMAND ./test_cuda_async)
else()
    add_executable(test_cuda_stub_api test_cuda_stub_api.cpp)
    target_link_libraries(test_cuda_stub_api sphericart)
    target_compile_features(test_cuda_stub_api PRIVATE cxx_std_17)
    add_test(NAME test_cuda_stub_api COMMAND ./test_cuda_stub_api)
endif()
