mlx/tests/CMakeLists.txt

45 lines
1.2 KiB
CMake
Raw Normal View History

# Doctest works fine with cmake 3.5
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
2023-11-30 02:30:41 +08:00
FetchContent_Declare(
doctest
GIT_REPOSITORY "https://github.com/onqtam/doctest"
GIT_TAG "ae7a13539fb71f270b87eb2e874fbac80bc8dda2")
2023-11-30 02:30:41 +08:00
FetchContent_MakeAvailable(doctest)
add_executable(tests ${PROJECT_SOURCE_DIR}/tests/tests.cpp)
2025-05-07 12:26:46 +08:00
if(MLX_BUILD_METAL OR MLX_BUILD_CUDA)
set(METAL_TEST_SOURCES gpu_tests.cpp test_metal_svd.cpp)
2023-11-30 02:30:41 +08:00
endif()
2024-02-19 23:03:56 +08:00
include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake)
target_sources(
tests
PRIVATE allocator_tests.cpp
array_tests.cpp
arg_reduce_tests.cpp
autograd_tests.cpp
blas_tests.cpp
compile_tests.cpp
custom_vjp_tests.cpp
creations_tests.cpp
device_tests.cpp
einsum_tests.cpp
export_import_tests.cpp
eval_tests.cpp
fft_tests.cpp
load_tests.cpp
ops_tests.cpp
random_tests.cpp
scheduler_tests.cpp
utils_tests.cpp
vmap_tests.cpp
linalg_tests.cpp
${METAL_TEST_SOURCES})
2023-11-30 02:30:41 +08:00
target_link_libraries(tests PRIVATE mlx doctest)
2024-02-19 23:03:56 +08:00
doctest_discover_tests(tests)
2023-11-30 02:30:41 +08:00
add_test(NAME tests COMMAND tests)