-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
111 lines (95 loc) · 2.85 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
cmake_minimum_required(VERSION 3.10)
project(buffer-bench)
set(CMAKE_CXX_STANDARD 17)
# set(_PROTOBUF_LIBPROTOBUF libprotobuf)
set(_GRPC_GRPCPP_UNSECURE grpc++_unsecure)
# add_definitions("-DGRPC_USE_PROTO_LITE")
# GRPC and Protocol Buffers libraries location
list(APPEND CMAKE_PREFIX_PATH "/opt/grpc" "/opt/protobuf" "/opt/protobuf")
# Cmake find modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
list(APPEND LIBRARIES "/usr/lib/x86_64-linux-gnu/libglog.so.0")
find_package(ZLIB)
find_package(Protobuf)
find_package(GRPC)
# find_package(MyFlatC)
include_directories(${PROTOBUF_INCLUDE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
file(GLOB PROTOS "${CMAKE_CURRENT_SOURCE_DIR}/protobuf/*.proto")
file(GLOB FLATPROTOS "${CMAKE_CURRENT_SOURCE_DIR}/flatbuffer/*.fbs")
message("PROTOS=${PROTOS}")
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${PROTOS})
grpc_generate_cpp(GRPC_SRCS GRPC_HDRS ${CMAKE_CURRENT_BINARY_DIR} ${PROTOS})
# compile_flatbuffers_schema_to_cpp(${FLATPROTOS} ${CMAKE_CURRENT_BINARY_DIR} HEADERS_FBS)
#add_custom_command(
# OUTPUT ${CMAKE_CURRENT_BINARY_DIR}
# COMMAND MAKE
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/flatbuffer)
#
#add_executable(fbbench_client IMPORTED)
#
#add_executable(fbbench_server IMPORTED)
########################
add_executable(${PROJECT_NAME}-pb-client
protobuf/benchpb.h
${PROTO_SRCS}
${GRPC_SRCS}
client-pb.cpp
bench.h
config.h)
target_include_directories(${PROJECT_NAME}-pb-client
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${GRPC_INCLUDE_DIR}
)
target_link_libraries(${PROJECT_NAME}-pb-client
PUBLIC
${ZLIB_LIBRARIES}
${_GRPC_GRPCPP_UNSECURE}
${PROTOBUF_LIBRARY}
)
add_executable(${PROJECT_NAME}-pb-server
protobuf/benchpb.h
${PROTO_SRCS}
${GRPC_SRCS}
server-pb.cpp
bench.h
config.h)
target_include_directories(${PROJECT_NAME}-pb-server
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
${GRPC_INCLUDE_DIR}
)
target_link_libraries(${PROJECT_NAME}-pb-server
PUBLIC
${ZLIB_LIBRARIES}
${_GRPC_GRPCPP_UNSECURE}
${PROTOBUF_LIBRARY}
)
#############################
add_executable(${PROJECT_NAME}-raw-client
raw/benchraw.h
client-raw.cpp
bench.h
config.h)
target_link_libraries(${PROJECT_NAME}-raw-client
PUBLIC
${ZLIB_LIBRARIES}
evpp
pthread
)
add_executable(${PROJECT_NAME}-raw-server
raw/benchraw.h
server-raw.cpp
bench.h
config.h)
target_include_directories(${PROJECT_NAME}-raw-server
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(${PROJECT_NAME}-raw-server
PUBLIC
${ZLIB_LIBRARIES}
evpp
pthread
)