forked from chijinxina/rpc-protobuf-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (68 loc) · 2.28 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
cmake_minimum_required(VERSION 3.0.2)
project("rpc-protobuf-cpp")
add_compile_options(-std=c++14)
# 添加cmake_modules
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
# 添加库文件输出目录
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
# 添加可执行文件输出目录
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
################# folly #############
find_package(folly CONFIG)
if (NOT folly_FOUND)
# Look for folly using our FindFolly.cmake module. This may work if the
# folly was built with its older autoconf build files rather than with CMake.
find_package(Folly MODULE REQUIRED)
endif()
################# fizz #############
find_package(fizz CONFIG REQUIRED)
message("find fizz include: ${FIZZ_INCLUDE_DIR}")
message("find fizz libraries: ${FIZZ_LIBRARIES}")
################# wangle #############
find_package(wangle REQUIRED)
message("find wangle include: ${WANGLE_INCLUDE_DIR}")
message("find wangle libraries: ${WANGLE_LIBRARIES}")
################# protobuf #############
find_package(Protobuf REQUIRED)
message("find Protobuf include: ${PROTOBUF_INCLUDE_DIRS}")
message("find Protobuf libraries: ${PROTOBUF_LIBRARIES}")
include_directories(
${PROJECT_SOURCE_DIR}
${PROTOBUF_INCLUDE_DIRS}
${WANGLE_INCLUDE_DIR}
)
add_subdirectory(example)
add_library(pbrpc
codec/LengthFieldPrepender.cpp
codec/LengthFieldBasedFrameDecoder.cpp
protobufCoder/RpcMessage.pb.cc
protobufCoder/RpcMsgSerializeHandler.cc
net/PbRpcClient.cc
net/PbRpcServer.cc
net/futureRpcCallProxy.cc
util/StringUtil.cc
util/LinuxNetworkUtil.cc
)
target_link_libraries(pbrpc
${WANGLE_LIBRARIES}
${PROTOBUF_LIBRARIES}
)
################ make install ##################
INSTALL(
TARGETS pbrpc
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION libstatic
)
INSTALL(
FILES
protobufCoder/RpcMessage.pb.h
protobufCoder/RpcMsgSerializeHandler.h
net/ServiceDispatcher/ServerDispatcher.h
net/ServiceDispatcher/ClientDispatcher.h
net/PbRpcClient.h
net/PbRpcServer.h
codec/LengthFieldPrepender.h
codec/LengthFieldBasedFrameDecoder.h
DESTINATION include
)