-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
114 lines (97 loc) · 3.71 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
cmake_minimum_required(VERSION 3.2)
project(oio-kinetic)
find_package(PkgConfig)
find_program(PROTOBUF_EXE protoc)
find_program(RAGEL_EXE ragel)
set(LINKER_LANGUAGE CXX)
pkg_check_modules(GLOG libglog REQUIRED)
pkg_check_modules(PROTOBUF protobuf REQUIRED)
pkg_check_modules(CRYPTO libcrypto REQUIRED)
include_directories(BEFORE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/libmill
${PROTOBUF_INCLUDE_DIRECTORIES}
${CRYPTO_INCLUDE_DIRECTORIES}
${GLOG_INCLUDE_DIRECTORIES})
add_subdirectory(libmill)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -pipe -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -fno-inline")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2")
add_definitions(-DMILL_USE_PREFIX=1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
add_custom_command(OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/kinetic.pb.cc
${CMAKE_CURRENT_BINARY_DIR}/kinetic.pb.h
COMMAND ${PROTOBUF_EXE}
--cpp_out=${CMAKE_CURRENT_BINARY_DIR}
-I${CMAKE_CURRENT_SOURCE_DIR}/kinetic-protocol
${CMAKE_CURRENT_SOURCE_DIR}/kinetic-protocol/kinetic.proto
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kinetic-protocol/kinetic.proto)
add_library(oio-kinetic-client SHARED
utils/MillSocket.cpp
utils/MillSocket.h
utils/Socket.cpp
utils/Socket.h
utils/Addr.cpp
utils/Addr.h
utils/utils.h
utils/utils.cpp
${CMAKE_CURRENT_BINARY_DIR}/kinetic.pb.cc
${CMAKE_CURRENT_BINARY_DIR}/kinetic.pb.h
oio/api/Upload.h
oio/api/Download.h
oio/api/Removal.h
oio/api/Listing.h
oio/kinetic/rpc/Request.h
oio/kinetic/rpc/Exchange.h
oio/kinetic/rpc/Put.cpp
oio/kinetic/rpc/Put.h
oio/kinetic/rpc/Get.cpp
oio/kinetic/rpc/Get.h
oio/kinetic/rpc/GetKeyRange.cpp
oio/kinetic/rpc/GetKeyRange.h
oio/kinetic/rpc/GetNext.cpp
oio/kinetic/rpc/GetNext.h
oio/kinetic/rpc/Delete.cpp
oio/kinetic/rpc/Delete.h
oio/kinetic/client/ClientInterface.h
oio/kinetic/client/CoroutineClient.cpp
oio/kinetic/client/CoroutineClient.h
oio/kinetic/client/CoroutineClientFactory.cpp
oio/kinetic/client/CoroutineClientFactory.h
oio/kinetic/client/PendingExchange.cpp
oio/kinetic/client/PendingExchange.h
oio/kinetic/blob/Upload.cpp
oio/kinetic/blob/Upload.h
oio/kinetic/blob/Download.cpp
oio/kinetic/blob/Download.h
oio/kinetic/blob/Removal.cpp
oio/kinetic/blob/Removal.h
oio/kinetic/blob/Listing.cpp
oio/kinetic/blob/Listing.h)
target_link_libraries(oio-kinetic-client
protobuf mill_s ${CRYPTO_LIBRARIES} ${GLOG_LIBRARIES})
add_executable(test-rpc
oio/kinetic/client/TestExchange.cpp)
target_link_libraries(test-rpc oio-kinetic-client)
add_executable(test-client
oio/kinetic/blob/TestClient.cpp)
target_link_libraries(test-client oio-kinetic-client)
add_custom_command(OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/headers.cc
COMMAND ${RAGEL_EXE} -o ${CMAKE_CURRENT_BINARY_DIR}/headers.cc
${CMAKE_CURRENT_SOURCE_DIR}/oio/kinetic/proxy/headers.rl
DEPENDS oio/kinetic/proxy/headers.rl)
add_executable(oio-kinetic-proxy
http-parser/http_parser.c
http-parser/http_parser.h
${CMAKE_CURRENT_BINARY_DIR}/headers.cc
oio/kinetic/proxy/headers.h
oio/kinetic/proxy/main.cpp)
target_link_libraries(oio-kinetic-proxy oio-kinetic-client ${GLOG_LIBRARIES})