forked from valkey-io/valkey-search
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
72 lines (56 loc) · 2.01 KB
/
Copy pathCMakeLists.txt
File metadata and controls
72 lines (56 loc) · 2.01 KB
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
cmake_minimum_required(VERSION 3.16)
# Project definition
project(
ValkeySearch
LANGUAGES C CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Use ccache to speed up incremental builds if available
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
message(STATUS "Using ccache: ${CCACHE_FOUND}")
set(CMAKE_C_COMPILER_LAUNCHER ccache)
set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
endif()
# This project can only compile macOS / Linux, we can use the UNIX predefined
# variable to test this
if(NOT UNIX)
message(FATAL_ERROR "valkey-search can only be built on Linux or macOS")
endif()
# Options
option(BUILD_UNIT_TESTS "Build valkey-search unit tests" ON)
option(WITH_SUBMODULES_SYSTEM "Use system submodules" OFF)
set(SAN_BUILD
""
CACHE STRING "Sanitizer to enable: 'address' or 'thread'")
if(APPLE)
add_compile_options(-Wno-defaulted-function-deleted)
endif()
# Initialise submodules (gRPC, Protobuf, GTest & Abseil)
add_subdirectory(submodules)
if(SAN_BUILD STREQUAL "address" OR SAN_BUILD STREQUAL "thread")
message(STATUS "${SAN_BUILD} sanitizer is enabled")
elseif(SAN_BUILD)
message(FATAL_ERROR "Supported sanitizers are 'address' or 'thread'")
endif()
message(STATUS "GRPC_CPP_PLUGIN_PATH is set to ${GRPC_CPP_PLUGIN_PATH}")
message(STATUS "protoc_EXE is set to ${protoc_EXE}")
message(STATUS "highwayhash include path: ${HIGHWAY_HASH_INCLUDE_PATH}")
set(CMAKE_CXX_STANDARD 20 REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR}/.deps/install/include)
include(valkey_search)
add_subdirectory(vmsdk)
add_subdirectory(third_party)
add_subdirectory(src)
if(BUILD_UNIT_TESTS)
message(STATUS "Building tests")
add_subdirectory(testing)
endif()
# Create a symbolic link to the root directory for compile_commands.json
execute_process(
COMMAND
${CMAKE_COMMAND} -E create_symlink
${CMAKE_BINARY_DIR}/compile_commands.json
${CMAKE_SOURCE_DIR}/compile_commands.json)