forked from learnedsystems/SOSD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
80 lines (64 loc) · 2.31 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
cmake_minimum_required(VERSION 3.10)
project(SOSD)
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
if (${LINUX})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -Wall -Wfatal-errors -march=native -fopenmp")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -Wall -Wfatal-errors -march=native")
endif ()
set(CMAKE_CXX_STANDARD 17)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_subdirectory(dtl)
if (${APPLE})
include_directories(/usr/local/include/) # required by Mac OS to find boost
endif ()
set(SOURCE_FILES util.h)
file(GLOB_RECURSE RMI_SOURCES "competitors/rmi/*.cpp")
file(GLOB_RECURSE BENCH_SOURCES "benchmarks/*.cc")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
# FIXME cannot link with g++-9
add_definitions(-DDISABLE_FST=1)
list(REMOVE_ITEM BENCH_SOURCES "${CMAKE_SOURCE_DIR}/benchmarks/benchmark_fst.cc")
endif ()
if (${APPLE})
# Certain headers (e.g., byteswap) not supported under Mac OS.
list(REMOVE_ITEM BENCH_SOURCES "${CMAKE_SOURCE_DIR}/benchmarks/benchmark_wormhole.cc")
endif ()
add_executable(generate generate.cc ${SOURCE_FILES})
target_link_libraries(generate Threads::Threads)
add_subdirectory(robin-map)
add_custom_target(
libfast64
COMMAND cargo build --release
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/fast64/
)
if (${LINUX})
add_custom_target(
libwh
COMMAND make libwh.so
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wormhole/
)
endif ()
add_executable(benchmark benchmark.cc ${SOURCE_FILES} ${RMI_SOURCES} ${BENCH_SOURCES})
target_include_directories(benchmark
PRIVATE "competitors/CHT/include"
PRIVATE "competitors/FST/include"
PRIVATE "competitors/PGM-index/include"
PRIVATE "competitors/rs/include"
PRIVATE "competitors/stx-btree-0.9/include"
PRIVATE "competitors/ts/include"
PRIVATE "fast64")
add_dependencies(benchmark libfast64)
if (${LINUX})
target_include_directories(benchmark PRIVATE "wormhole")
target_link_libraries(benchmark PRIVATE ${CMAKE_SOURCE_DIR}/wormhole/libwh.so)
add_dependencies(benchmark libwh)
endif ()
target_link_libraries(benchmark
PRIVATE ${CMAKE_SOURCE_DIR}/fast64/target/release/libfast64.a
PRIVATE tsl::robin_map
PRIVATE Threads::Threads dtl
PRIVATE dl)