-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
82 lines (61 loc) · 2.13 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
cmake_minimum_required(VERSION 3.25)
include(CMakeFindDependencyMacro)
# allow faiss to build on m1 mac even though it's listed as unsupported.
set(VCPKG_INSTALL_OPTIONS "--allow-unsupported")
# Setup vcpkg script with CMake (note: should be placed before project() call)
set(CMAKE_TOOLCHAIN_FILE
${CMAKE_CURRENT_SOURCE_DIR}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
CACHE STRING "Vcpkg toolchain file")
file(READ "version.txt" version)
project(
lintdb
VERSION ${version}
DESCRIPTION "A multi-vector database for late interaction retrieval"
LANGUAGES CXX)
set(LINTDB_VERSION ${version})
include(GNUInstallDirs)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++17 -fPIC -O3 -D_LIBCPP_DISABLE_AVAILABILITY"
)
if(MSVC OR LINUX)
set(BLA_VENDOR "Intel10_64lp")
else()
set(BLA_VENDOR "OpenBLAS")
endif()
# the below is caused by github actions failing to build flatbuffers. therefore,
# we set this value so that we use a higher sdk version to build it.
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# https://conda-forge.org/docs/maintainer/knowledge_base/#newer-c-features-with-old-sdk
# if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(CMAKE_CXX_FLAGS
# "${CMAKE_CXX_FLAGS} ") endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
if(SKBUILD)
message("Building with scikit-build")
cmake_path(GET CMAKE_CURRENT_BINARY_DIR PARENT_PATH BUILD_PARENT_DIR)
set(ENV{MKLROOT}
"${BUILD_PARENT_DIR}/vcpkg_installed/x64-linux/lib/intel64")
set(OpenMP_libiomp5_LIBRARY
"${BUILD_PARENT_DIR}/vcpkg_installed/x64-linux/lib/intel64/libiomp5.so"
)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR})
option(ENABLE_PYTHON "Build Python extension." ON)
option(ENABLE_BENCHMARKS "Build benchmarks." ON)
option(ENABLE_SERVER "Build the server." OFF)
add_subdirectory(lintdb)
if(ENABLE_PYTHON)
add_subdirectory(lintdb/python)
endif()
IF(ENABLE_SERVER)
add_subdirectory(lintdb/server)
endif()
include(CTest)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
if(ENABLE_BENCHMARKS)
add_subdirectory(benchmarks)
endif()