This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
149 lines (128 loc) · 3.73 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
cmake_minimum_required(VERSION 3.13)
# Building tests by default depends on whether this is a subproject
if(DEFINED PROJECT_NAME)
option(quicrq_BUILD_TESTS "Build Tests for quicrq" OFF)
else()
option(quicrq_BUILD_TESTS "Build Tests for quicrq" ON)
endif()
project(quicrq
VERSION 1.0.0.0
DESCRIPTION "quicrq library"
LANGUAGES C CXX)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
# Bring in dependencies
add_subdirectory(dependencies)
find_package(OpenSSL REQUIRED)
message(STATUS "root: ${OPENSSL_ROOT_DIR}")
message(STATUS "OpenSSL_VERSION: ${OPENSSL_VERSION}")
message(STATUS "OpenSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
message(STATUS "OpenSSL_LIBRARIES: ${OPENSSL_LIBRARIES}")
add_library(quicrq-core
lib/congestion.c
lib/fragment.c
lib/quicrq.c
lib/proto.c
lib/reassembly.c
lib/relay.c
lib/object_consumer.c
lib/object_source.c
)
target_link_libraries(quicrq-core picoquic-core)
target_include_directories(quicrq-core PUBLIC include)
set_target_properties(quicrq-core
PROPERTIES
C_STANDARD 11
C_STANDARD_REQUIRED YES
C_EXTENSIONS YES)
target_compile_options(quicrq-core PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>: -Wpedantic -Wextra -Wall>
$<$<C_COMPILER_ID:MSVC>: >)
add_library(quicrq-tests
tests/basic_test.c
tests/congestion_test.c
tests/fourlegs_test.c
tests/fragment_test.c
tests/proto_test.c
tests/pyramid_test.c
tests/relay_test.c
tests/subscribe_test.c
tests/test_media.c
tests/threelegs_test.c
tests/triangle_test.c
tests/twomedia_test.c
tests/twoways_test.c
)
target_include_directories(quicrq-tests
PUBLIC
include
PRIVATE
lib tests
)
target_link_libraries(quicrq-tests picoquic-core picoquic-log)
set_target_properties(quicrq-tests
PROPERTIES
C_STANDARD 11
C_STANDARD_REQUIRED YES
C_EXTENSIONS YES)
target_compile_options(quicrq-tests PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>: -Wpedantic -Wextra -Wall>
$<$<C_COMPILER_ID:MSVC>: >)
add_executable(quicrq_app src/quicrq_app.c)
target_include_directories(quicrq_app
PUBLIC
include
PRIVATE
tests
)
target_link_libraries(quicrq_app
picoquic-core
quicrq-tests
quicrq-core
Threads::Threads
)
set_target_properties(quicrq_app
PROPERTIES
C_STANDARD 11
C_STANDARD_REQUIRED YES
C_EXTENSIONS YES)
target_compile_options(quicrq_app PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>: -Wpedantic -Wextra -Wall>
$<$<C_COMPILER_ID:MSVC>: >)
include(CTest)
if(BUILD_TESTING AND quicrq_BUILD_TESTS)
add_executable(quicrq_t src/quicrq_t.c)
target_include_directories(quicrq_t
PUBLIC
include
PRIVATE
tests)
target_link_libraries(quicrq_t
picoquic-core
picoquic-log
quicrq-tests
quicrq-core
Threads::Threads)
set_target_properties(quicrq_t
PROPERTIES
C_STANDARD 11
C_STANDARD_REQUIRED YES
C_EXTENSIONS YES)
target_compile_options(quicrq_t PRIVATE
$<$<OR:$<C_COMPILER_ID:Clang>,$<C_COMPILER_ID:AppleClang>,$<C_COMPILER_ID:GNU>>: -Wpedantic -Wextra -Wall>
$<$<C_COMPILER_ID:MSVC>: >)
add_test(NAME quicrq_t
COMMAND quicrq_t -S ${PROJECT_SOURCE_DIR})
endif()
#
# Adds clangformat as target that formats all source files
#
# get all project files for formatting
file(GLOB_RECURSE CLANG_FORMAT_SOURCE_FILES *.c *.h)
add_custom_target(
quicrq_clangformat
COMMAND clang-format
-style=Webkit
-i
${CLANG_FORMAT_SOURCE_FILES}
)