forked from tjjh89017/ezio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
78 lines (58 loc) · 1.45 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
cmake_minimum_required(VERSION 3.16)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
project(ezio CXX)
set(CMAKE_CXX_STANDARD 20)
set(sources
main
config
raw_storage
logger
)
set(grpc_sources
service
)
set(protos
ezio.proto
)
set(EZIO ezio)
option(grpc_support "Build EZIO with gRPC support" OFF)
set(LibtorrentRasterbar_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_STATIC_RUNTIME OFF)
if(grpc_support)
find_package(Protobuf 3 REQUIRED)
find_package(GRPC REQUIRED)
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${protos})
PROTOBUF_GENERATE_GRPC_CPP(GRPC_SRCS GRPC_HDRS ${protos})
list(APPEND sources ${PROTO_SRCS})
list(APPEND sources ${GRPC_SRCS})
list(APPEND sources ${grpc_sources})
set(GRPC_DEFINE "ENABLE_GRPC")
endif()
add_executable(${EZIO}
${sources}
)
# depends
find_package(LibtorrentRasterbar 1.2 REQUIRED)
find_package(Boost 1.56 REQUIRED COMPONENTS system program_options chrono random)
target_compile_definitions(${EZIO} PUBLIC
${GRPC_DEFINE}
_LARGEFILE64_SOURCE
_FILE_OFFSET_BITS=64
)
target_include_directories(${EZIO} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${Boost_INCLUDE_DIRS}
${LibtorrentRasterbar_INCLUDE_DIRS}
${PROTOBUF_INCLUDE_DIRS}
)
target_link_libraries(${EZIO} PRIVATE
${LibtorrentRasterbar_LIBRARIES}
${Boost_LIBRARIES}
${PROTOBUF_LIBRARIES}
${GRPC_LIBRARIES}
)
install(TARGETS ${EZIO}
RUNTIME DESTINATION sbin)