-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
86 lines (68 loc) · 2.39 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
cmake_minimum_required (VERSION 2.6)
project(Link)
# clang has linking problems on Ubuntu 15.10
set(CMAKE_CXX_COMPILER "/usr/bin/g++")
set(CMAKE_C_COMPILER "/usr/bin/gcc")
#set(OPT_COMMON "-fsanitize=address") <- ASan seems to leak memory
# set(OPT_COMMON "")
# for clang++: -Wno-unused-private-field -D_GLIBCXX_DEBUG
set(CMAKE_CXX_FLAGS "-std=c++11 -g -Wall -fdiagnostics-color -Og ${OPT_COMMON} -Wno-literal-suffix")
if (VALGRIND_INTEGRATION EQUAL "1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVALGRIND_INTEGRATION")
message("-- Enabling Valgrind integration")
endif()
set(CMAKE_C_FLAGS "-std=c11 -D_GNU_SOURCE")
set(CMAKE_EXE_LINKER_FLAGS "-rdynamic -lrt ${OPT_COMMON}")
find_package (Boost 1.55.0 REQUIRED COMPONENTS program_options)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/deps/json11 ${Boost_INCLUDE_DIR})
add_library(json11 STATIC
${CMAKE_SOURCE_DIR}/deps/json11/json11.cpp)
add_library(reactor STATIC
libreactor/reactor.cpp
libreactor/common.cpp
libreactor/epoll.cpp
libreactor/logging.cpp
libreactor/signals.cpp
libreactor/process.cpp
libreactor/tcp.cpp
libreactor/misc.cpp
libreactor/buffer.cpp
libreactor/timer.cpp
libreactor/streamutil.cpp
libreactor/throttled.cpp
libreactor/unix_socket.cpp
libreactor/ioutil.cpp
libreactor/bytestring.cpp
libreactor/packet_stream_util.cpp)
add_library(reactor_tls STATIC
libreactor/tls.cpp)
add_library(multilink STATIC
multilink/multilink.cpp
multilink/packet_queue.cpp
multilink/write_queue.cpp
multilink/transport.cpp
multilink/transport_targets.cpp
multilink/multilink_link.cpp
multilink/multilink_stats.cpp)
include(deps/lwip/CMakeLists.txt)
add_library(terminate STATIC
terminate/tun.cpp
terminate/terminate.cpp
terminate/lwip_tcp.cpp
terminate/ippacket.cpp
terminate/address.cpp)
include(tests/CMakeLists.txt)
add_executable(app
app/app.cpp
app/rpc.cpp)
target_link_libraries(app multilink reactor json11)
add_executable(multilink_client
app/client.cpp)
target_link_libraries(multilink_client multilink reactor_tls terminate lwip reactor json11 ssl crypto ${Boost_LIBRARIES})
add_executable(multilink_server
app/server.cpp)
target_link_libraries(multilink_server reactor_tls reactor json11 ssl crypto ${Boost_LIBRARIES})
add_executable(server_child
app/server_child.cpp
app/rpc.cpp)
target_link_libraries(server_child multilink terminate lwip reactor json11 ${Boost_LIBRARIES})