forked from facebookresearch/faiss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
50 lines (41 loc) · 1.53 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 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.
# @lint-ignore-every LINEWRAP
project(faiss_perf_tests)
set(BENCHMARK_ENABLE_TESTING OFF)
include(FetchContent)
FetchContent_Declare(googlebenchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG main) # need main for benchmark::benchmark
FetchContent_MakeAvailable(
googlebenchmark)
find_package(Threads REQUIRED)
find_package(OpenMP REQUIRED)
find_package(gflags REQUIRED)
add_library(faiss_perf_tests_utils
utils.cpp
)
# `#include <faiss/perf_tests/utils.h>` or any other headers
target_include_directories(faiss_perf_tests_utils PRIVATE
${PROJECT_SOURCE_DIR}/../..)
include(../cmake/link_to_faiss_lib.cmake)
link_to_faiss_lib(faiss_perf_tests_utils)
set(FAISS_PERF_TEST_SRC
bench_no_multithreading_rcq_search.cpp
bench_scalar_quantizer_accuracy.cpp
bench_scalar_quantizer_decode.cpp
bench_scalar_quantizer_distance.cpp
bench_scalar_quantizer_encode.cpp
)
foreach(bench ${FAISS_PERF_TEST_SRC})
get_filename_component(bench_exec ${bench} NAME_WE)
add_executable(${bench_exec} ${bench})
link_to_faiss_lib(${bench_exec})
target_link_libraries(${bench_exec} PRIVATE faiss_perf_tests_utils OpenMP::OpenMP_CXX benchmark::benchmark gflags)
# `#include <faiss/perf_tests/utils.h>` or any other headers
target_include_directories(${bench_exec} PRIVATE
${PROJECT_SOURCE_DIR}/../..)
endforeach()