-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
200 lines (184 loc) · 7.6 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
cmake_minimum_required(VERSION 3.10)
project(
dtio
VERSION 0.0.1
DESCRIPTION "DTIO: A Data Task I/O system")
set(CMAKE_CXX_STANDARD 17)
include(GNUInstallDirs)
include_directories(include)
# include_directories("hermes_shm/include")
include_directories("adapter") # <-- here
# include_directories("")
include_directories(${INCLUDE_PATH})
link_libraries(${LIBRARY_PATH})
# define ones we have installed
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(MEMCACHED false)
set(NATS false)
set(MPI true)
set(HCL true)
#set(ROCKS true)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIMERMDM")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIMERTS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIMERTB")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIMERNATS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIMERDM")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIMERW")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIMER")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFTIMER")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOLLECT")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOVERHEADS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTIMERBASE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTABIOS")
set(COMMON_SRC
src/common/solver/default_solver.cpp
src/common/config_manager.cpp
src/common/solver/dp_solver.cpp
src/common/solver/random_solver.cpp
src/common/solver/round_robin_solver.cpp
src/common/solver/knapsack.cpp
# src/common/timer.cpp
src/common/data_manager/data_manager.cpp
src/common/client_interface/distributed_hashmap.cpp
src/common/metadata_manager/metadata_manager.cpp
src/dtio_system.cpp
src/common/client_interface/distributed_hashmap.cpp
src/common/client_interface/distributed_queue.cpp
src/common/external_clients/rocksdb_impl.cpp
src/common/external_clients/memcached_impl.cpp
# src/common/external_clients/nats_impl.cpp
src/common/external_clients/hcl_queue_impl.cpp
src/common/external_clients/hcl_map_impl.cpp
src/common/task_builder/task_builder.cpp)
set(DTIO_LIB_SRC src/lib/posix.cpp src/lib/mpi.cpp src/common/threadPool.cpp)
set(DTIO_INTERCEPTION adapter/posix/posix_api.cc)
set(DTIO_BRAHMA_INTERCEPTION adapter/brahma-interceptor/posix_api.cc)
set(DTIO_CLIENT_SRC src/client/main.cpp src/client/client.cpp
src/common/threadPool.cpp)
set(DTIO_SERVER_SRC src/system_manager/main.cpp
src/system_manager/system_manager_service.cpp)
set(DTIO_TS_SRC
src/task_scheduler/main.cpp src/task_scheduler/task_scheduler.cpp
src/task_scheduler/task_scheduler.h)
set(DTIO_WM_SRC src/worker_manager/main.cpp
src/worker_manager/worker_manager_service.cpp)
set(DTIO_WS_SRC
src/worker/api/posix_client.cpp src/worker/api/multi_client.cpp src/worker/program_repo/statistics.cpp
src/worker/main.cpp src/worker/worker.cpp)
set(DTIO_HM_SRC src/common/external_clients/hcl_map_impl/main.cpp
src/common/external_clients/hcl_map_impl.cpp)
if(DEFINED MPI)
find_package(MPI REQUIRED)
set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS})
include_directories(${MPI_INCLUDE_PATH})
endif()
if(DEFINED MEMCACHED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lmemcached -DMEMCACHED_P")
endif()
if(DEFINED HCL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lhcl -DHCL_P")
endif()
if(DEFINED ROCKS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DROCKS_P")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
find_package(brahma REQUIRED)
if (${BRAHMA_FOUND})
message(STATUS "[DTIO_INTERCEPTOR] found brahma headers at ${BRAHMA_INCLUDE_DIRS}")
include_directories(${BRAHMA_INCLUDE_DIRS})
set(DEPENDENCY_LIB ${DEPENDENCY_LIB} ${BRAHMA_LIBRARIES})
link_directories("${HOME}/root/lib/")
message(STATUS "[DTIO_INTERCEPTOR] found brahma lib at ${BRAHMA_LIBRARY}")
message("Brahma library path: ${BRAHMA_LIBRARY}")
else ()
message(FATAL_ERROR "-- [DTIO_INTERCEPTOR] brahma is needed for ${PROJECT_NAME} build")
endif ()
# Variable for setting the log level (1=ERROR, 2=WARN, 3=INFO, 4=DEBUG, 5=TRACE)
set(LOG_LEVEL 3 CACHE STRING "Set the log level")
# Define LOG_LEVEL
add_compile_definitions(LOG_LEVEL=${LOG_LEVEL})
add_library(dtio_common SHARED ${COMMON_SRC})
add_library(${PROJECT_NAME} SHARED ${DTIO_LIB_SRC})
add_library(dtio_posix_interception SHARED ${DTIO_INTERCEPTION})
add_library(dtio_brahma_interception SHARED ${DTIO_BRAHMA_INTERCEPTION})
# add_executable(dtio_client ${DTIO_CLIENT_SRC})
# add_executable(dtio_server ${DTIO_SERVER_SRC})
add_executable(dtio_task_scheduler ${DTIO_TS_SRC})
add_executable(dtio_worker_manager ${DTIO_WM_SRC})
add_executable(dtio_worker ${DTIO_WS_SRC})
add_executable(dtio_hclmap ${DTIO_HM_SRC})
function(dtio_set_libs target)
target_link_libraries(${target} yaml-cpp)
find_package(FMT REQUIRED)
if(FMT_FOUND)
target_link_libraries(${target} -lfmt)
endif()
if(DEFINED MPI)
target_link_libraries(${target} ${MPI_LIBRARIES})
endif()
if(DEFINED ROCKS)
target_link_libraries(${target} -lrocksdb)
endif()
if(DEFINED MEMCACHED)
target_link_libraries(${target} -lmemcached)
endif()
if(DEFINED NATS)
target_link_libraries(${target} -lnats)
endif()
if(DEFINED HCL)
target_link_libraries(${target} -lhcl)
endif()
target_link_libraries(${target} -pthread cityhash)
if(NOT ${target} STREQUAL "dtio_common")
message(${target})
add_dependencies(${target} dtio_common)
target_link_libraries(${target} dtio_common)
endif()
endfunction()
dtio_set_libs(dtio_common)
# dtio_set_libs(dtio_client)
# dtio_set_libs(dtio_server)
dtio_set_libs(dtio_task_scheduler)
dtio_set_libs(dtio_worker_manager)
dtio_set_libs(dtio_worker)
dtio_set_libs(dtio_hclmap)
dtio_set_libs(${PROJECT_NAME})
dtio_set_libs(dtio_posix_interception)
dtio_set_libs(dtio_brahma_interception)
add_dependencies(dtio_posix_interception dtio)
add_dependencies(dtio_brahma_interception dtio)
target_link_libraries(dtio_posix_interception dtio)
target_link_libraries(dtio_brahma_interception dtio)
set_target_properties(
${PROJECT_NAME}
PROPERTIES VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER include/dtio.h)
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(dtio_posix_interception PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(dtio_brahma_interception PROPERTIES LINKER_LANGUAGE CXX)
target_include_directories(${PROJECT_NAME} PRIVATE .)
target_link_libraries(dtio ${CMAKE_CXX_LINK_FLAGS})
target_link_libraries(dtio_posix_interception ${CMAKE_CXX_LINK_FLAGS})
target_link_libraries(dtio_brahma_interception ${CMAKE_CXX_LINK_FLAGS})
target_link_libraries(dtio_brahma_interception -lbrahma)
# target_link_libraries(dtio_posix_interception PRIVATE -Wall -fPIC)
install(DIRECTORY include DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(TARGETS dtio_common DESTINATION ${CMAKE_INSTALL_LIBDIR})
# install(TARGETS dtio_client DESTINATION ${CMAKE_INSTALL_BINDIR})
# install(TARGETS dtio_server DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS dtio_task_scheduler DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS dtio_worker_manager DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS dtio_worker DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS dtio_hclmap DESTINATION ${CMAKE_INSTALL_BINDIR})
install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
add_subdirectory(benchmark)
#add_subdirectory(adapter)
# add_subdirectory(hermes_shm)