forked from XTLS/badvpn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
117 lines (95 loc) · 2.62 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
cmake_minimum_required(VERSION 2.6)
project(BADVPN C)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
include(TestBigEndian)
include(CheckIncludeFiles)
find_package(OpenSSL REQUIRED)
set(LIBCRYPTO_INCLUDE_DIRS "${OpenSSL_INCLUDE_DIRS}")
set(LIBCRYPTO_LIBRARY_DIRS "${OpenSSL_LIBRARY_DIRS}")
set(LIBCRYPTO_LIBRARIES "${OpenSSL_LIBRARIES}")
find_package(NSPR REQUIRED)
find_package(NSS REQUIRED)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${LIBCRYPTO_INCLUDE_DIRS}
${NSPR_INCLUDE_DIRS}
${NSS_INCLUDE_DIRS}
lwip/custom
lwip/src/include
lwip/src/include/ipv4
)
link_directories(
${LIBCRYPTO_LIBRARY_DIRS}
${NSPR_LIBRARY_DIRS}
${NSS_LIBRARY_DIRS}
)
test_big_endian(BIG_ENDIAN)
add_definitions(-std=gnu99 -Werror=implicit-function-declaration -Wno-unused-value -Wno-parentheses -Wno-switch-enum -Wredundant-decls)
# platform-specific stuff
if (WIN32)
add_definitions(-DBADVPN_USE_WINAPI -D_WIN32_WINNT=0x501 -DWIN32_LEAN_AND_MEAN)
else ()
link_libraries(rt)
check_include_files(sys/signalfd.h HAVE_SYS_SIGNALFD_H)
if (NOT ${HAVE_SYS_SIGNALFD_H})
message(FATAL_ERROR "signalfd is required")
endif ()
check_include_files(sys/epoll.h HAVE_SYS_EPOLL_H)
if (NOT ${HAVE_SYS_EPOLL_H})
message(FATAL_ERROR "epoll is required")
endif ()
if (NOT DEFINED BADVPN_WITHOUT_CRYPTODEV)
check_include_files(crypto/cryptodev.h HAVE_CRYPTO_CRYPTODEV_H)
if (${HAVE_CRYPTO_CRYPTODEV_H})
add_definitions(-DBADVPN_USE_CRYPTODEV)
elseif (DEFINED BADVPN_WITH_CRYPTODEV)
message(FATAL_ERROR "crypto/cryptodev.h not found")
endif ()
endif ()
endif ()
# add preprocessor definitions
if (${BIG_ENDIAN})
add_definitions(-DBADVPN_BIG_ENDIAN)
else ()
add_definitions(-DBADVPN_LITTLE_ENDIAN)
endif ()
# install man pages
install(
FILES badvpn.7
DESTINATION share/man/man7
)
install(
FILES badvpn-server.8 badvpn-client.8
DESTINATION share/man/man8
)
# internal libraries
add_subdirectory(system)
add_subdirectory(flow)
add_subdirectory(tuntap)
add_subdirectory(predicate)
add_subdirectory(nspr_support)
add_subdirectory(server_connection)
add_subdirectory(security)
add_subdirectory(socksclient)
add_subdirectory(lwip)
add_subdirectory(dhcpclient)
add_subdirectory(ncdconfig)
if (NOT WIN32)
add_subdirectory(ipc)
endif ()
# example programs
add_subdirectory(examples)
# tests
add_subdirectory(tests)
# server
add_subdirectory(server)
# client
add_subdirectory(client)
# flooder
add_subdirectory(flooder)
# tun2socks
add_subdirectory(tun2socks)
# ncd
if (NOT WIN32)
add_subdirectory(ncd)
endif ()