-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
120 lines (90 loc) · 3.78 KB
/
CMakeLists.txt
File metadata and controls
120 lines (90 loc) · 3.78 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
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
119
120
cmake_minimum_required(VERSION 3.20)
project(SCEE)
option(ENABLE_LSMTREE "Build LSMTree" OFF)
option(ENABLE_FJ "Only Fault Injection (WIP)" OFF)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(
-Wall
-Wno-unused-variable
-Wno-unused-but-set-variable
-Wno-unused-function
)
message("Build in ${CMAKE_BUILD_TYPE}")
# set(SANITIZE_FLAG "-fsanitize=address -DMI_TRACK_ASAN=1 -g")
# add_compile_definitions(MI_TRACK_ASAN=1)
set(CMAKE_C_FLAGS_RELEASE "-O3 ${SANITIZE_FLAG} -pthread")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 ${SANITIZE_FLAG} -pthread")
set(CMAKE_LD_FLAGS_RELEASE "${SANITIZE_FLAG} -pthread")
# add_compile_options(-g -Wno-format)
include_directories(include)
find_package(ZLIB REQUIRED)
find_package(Threads REQUIRED)
# https://github.com/microsoft/mimalloc
add_subdirectory(./third/mimalloc)
# find_package(mimalloc REQUIRED)
# add_library(mimalloc-static INTERFACE)
# https://github.com/HdrHistogram/HdrHistogram_c.git
add_subdirectory(third/HdrHistogram_c)
include_directories(third/HdrHistogram_c/include)
# find_package(hdr_histogram REQUIRED)
find_package(Boost REQUIRED COMPONENTS program_options)
add_subdirectory(third/isal-crc)
include_directories(third/isal-crc/include)
add_library(profile profile.cpp)
target_compile_definitions(profile PRIVATE ENABLE_PROFILE=true)
target_link_libraries(profile PRIVATE hdr_histogram_static)
add_library(profile-disable profile.cpp)
target_compile_definitions(profile-disable PRIVATE ENABLE_PROFILE=false)
target_link_libraries(profile-disable PRIVATE hdr_histogram_static)
add_library(profile_mem profile-mem.cpp)
target_compile_definitions(profile_mem PRIVATE ENABLE_PROFILE=true)
set(LIBS_deps Threads::Threads isal-crc mimalloc-static)
# SCEE lib
set(TARGET scee)
add_library(${TARGET} scee.cpp)
target_link_libraries(${TARGET} PRIVATE mimalloc-static)
set(LIBS ${TARGET} ${LIBS_deps} profile-disable)
# SCEE lib, but enable profile
set(TARGET scee_profile)
add_library(${TARGET} scee.cpp)
target_link_libraries(${TARGET} PRIVATE mimalloc-static profile)
set(LIBS_profile ${TARGET} ${LIBS_deps} profile)
# SCEE lib disable check
set(TARGET scee_nocheck)
add_library(${TARGET} scee.cpp)
target_link_libraries(${TARGET} PRIVATE mimalloc-static profile-disable)
target_compile_definitions(${TARGET} PUBLIC DISABLE_VALIDATION)
set(LIBS_nocheck ${TARGET} ${LIBS_deps})
# SCEE lib disable scee
set(TARGET scee_disabled)
add_library(${TARGET} scee.cpp)
target_link_libraries(${TARGET} PRIVATE mimalloc-static profile-disable)
target_compile_definitions(${TARGET} PRIVATE DISABLE_SCEE)
set(LIBS_disabled scee_disabled Threads::Threads mimalloc-static profile-disable)
set(TARGET scee_disabled_profile)
add_library(${TARGET} scee.cpp)
target_link_libraries(${TARGET} PRIVATE mimalloc-static profile)
target_compile_definitions(${TARGET} PRIVATE DISABLE_SCEE)
set(LIBS_disabled_profile scee_disabled_profile Threads::Threads mimalloc-static profile)
set(TARGET scee_sampling)
add_library(${TARGET} scee.cpp)
target_link_libraries(${TARGET} PRIVATE mimalloc-static profile-disable)
target_compile_definitions(${TARGET} PRIVATE SAMPLING)
set(LIBS_sampling scee_sampling Threads::Threads mimalloc-static profile-disable)
set(TARGET scee_sampling_profile)
add_library(${TARGET} scee.cpp)
target_link_libraries(${TARGET} PRIVATE mimalloc-static profile)
target_compile_definitions(${TARGET} PRIVATE SAMPLING)
set(LIBS_sampling_profile scee_sampling_profile Threads::Threads mimalloc-static profile)
add_subdirectory(ae)
if (ENABLE_LSMTREE)
message("build lsmtree")
find_package(PkgConfig REQUIRED)
set(GFLAGS_USE_TARGET_NAMESPACE ON)
find_package(gflags CONFIG REQUIRED)
add_subdirectory(lib/lsmtree)
add_subdirectory(lib/lsmtree.raw)
add_subdirectory(ae/lsmtree)
endif()