-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
107 lines (87 loc) · 3.94 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
cmake_minimum_required(VERSION 3.10)
project(basket VERSION 1.0.0 DESCRIPTION "Basket: A library for flexible distributed data containers")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gdwarf-2 -g3")
option(BASKET_ENABLE_RPCLIB "allow basket to use RPCLIB" ON)
option(BASKET_ENABLE_THALLIUM_TCP "allow basket to use RPCLIB" OFF)
option(BASKET_ENABLE_THALLIUM_ROCE "allow basket to use RPCLIB" OFF)
if(BASKET_ENABLE_RPCLIB)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASKET_ENABLE_RPCLIB")
message("BASKET_ENABLE_RPCLIB: ${BASKET_ENABLE_RPCLIB}")
elseif(BASKET_ENABLE_THALLIUM_TCP)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASKET_ENABLE_THALLIUM_TCP")
message("BASKET_ENABLE_THALLIUM_TCP: ${BASKET_ENABLE_THALLIUM_TCP}")
elseif(BASKET_ENABLE_THALLIUM_ROCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBASKET_ENABLE_THALLIUM_ROCE")
message("BASKET_ENABLE_THALLIUM_ROCE: ${BASKET_ENABLE_THALLIUM_ROCE}")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
include(GNUInstallDirs)
include_directories(src/basket)
include_directories(src)
include_directories(include)
set(BASKET_SRC include/basket/common/singleton.h
include/basket/common/debug.h
include/basket/common/enumerations.h
include/basket/common/macros.h
include/basket/common/configuration_manager.h
src/basket/common/debug.cpp
include/basket/common/constants.h
include/basket/common/typedefs.h
include/basket/common/data_structures.h
src/basket/common/data_structures.cpp
include/basket/communication/rpc_lib.h
src/basket/communication/rpc_lib.cpp
include/basket/unordered_map/unordered_map.h
include/basket/map/map.h
include/basket/multimap/multimap.h
include/basket/clock/global_clock.h
src/basket/clock/global_clock.cpp
include/basket/queue/queue.h
include/basket/priority_queue/priority_queue.h
include/basket/set/set.h
include/basket/sequencer/global_sequence.h
src/basket/sequencer/global_sequence.cpp
include/basket/communication/rpc_factory.h)
add_library(${PROJECT_NAME} SHARED ${BASKET_SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER include/basket.h)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
configure_file(basket.pc.in basket.pc @ONLY)
target_include_directories(${PROJECT_NAME} PRIVATE .)
if(BASKET_ENABLE_RPCLIB)
set(RPC_LIB_FLAGS -lrpc ${RPC_LIB_FLAGS})
endif()
if(BASKET_ENABLE_THALLIUM_ROCE OR BASKET_ENABLE_THALLIUM_TCP)
set(RPC_LIB_FLAGS -lthallium -lmercury -lmercury_util -lmargo -labt ${RPC_LIB_FLAGS})
endif()
set(LIB_FLAGS ${RPC_LIB_FLAGS} -lmpi -lpthread -lrt -lboost_filesystem)
# libs for NATS tests
#set(LIB_FLAGS ${LIB_FLAGS} -lnats)
# libs for Redis tests
#set(LIB_FLAGS ${LIB_FLAGS} -lev -L/home/kbateman/install/lib/ -L/home/kbateman/install/lib64/ -lhiredis -lredox)
target_link_libraries(basket ${LIB_FLAGS})
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if (DEFINED ENV{PKG_CONFIG_PATH})
install(FILES ${CMAKE_BINARY_DIR}/basket.pc
DESTINATION $ENV{PKG_CONFIG_PATH}/pkgconfig)
else()
install(FILES ${CMAKE_BINARY_DIR}/basket.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
endif()
option(BUILD_TEST "Build the unit tests" ON)
if(BUILD_TEST)
enable_testing()
include(CTest)
add_subdirectory(test)
foreach (example ${examples})
add_custom_command(TARGET ${example} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"" $<TARGET_FILE_DIR:${example}>)
endforeach()
endif()