-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
81 lines (63 loc) · 3.08 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
# No in-source build
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "In-source builds are not allowed.")
endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
project(ermia)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(LINK_FLAGS "-libverbs -lnuma -lpthread -lrt -lglog -lgflags")
link_libraries(${LINK_FLAGS})
# Use masstree for index
add_definitions(-DMASSTREE)
# Bypass write system calls
add_definitions(-DIN_MEMORY_ONLY=1)
set(MASSTREE_CONFIG "--enable-max-key-len=1024 --with-malloc=malloc")
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${CMAKE_CURRENT_SOURCE_DIR}/masstree/config-debug.h")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${CMAKE_CURRENT_SOURCE_DIR}/masstree/config-release.h")
endif()
# Assume 64-byte cache line
add_definitions(-DCACHELINE_SIZE=64)
include_directories(dbcore)
include_directories(masstree)
include_directories(third-party/sparsehash/src)
add_subdirectory(benchmarks)
add_subdirectory(dbcore)
add_subdirectory(masstree)
set_property(GLOBAL APPEND PROPERTY ALL_ERMIA_SRC
${CMAKE_CURRENT_SOURCE_DIR}/base_txn_btree.cc
${CMAKE_CURRENT_SOURCE_DIR}/ermia.cc
${CMAKE_CURRENT_SOURCE_DIR}/tuple.cc
${CMAKE_CURRENT_SOURCE_DIR}/txn.cc
)
get_property(LIB_ERMIA_SRC GLOBAL PROPERTY ALL_ERMIA_SRC)
# SI
add_library(ermia_si SHARED ${LIB_ERMIA_SRC})
add_executable(ermia_SI ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/dbtest.cc)
target_link_libraries(ermia_SI ermia_si)
# SI+SSN
add_library(ermia_si_ssn SHARED ${LIB_ERMIA_SRC})
set_target_properties(ermia_si_ssn PROPERTIES COMPILE_FLAGS "-DSSN -DEARLY_SSN_CHECK")
add_executable(ermia_SI_SSN ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/dbtest.cc)
set_target_properties(ermia_SI_SSN PROPERTIES COMPILE_FLAGS "-DSSN -DEARLY_SSN_CHECK")
target_link_libraries(ermia_SI_SSN ermia_si_ssn)
# SSI
add_library(ermia_ssi SHARED ${LIB_ERMIA_SRC})
set_target_properties(ermia_ssi PROPERTIES COMPILE_FLAGS "-DSSI")
add_executable(ermia_SSI ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/dbtest.cc)
set_target_properties(ermia_SSI PROPERTIES COMPILE_FLAGS "-DSSI")
target_link_libraries(ermia_SSI ermia_ssi)
# MVOCC
add_library(ermia_mvocc SHARED ${LIB_ERMIA_SRC})
set_target_properties(ermia_mvocc PROPERTIES COMPILE_FLAGS "-DMVOCC")
add_executable(ermia_MVOCC ${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/dbtest.cc)
set_target_properties(ermia_MVOCC PROPERTIES COMPILE_FLAGS "-DMVOCC")
target_link_libraries(ermia_MVOCC ermia_mvocc)
# Benchmark scripts
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/run.sh" DESTINATION ${CMAKE_BINARY_DIR})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/run2.sh" DESTINATION ${CMAKE_BINARY_DIR})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/run-cluster.sh" DESTINATION ${CMAKE_BINARY_DIR})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/run-rdma-cluster.sh" DESTINATION ${CMAKE_BINARY_DIR})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/run-tcp-cluster.sh" DESTINATION ${CMAKE_BINARY_DIR})
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/benchmarks/run_script.sh" DESTINATION ${CMAKE_BINARY_DIR})