-
Notifications
You must be signed in to change notification settings - Fork 43
/
CMakeLists.txt
509 lines (423 loc) · 21.3 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
cmake_minimum_required(VERSION 3.25 FATAL_ERROR)
project(Waterwall VERSION 1.32)
set(CMAKE_C_STANDARD 11 CACHE INTERNAL "C standard version" FORCE)
set(CMAKE_CXX_STANDARD 11 CACHE INTERNAL "CXX standard version" FORCE)
set(CMAKE_C_STANDARD_REQUIRED TRUE CACHE BOOL "request not to use lower versions" FORCE)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE CACHE BOOL "request not to use lower versions" FORCE)
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") for 32 bit build, note that ssl libs need tweaks
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
# set(CMAKE_EXE_LINKER_FLAGS "" CACHE INTERNAL "")
# untill they update the CPM library, i don't want a dirty build log system
# CMake Warning (dev) at /snap/cmake/1408/share/cmake-3.30/Modules/FetchContent.cmake:1953 (message):
# [cmake] Calling FetchContent_Populate(komihash) is deprecated, call
# [cmake] FetchContent_MakeAvailable(komihash) instead. Policy CMP0169 can be set to
# [cmake] OLD to allow FetchContent_Populate(komihash) to be called directly for now,
# [cmake] but the ability to call it with declared details will be removed completely
# [cmake] in a future version.
if(POLICY CMP0169)
cmake_policy(SET CMP0169 OLD)
set(CMAKE_POLICY_DEFAULT_CMP0169 OLD)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
cmake_policy(SET CMP0069 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported()
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
# enabling lto for clang is done thisway, because thin-lto is the clang default
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_C_COMPILE_OPTIONS_IPO "-flto")
set(CMAKE_CXX_COMPILE_OPTIONS_IPO "-flto")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-instr-generate")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-instr-use=${CMAKE_CURRENT_SOURCE_DIR}/build/bin/code.profdata")
# add_compile_options(-Wno-profile-instr-unprofiled)
endif()
endif()
# force link glibc ver 2.27
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread -include ${CMAKE_CURRENT_SOURCE_DIR}/core/force_link_glibc_2.27.h")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${CMAKE_CURRENT_SOURCE_DIR}/core/force_link_glibc_2.27.h")
set(ENABLE_ASAN OFF CACHE BOOL "enable address sanitizer" FORCE)
set(ENABLE_TSAN OFF CACHE BOOL "enable thread sanitizer" FORCE)
set(ENABLE_LSAN OFF CACHE BOOL "enable leak sanitizer" FORCE)
set(ENABLE_USAN OFF CACHE BOOL "enable undefined behaviour sanitizer" FORCE)
option(INCLUDE_LAYER3_RECEIVER "link Layer3Receiver staticly to the core" TRUE)
option(INCLUDE_LAYER3_SENDER "link Layer3Sender staticly to the core" TRUE)
option(INCLUDE_LAYER3_IP_ROUTING_TABLE "link Layer3IpRoutingTable staticly to the core" TRUE)
option(INCLUDE_LAYER3_IP_OVERRIDER "link Layer3IpOverrider staticly to the core" TRUE)
option(INCLUDE_LAYER3_IP_MANIPULATOR "link Layer3IPManipulator staticly to the core" TRUE)
option(INCLUDE_LAYER3_TCP_MANIPULATOR "link Layer3TcpManipulator staticly to the core" TRUE)
option(INCLUDE_TCP_LISTENER "link TcpListener staticly to the core" TRUE)
option(INCLUDE_UDP_LISTENER "link UdpListener staticly to the core" TRUE)
option(INCLUDE_LISTENER "link Listener staticly to the core" TRUE)
option(INCLUDE_LOGGER_TUNNEL "link LoggerTunnel staticly to the core" TRUE)
option(INCLUDE_CONNECTOR "link Connector staticly to the core" TRUE)
option(INCLUDE_TCPCONNECTOR "link TcpConnector staticly to the core" TRUE)
option(INCLUDE_UDP_CONNECTOR "link UdpConnector staticly to the core" TRUE)
option(INCLUDE_BRIDGE "link Bridge staticly to the core" TRUE)
if(LINUX) # todo (other platforms)
option(INCLUDE_TUNDEVICE "link TunDevice staticly to the core" TRUE)
option(INCLUDE_RAWDEVICE "link RawDevice staticly to the core" TRUE)
option(INCLUDE_CAPTUREDEVICE "link CapTureDevice staticly to the core" TRUE)
endif()
option(INCLUDE_OPENSSL_SERVER "link OpenSSlServer staticly to the core" TRUE)
option(INCLUDE_OPENSSL_CLIENT "link OpenSSLClient staticly to the core" TRUE)
option(INCLUDE_TROJAN_AUTH_SERVER "link TrojanAuthServer staticly to the core" TRUE)
option(INCLUDE_TROJAN_SOCKS_SERVER "link TrojanSocksServer staticly to the core" TRUE)
option(INCLUDE_WOLFSSL_SERVER "link WolfSSLServer staticly to the core" OFF) # this downloads 750 mb of data!
option(INCLUDE_WOLFSSL_CLIENT "link WolfSSLClient staticly to the core" OFF) # this downloads 750 mb of data!
option(INCLUDE_HTTP2_SERVER "link Http2Server staticly to the core" TRUE)
option(INCLUDE_HTTP2_CLIENT "link Http2Client staticly to the core" TRUE)
option(INCLUDE_PROTOBUF_SERVER "link ProtoBufServer staticly to the core" TRUE)
option(INCLUDE_PROTOBUF_CLIENT "link ProtoBufClient staticly to the core" TRUE)
option(INCLUDE_REVERSE_SERVER "link ReverseServer staticly to the core" TRUE)
option(INCLUDE_REVERSE_CLIENT "link ReverseClient staticly to the core" TRUE)
option(INCLUDE_HEADER_SERVER "link HeaderServer staticly to the core" TRUE)
option(INCLUDE_HEADER_CLIENT "link HeaderClient staticly to the core" TRUE)
option(INCLUDE_PRECONNECT_SERVER "link PreConnectServer staticly to the core" TRUE)
option(INCLUDE_PRECONNECT_CLIENT "link PreConnectClient staticly to the core" TRUE)
option(INCLUDE_SOCKS_5_SERVER "link Socks5Server staticly to the core" TRUE)
option(INCLUDE_REALITY_SERVER "link RealityServer staticly to the core" TRUE)
option(INCLUDE_REALITY_CLIENT "link RealityClient staticly to the core" TRUE)
option(INCLUDE_HALFDUPLEX_SERVER "link HalfDuplexServer staticly to the core" TRUE)
option(INCLUDE_HALFDUPLEX_CLIENT "link HalfDuplexClient staticly to the core" TRUE)
option(INCLUDE_BGP4_SERVER "link Bgp4Server staticly to the core" TRUE)
option(INCLUDE_BGP4_CLIENT "link Bgp4Client staticly to the core" TRUE)
option(INCLUDE_MUX_SERVER "link MuxServer staticly to the core" TRUE)
option(INCLUDE_MUX_CLIENT "link MuxClient staticly to the core" TRUE)
set(OPENSSL_CONFIGURE_VERBOSE ON)
# add executable
add_executable(Waterwall
core/main.c
core/core_settings.c
core/static_tunnels.c
# core/tests/bench_memcpy.c
)
# download CPM.cmake
file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.0/CPM.cmake
${CMAKE_BINARY_DIR}/cmake/CPM.cmake
)
include(${CMAKE_BINARY_DIR}/cmake/CPM.cmake)
target_include_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/core)
target_include_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ww)
#ww api
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ww)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ww)
target_include_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ww)
target_link_libraries(Waterwall ww)
#tun device
if (INCLUDE_TUNDEVICE)
target_compile_definitions(Waterwall PUBLIC INCLUDE_TUNDEVICE=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/device/tun)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/device/tun)
target_link_libraries(Waterwall TunDevice)
endif()
#raw device
if (INCLUDE_RAWDEVICE)
target_compile_definitions(Waterwall PUBLIC INCLUDE_RAWDEVICE=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/device/raw)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/device/raw)
target_link_libraries(Waterwall RawDevice)
endif()
#capture device
if (INCLUDE_CAPTUREDEVICE)
target_compile_definitions(Waterwall PUBLIC INCLUDE_CAPTUREDEVICE=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/device/capture)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/device/capture)
target_link_libraries(Waterwall CaptureDevice)
endif()
#layer3 receiver
if (INCLUDE_LAYER3_RECEIVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_LAYER3_RECEIVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/receiver)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/receiver)
target_link_libraries(Waterwall Layer3Receiver)
endif()
#layer3 sender
if (INCLUDE_LAYER3_SENDER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_LAYER3_SENDER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/sender)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/sender)
target_link_libraries(Waterwall Layer3Sender)
endif()
#layer3 ip route table
if (INCLUDE_LAYER3_IP_ROUTING_TABLE)
target_compile_definitions(Waterwall PUBLIC INCLUDE_LAYER3_IP_ROUTING_TABLE=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/ip/routing_table)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/ip/routing_table)
target_link_libraries(Waterwall Layer3IpRoutingTable)
endif()
#layer3 ip overrider
if (INCLUDE_LAYER3_IP_OVERRIDER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_LAYER3_IP_OVERRIDER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/ip/overrider)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/ip/overrider)
target_link_libraries(Waterwall Layer3IpOverrider)
endif()
#layer3 ip manipulator
if (INCLUDE_LAYER3_IP_MANIPULATOR)
target_compile_definitions(Waterwall PUBLIC INCLUDE_LAYER3_IP_MANIPULATOR=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/ip/manipulator)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/ip/manipulator)
target_link_libraries(Waterwall Layer3IpManipulator)
endif()
#layer3 tcp manipulator
if (INCLUDE_LAYER3_TCP_MANIPULATOR)
target_compile_definitions(Waterwall PUBLIC INCLUDE_LAYER3_TCP_MANIPULATOR=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/tcp/manipulator)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/layer3/tcp/manipulator)
target_link_libraries(Waterwall Layer3TcpManipulator)
endif()
#tcp listener
if (INCLUDE_TCP_LISTENER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_TCP_LISTENER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/listener/tcp)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/listener/tcp)
target_link_libraries(Waterwall TcpListener)
endif()
#udp listener
if (INCLUDE_UDP_LISTENER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_UDP_LISTENER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/listener/udp)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/listener/udp)
target_link_libraries(Waterwall UdpListener)
endif()
#listener
if (INCLUDE_LISTENER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_LISTENER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/listener)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/listener)
target_link_libraries(Waterwall Listener)
endif()
#connector
if (INCLUDE_CONNECTOR)
target_compile_definitions(Waterwall PUBLIC INCLUDE_CONNECTOR=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/connector)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/connector)
target_link_libraries(Waterwall Connector)
endif()
#tcp connector
if (INCLUDE_TCPCONNECTOR)
target_compile_definitions(Waterwall PUBLIC INCLUDE_TCPCONNECTOR=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/connector/tcp)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/connector/tcp)
target_link_libraries(Waterwall TcpConnector)
endif()
#udp connector
if (INCLUDE_UDP_CONNECTOR)
target_compile_definitions(Waterwall PUBLIC INCLUDE_UDP_CONNECTOR=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/connector/udp)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/connector/udp)
target_link_libraries(Waterwall UdpConnector)
endif()
#bridge
if (INCLUDE_BRIDGE)
target_compile_definitions(Waterwall PUBLIC INCLUDE_BRIDGE=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/bridge)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/adapters/bridge)
target_link_libraries(Waterwall Bridge)
endif()
#http2 server
if (INCLUDE_OPENSSL_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_HTTP2_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/http2)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/http2)
target_link_libraries(Waterwall Http2Server)
endif()
#http2 client
if (INCLUDE_HTTP2_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_HTTP2_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/http2)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/http2)
target_link_libraries(Waterwall Http2Client)
endif()
#openssl server
if (INCLUDE_OPENSSL_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_OPENSSL_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/openssl)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/openssl)
target_link_libraries(Waterwall OpenSSLServer)
endif()
#openssl client
if (INCLUDE_OPENSSL_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_OPENSSL_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/openssl)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/openssl)
target_link_libraries(Waterwall OpenSSLClient)
endif()
#trojan auth server
if (INCLUDE_TROJAN_AUTH_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_TROJAN_AUTH_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/trojan/auth)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/trojan/socks)
target_link_libraries(Waterwall TrojanAuthServer)
endif()
#trojan socks server
if (INCLUDE_TROJAN_SOCKS_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_TROJAN_SOCKS_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/trojan/socks)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/trojan/socks)
target_link_libraries(Waterwall TrojanSocksServer)
endif()
#wolf ssl server
if (INCLUDE_WOLFSSL_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_WOLFSSL_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/wolfssl)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/wolfssl)
target_link_libraries(Waterwall WolfSSLServer)
endif()
#wolf ssl client
if (INCLUDE_WOLFSSL_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_WOLFSSL_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/wolfssl)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/wolfssl)
target_link_libraries(Waterwall WolfSSLClient)
endif()
#logger tunnel
if (INCLUDE_LOGGER_TUNNEL)
target_compile_definitions(Waterwall PUBLIC INCLUDE_LOGGER_TUNNEL=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/logger)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/logger)
target_link_libraries(Waterwall LoggerTunnel)
endif()
#protobuf server
if (INCLUDE_PROTOBUF_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_PROTOBUF_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/protobuf)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/protobuf)
target_link_libraries(Waterwall ProtoBufServer)
endif()
#protobuf client
if (INCLUDE_PROTOBUF_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_PROTOBUF_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/protobuf)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/protobuf)
target_link_libraries(Waterwall ProtoBufClient)
endif()
#reverse server
if (INCLUDE_REVERSE_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_REVERSE_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/reverse)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/reverse)
target_link_libraries(Waterwall ReverseServer)
endif()
#reverse client
if (INCLUDE_REVERSE_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_REVERSE_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/reverse)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/reverse)
target_link_libraries(Waterwall ReverseClient)
endif()
#header server
if (INCLUDE_HEADER_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_HEADER_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/header)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/header)
target_link_libraries(Waterwall HeaderServer)
endif()
#header client
if (INCLUDE_HEADER_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_HEADER_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/header)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/header)
target_link_libraries(Waterwall HeaderClient)
endif()
#preconnect server
if (INCLUDE_PRECONNECT_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_PRECONNECT_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/preconnect)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/preconnect)
target_link_libraries(Waterwall PreConnectServer)
endif()
#preconnect client
if (INCLUDE_PRECONNECT_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_PRECONNECT_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/preconnect)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/preconnect)
target_link_libraries(Waterwall PreConnectClient)
endif()
#socks5 server
if (INCLUDE_SOCKS_5_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_SOCKS_5_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/socks/5)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/socks/5)
target_link_libraries(Waterwall Socks5Server)
endif()
#reality server
if (INCLUDE_REALITY_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_REALITY_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/reality)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/reality)
target_link_libraries(Waterwall RealityServer)
endif()
#reality client
if (INCLUDE_REALITY_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_REALITY_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/reality)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/reality)
target_link_libraries(Waterwall RealityClient)
endif()
#halfduplex server
if (INCLUDE_HALFDUPLEX_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_HALFDUPLEX_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/halfduplex)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/halfduplex)
target_link_libraries(Waterwall HalfDuplexServer)
endif()
#halfduplex client
if (INCLUDE_HALFDUPLEX_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_HALFDUPLEX_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/halfduplex)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/halfduplex)
target_link_libraries(Waterwall HalfDuplexClient)
endif()
#bgp4server server
if (INCLUDE_BGP4_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_BGP4_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/bgp4)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/bgp4)
target_link_libraries(Waterwall Bgp4Server)
endif()
#bgp4client client
if (INCLUDE_BGP4_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_BGP4_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/bgp4)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/bgp4)
target_link_libraries(Waterwall Bgp4Client)
endif()
#mux server
if (INCLUDE_MUX_SERVER)
target_compile_definitions(Waterwall PUBLIC INCLUDE_MUX_SERVER=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/mux)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/server/mux)
target_link_libraries(Waterwall MuxServer)
endif()
#mux client
if (INCLUDE_MUX_CLIENT)
target_compile_definitions(Waterwall PUBLIC INCLUDE_MUX_CLIENT=1)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/mux)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/client/mux)
target_link_libraries(Waterwall MuxClient)
endif()
#------------------------------------------------------------------------------------------
if (BUILD_OPENSSL_GLOBALS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tunnels/shared/openssl)
target_link_directories(Waterwall PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tunnels/shared/openssl)
endif()
target_compile_definitions(Waterwall PUBLIC WATERWALL_VERSION=${Waterwall_VERSION})
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(Waterwall PRIVATE DEBUG=1)
endif()
if(OPENSSL_VERSION)
message(STATUS "OpenSSL version: ${OPENSSL_VERSION}")
endif()
message(STATUS "Waterwall version: ${Waterwall_VERSION}")
# set output path to build/bin/
set_target_properties(Waterwall
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)