-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
118 lines (96 loc) · 3.75 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
cmake_minimum_required(VERSION 3.10)
project(lavastone VERSION 0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(cmake/clang-cxx-dev-tools.cmake)
if(CMAKE_BUILD_TYPE MATCHES debug)
message("debug mode")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -Wall ")
add_definitions(-DDEBUG_ENABLED)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall ")
endif(CMAKE_BUILD_TYPE MATCHES debug)
if (KVDB MATCHES rocksdb)
message("building with RocksDB key-value store backend")
add_definitions(-DUSE_ROCKSDB)
else()
message("building with LevelDB key-value store backend")
endif(KVDB MATCHES rocksdb)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
include_directories(/usr/local/include include/)
message("searching for required package BOOST")
message("if this fails, run (Mac):")
message("brew install boost")
message("or (Ubuntu):")
message("apt-get install -y libboost-dev")
find_package(Boost REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
else()
message("did not find boost -- this is required")
endif()
find_package(Boost COMPONENTS serialization)
if (Boost_SERIALIZATION_FOUND)
set(BOOST_SERIALIZATION TRUE)
message("building boost benchmark with boost_serialization lib")
else()
set(BOOST_SERIALIZATION FALSE)
message("not building boost benchmark due to missing boost_serialization lib")
endif(Boost_SERIALIZATION_FOUND)
find_package(ROCKSDB)
if (ROCKSDB_LIBRARIES MATCHES NOTFOUND)
message("RocksDB not found, building without it")
else()
include_directories(${ROCKSDB_INCLUDE_DIRS})
set(LIBS ${LIBS} ${ROCKSDB_LIBRARIES})
endif (ROCKSDB_LIBRARIES MATCHES NOTFOUND)
find_package(LEVELDB)
if (LEVELDB_LIBRARIES MATCHES NOTFOUND)
message("LevelDB not found, building without it")
else()
include_directories(${LEVELDB_INCLUDE_DIRS})
set(LIBS ${LIBS} ${LEVELDB_LIBRARIES})
endif (LEVELDB_LIBRARIES MATCHES NOTFOUND)
find_package(Snappy)
if (Snappy_LIBRARIES MATCHES NOTFOUND)
message("Snappy not found, building without it")
else()
include_directories(${Snappy_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Snappy_LIBRARIES})
endif (Snappy_LIBRARIES MATCHES NOTFOUND)
find_package(ZSTD)
if (ZSTD_LIBRARIES MATCHES NOTFOUND)
message("ZSTD not found, building without it")
else()
include_directories(${ZSTD_INCLUDE_DIRS})
set(LIBS ${LIBS} ${ZSTD_LIBRARIES})
endif(ZSTD_LIBRARIES MATCHES NOTFOUND)
if (KVDB MATCHES rocksdb)
if (ROCKSDB_LIBRARIES MATCHES NOTFOUND)
message(FATAL_ERROR "missing RocksDB library and KVDB set to rocksdb -- please install RocksDB library")
endif (ROCKSDB_LIBRARIES MATCHES NOTFOUND)
else()
if (LEVELDB_LIBRARIES MATCHES NOTFOUND)
message(FATAL_ERROR "missing LevelDB library and KVDB set to leveldb (default) -- please install LevelDB library")
endif (LEVELDB_LIBRARIES MATCHES NOTFOUND)
endif (KVDB MATCHES rocksdb)
link_directories(/usr/local/lib)
add_library(gendata STATIC gendata.cpp)
set(LIBS ${LIBS} gendata pthread dl)
add_executable(test_gendata test_gendata.cpp)
add_executable(test_lavapack test_lavapack.cpp)
add_executable(test_lavastone test_lavastone.cpp)
add_executable(benchmark_lavastone benchmark_lavastone.cpp)
add_executable(demo demo.cpp)
add_executable(small_demo small_demo.cpp)
if (BOOST_SERIALIZATION MATCHES TRUE)
add_executable(benchmark_boost benchmark_boost.cpp)
target_link_libraries(benchmark_boost PUBLIC ${LIBS} Boost::serialization)
else()
endif(BOOST_SERIALIZATION MATCHES TRUE)
target_link_libraries(test_gendata PUBLIC ${LIBS})
target_link_libraries(test_lavapack PUBLIC ${LIBS})
target_link_libraries(test_lavastone PUBLIC ${LIBS})
target_link_libraries(benchmark_lavastone PUBLIC ${LIBS})
target_link_libraries(demo PUBLIC ${LIBS})
target_link_libraries(small_demo PUBLIC ${LIBS})