2020-08-14 15:01:43 -07:00
|
|
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This source code is licensed under the BSD-style license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
|
2021-03-26 14:27:30 -07:00
|
|
|
set(FAISS_TEST_SRC
|
2020-08-14 15:01:43 -07:00
|
|
|
test_binary_flat.cpp
|
|
|
|
test_dealloc_invlists.cpp
|
|
|
|
test_ivfpq_codec.cpp
|
|
|
|
test_ivfpq_indexing.cpp
|
|
|
|
test_lowlevel_ivf.cpp
|
2024-02-09 09:14:38 -08:00
|
|
|
test_ivf_index.cpp
|
2020-08-14 15:01:43 -07:00
|
|
|
test_merge.cpp
|
|
|
|
test_omp_threads.cpp
|
|
|
|
test_ondisk_ivf.cpp
|
|
|
|
test_pairs_decoding.cpp
|
|
|
|
test_params_override.cpp
|
|
|
|
test_pq_encoding.cpp
|
|
|
|
test_sliding_ivf.cpp
|
|
|
|
test_threaded_index.cpp
|
|
|
|
test_transfer_invlists.cpp
|
2021-10-05 15:52:40 -07:00
|
|
|
test_mem_leak.cpp
|
2022-06-16 09:20:19 -07:00
|
|
|
test_cppcontrib_sa_decode.cpp
|
2022-09-20 07:14:35 -07:00
|
|
|
test_cppcontrib_uintreader.cpp
|
2022-11-14 17:01:52 -08:00
|
|
|
test_simdlib.cpp
|
2023-01-03 14:39:11 -08:00
|
|
|
test_approx_topk.cpp
|
2023-02-06 12:52:28 -08:00
|
|
|
test_RCQ_cropping.cpp
|
2023-04-24 15:03:45 -07:00
|
|
|
test_distances_simd.cpp
|
2023-04-28 05:14:18 -07:00
|
|
|
test_heap.cpp
|
2023-05-04 13:25:02 -07:00
|
|
|
test_code_distance.cpp
|
2023-05-26 11:35:21 -07:00
|
|
|
test_hnsw.cpp
|
2023-08-16 09:30:41 -07:00
|
|
|
test_partitioning.cpp
|
2024-02-13 12:21:00 -08:00
|
|
|
test_fastscan_perf.cpp
|
2020-08-14 15:01:43 -07:00
|
|
|
)
|
|
|
|
|
2021-03-26 14:27:30 -07:00
|
|
|
add_executable(faiss_test ${FAISS_TEST_SRC})
|
|
|
|
|
2023-12-05 01:39:52 -08:00
|
|
|
if(NOT FAISS_OPT_LEVEL STREQUAL "avx2" AND NOT FAISS_OPT_LEVEL STREQUAL "avx512")
|
|
|
|
target_link_libraries(faiss_test PRIVATE faiss)
|
|
|
|
endif()
|
|
|
|
|
2021-03-26 14:27:30 -07:00
|
|
|
if(FAISS_OPT_LEVEL STREQUAL "avx2")
|
2022-07-20 23:46:31 -07:00
|
|
|
if(NOT WIN32)
|
|
|
|
target_compile_options(faiss_test PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-mavx2 -mfma>)
|
|
|
|
else()
|
|
|
|
target_compile_options(faiss_test PRIVATE $<$<COMPILE_LANGUAGE:CXX>:/arch:AVX2>)
|
|
|
|
endif()
|
2021-03-26 14:27:30 -07:00
|
|
|
target_link_libraries(faiss_test PRIVATE faiss_avx2)
|
2023-12-05 01:39:52 -08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(FAISS_OPT_LEVEL STREQUAL "avx512")
|
|
|
|
if(NOT WIN32)
|
|
|
|
target_compile_options(faiss_test PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-mavx2 -mfma -mavx512f -mavx512f -mavx512cd -mavx512vl -mavx512dq -mavx512bw>)
|
|
|
|
else()
|
|
|
|
target_compile_options(faiss_test PRIVATE $<$<COMPILE_LANGUAGE:CXX>:/arch:AVX512>)
|
|
|
|
endif()
|
|
|
|
target_link_libraries(faiss_test PRIVATE faiss_avx512)
|
2021-03-26 14:27:30 -07:00
|
|
|
endif()
|
|
|
|
|
2020-08-14 15:01:43 -07:00
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(googletest
|
2022-10-20 03:23:20 -07:00
|
|
|
URL "https://github.com/google/googletest/archive/release-1.12.1.tar.gz")
|
2020-08-14 15:01:43 -07:00
|
|
|
set(BUILD_GMOCK CACHE BOOL OFF)
|
|
|
|
set(INSTALL_GTEST CACHE BOOL OFF)
|
|
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
|
2020-08-15 03:59:37 -07:00
|
|
|
find_package(OpenMP REQUIRED)
|
|
|
|
|
2020-08-14 15:01:43 -07:00
|
|
|
target_link_libraries(faiss_test PRIVATE
|
2020-08-15 03:59:37 -07:00
|
|
|
OpenMP::OpenMP_CXX
|
|
|
|
gtest_main
|
|
|
|
)
|
2020-08-14 15:01:43 -07:00
|
|
|
|
|
|
|
# Defines `gtest_discover_tests()`.
|
|
|
|
include(GoogleTest)
|
|
|
|
gtest_discover_tests(faiss_test)
|