2020-08-15 06:01:43 +08: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-27 05:27:30 +08:00
|
|
|
set(FAISS_TEST_SRC
|
2020-08-15 06:01:43 +08:00
|
|
|
test_binary_flat.cpp
|
|
|
|
test_dealloc_invlists.cpp
|
|
|
|
test_ivfpq_codec.cpp
|
|
|
|
test_ivfpq_indexing.cpp
|
|
|
|
test_lowlevel_ivf.cpp
|
|
|
|
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-06 06:52:40 +08:00
|
|
|
test_mem_leak.cpp
|
2022-06-17 00:20:19 +08:00
|
|
|
test_cppcontrib_sa_decode.cpp
|
2022-09-20 22:14:35 +08:00
|
|
|
test_cppcontrib_uintreader.cpp
|
2022-11-15 09:01:52 +08:00
|
|
|
test_simdlib.cpp
|
2023-01-04 06:39:11 +08:00
|
|
|
test_approx_topk.cpp
|
2023-02-07 04:52:28 +08:00
|
|
|
test_RCQ_cropping.cpp
|
2023-04-25 06:03:45 +08:00
|
|
|
test_distances_simd.cpp
|
2023-04-28 20:14:18 +08:00
|
|
|
test_heap.cpp
|
2020-08-15 06:01:43 +08:00
|
|
|
)
|
|
|
|
|
2021-03-27 05:27:30 +08:00
|
|
|
add_executable(faiss_test ${FAISS_TEST_SRC})
|
|
|
|
|
|
|
|
if(FAISS_OPT_LEVEL STREQUAL "avx2")
|
2022-07-21 14:46:31 +08: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-27 05:27:30 +08:00
|
|
|
target_link_libraries(faiss_test PRIVATE faiss_avx2)
|
|
|
|
else()
|
|
|
|
target_link_libraries(faiss_test PRIVATE faiss)
|
|
|
|
endif()
|
|
|
|
|
2020-08-15 06:01:43 +08:00
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(googletest
|
2022-10-20 18:23:20 +08:00
|
|
|
URL "https://github.com/google/googletest/archive/release-1.12.1.tar.gz")
|
2020-08-15 06:01:43 +08:00
|
|
|
set(BUILD_GMOCK CACHE BOOL OFF)
|
|
|
|
set(INSTALL_GTEST CACHE BOOL OFF)
|
|
|
|
FetchContent_MakeAvailable(googletest)
|
|
|
|
|
2020-08-15 18:59:37 +08:00
|
|
|
find_package(OpenMP REQUIRED)
|
|
|
|
|
2020-08-15 06:01:43 +08:00
|
|
|
target_link_libraries(faiss_test PRIVATE
|
2020-08-15 18:59:37 +08:00
|
|
|
OpenMP::OpenMP_CXX
|
|
|
|
gtest_main
|
|
|
|
)
|
2020-08-15 06:01:43 +08:00
|
|
|
|
|
|
|
# Defines `gtest_discover_tests()`.
|
|
|
|
include(GoogleTest)
|
|
|
|
gtest_discover_tests(faiss_test)
|