-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
180 lines (157 loc) · 4.61 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
cmake_minimum_required(VERSION 3.13.4)
project(Achal)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O2")
set(CXX "g++-8")
set(CC "gcc-8")
set(CMAKE_BUILD_TYPE Debug)
if(${CMAKE_C_COMPILER} STREQUAL "/usr/bin/gcc-8")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi")
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(Boost COMPONENTS thread chrono REQUIRED)
find_library(LIBCONFIGPP_LOCATION libconfig++)
find_library(LIBCONFIG_LOCATION libconfig)
find_package(etcd-cpp-api)
find_library(log4cpp
NAMES log4cpp
PATHS /usr/lib /usr/lib64 /usr/local/lib /opt/local/lib
)
include_directories(${ETCD_CPP_INCLUDE_DIRS})
# Process Abseil's CMake build system
add_subdirectory(third-party/abseil-cpp)
include_directories(
src
third-party/abseil-cpp
#third-party/flat_hash_map // Compilation error on Raspberry Pi
third-party/robin-map/include
third-party/hopscotch-map/include
third-party/array-hash/include
~/usr/local/include
)
add_library(
achal
src/utils/misc.cpp
src/utils/sched.cpp
src/utils/logging.cpp
src/utils/binpack.cpp
src/utils/periodic_task.cpp
src/utils/periodic_timer.cpp
src/utils/kzh15_benchmark_generator.cpp
src/achal/config.cpp
src/achal/kvs_interface.cpp
src/achal/simple_kvs.cpp
src/achal/bft_kvs.cpp
src/achal/redis_kvs.cpp
src/achal/etcd_kvs.cpp
src/applications/inverted_pendulum_sim.cpp
src/applications/kzh15.cpp
)
target_link_libraries(
achal
)
add_executable(
tests
test/main.cpp
test/test_redis.cpp
test/test_config.cpp
test/test_binpack.cpp
test/test_periodic_timer.cpp
test/test_periodic_task.cpp
test/test_kzh15_benchmark_e2e.cpp
test/test_kzh15_benchmark_generator.cpp
test/test_eigtree.cpp
test/test_bft_kvs.cpp
test/test_etcd.cpp
)
target_link_libraries(
tests
achal
libconfig++.so
liblog4cpp.so
Threads::Threads
absl::flat_hash_map
absl::node_hash_map
Boost::thread
Boost::chrono
${ETCD_CPP_LIBRARIES}
)
add_executable(
bosch1
exp/bosch1.cpp
)
target_link_libraries(
achal
libconfig++.so
liblog4cpp.so
Threads::Threads
absl::flat_hash_map
absl::node_hash_map
Boost::thread
Boost::chrono
${ETCD_CPP_LIBRARIES}
)
target_link_libraries(
achal
libconfig++.so
liblog4cpp.so
Threads::Threads
absl::flat_hash_map
absl::node_hash_map
Boost::thread
Boost::chrono
${ETCD_CPP_LIBRARIES}
)
target_link_libraries(
bosch1
achal
libconfig++.so
liblog4cpp.so
Threads::Threads
absl::flat_hash_map
absl::node_hash_map
Boost::thread
Boost::chrono
${ETCD_CPP_LIBRARIES}
)
add_executable(
exp_ivp_1
exp/ivp1.cpp
)
target_link_libraries(
exp_ivp_1
achal
libconfig++.so
liblog4cpp.so
Threads::Threads
absl::flat_hash_map
absl::node_hash_map
Boost::thread
Boost::chrono
${ETCD_CPP_LIBRARIES}
)
# <------------ add hiredis dependency --------------->
find_path(HIREDIS_HEADER hiredis)
target_include_directories(achal PUBLIC ${HIREDIS_HEADER})
target_include_directories(tests PUBLIC ${HIREDIS_HEADER})
target_include_directories(exp_ivp_1 PUBLIC ${HIREDIS_HEADER})
target_include_directories(bosch1 PUBLIC ${HIREDIS_HEADER})
find_library(HIREDIS_LIB hiredis)
target_link_libraries(achal ${HIREDIS_LIB})
target_link_libraries(tests ${HIREDIS_LIB})
target_link_libraries(exp_ivp_1 ${HIREDIS_LIB})
target_link_libraries(bosch1 ${HIREDIS_LIB})
# <------------ add redis-plus-plus dependency -------------->
# NOTE: this should be *sw* NOT *redis++*
find_path(REDIS_PLUS_PLUS_HEADER sw)
target_include_directories(achal PUBLIC ${REDIS_PLUS_PLUS_HEADER})
target_include_directories(tests PUBLIC ${REDIS_PLUS_PLUS_HEADER})
target_include_directories(exp_ivp_1 PUBLIC ${REDIS_PLUS_PLUS_HEADER})
target_include_directories(bosch1 PUBLIC ${REDIS_PLUS_PLUS_HEADER})
find_library(REDIS_PLUS_PLUS_LIB redis++)
target_link_libraries(achal ${REDIS_PLUS_PLUS_LIB})
target_link_libraries(tests ${REDIS_PLUS_PLUS_LIB})
target_link_libraries(exp_ivp_1 ${REDIS_PLUS_PLUS_LIB})
target_link_libraries(bosch1 ${REDIS_PLUS_PLUS_LIB})