forked from securesocketfunneling/udt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
116 lines (89 loc) · 2.81 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
115
116
cmake_minimum_required(VERSION 2.8)
set(project_name "UDT")
project(${project_name})
# --- Include CMake build components and CMake common files
add_subdirectory(./cmake)
include(HelpersIdeTarget)
# --- Project variables
set(project_BINARY_DIR "${${project_name}_BINARY_DIR}")
set(project_ROOT_DIR "${${project_name}_SOURCE_DIR}")
set(project_SRC_DIR "${project_ROOT_DIR}/src")
set(project_THIRDPARTY_DIR "${project_ROOT_DIR}/third_party")
# --- Project files declaration
file(GLOB_RECURSE COMMON_HEADER_FILES
"${project_SRC_DIR}/udt/common/*.h")
file(GLOB_RECURSE COMMON_SOURCE_FILES
"${project_SRC_DIR}/udt/common/*.cpp")
file(GLOB_RECURSE QUEUE_HEADER_FILES
"${project_SRC_DIR}/udt/queue/*.h")
file(GLOB_RECURSE QUEUE_SOURCE_FILES
"${project_SRC_DIR}/udt/queue/*.cpp")
file(GLOB_RECURSE CONNECTED_PROTOCOL_HEADER_FILES
"${project_SRC_DIR}/udt/connected_protocol/*.h")
file(GLOB_RECURSE CONNECTED_PROTOCOL_SOURCE_FILES
"${project_SRC_DIR}/udt/connected_protocol/*.cpp")
file(GLOB_RECURSE UDT_HEADER_FILES
"${project_SRC_DIR}/udt/ip/*.h")
file(GLOB_RECURSE UDT_SOURCE_FILES
"${project_SRC_DIR}/udt/ip/*.cpp")
set(BOOST_ROOT
"${project_THIRDPARTY_DIR}/boost" CACHE PATH "Path of boost library")
message("** BOOST_ROOT: ${BOOST_ROOT}")
# --- Include platform specific CMakeList
# ---- Third party parameters
set(BOOST_PLATFORM_FLAGS "")
set(BOOST_PLATFORM_COMPONENTS "")
set(OPENSSL_PLATFORM_COMPONENTS "")
if (WIN32)
include(./cmake-ms/CMakeLists.txt)
elseif (UNIX)
include(./cmake-unix/CMakeLists.txt)
endif ()
# --- Define boost version if not set
if(NOT DEP_BOOST_VERSION)
set(DEP_BOOST_VERSION 1.58.0)
endif()
# --- Setup Boost dependencies
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME ON)
# --- Boost components
find_package(
Boost REQUIRED
FLAGS
STATIC
${BOOST_PLATFORM_FLAGS}
WITH_COMPONENTS
system
serialization
program_options
date_time
filesystem
coroutine
context
log
regex
thread
chrono
${BOOST_PLATFORM_COMPONENTS}
)
# --- Include bin directory
include_directories(${project_BINARY_DIR})
# --- Include source directory
include_directories(${project_SRC_DIR})
set (BUILD_UNIT_TESTS ON)
if (BUILD_UNIT_TESTS)
include(GTest)
set(GTEST_ROOT_DIR
"${project_THIRDPARTY_DIR}/gtest" CACHE PATH "Path of gtest library")
# --- Extract GTest archive in build directory
gtest_unpack_archive()
enable_testing()
# --- Add GTest project
add_subdirectory(${GTEST_ROOT_DIR})
# --- Add src test
add_subdirectory("${project_SRC_DIR}/tests")
endif (BUILD_UNIT_TESTS)
add_subdirectory("${project_SRC_DIR}/udt_client")
add_subdirectory("${project_SRC_DIR}/udt_server")
add_subdirectory("${project_SRC_DIR}/timer_benchmark")