-
Notifications
You must be signed in to change notification settings - Fork 73
/
CMakeLists.txt
75 lines (64 loc) · 1.77 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
cmake_minimum_required(VERSION 3.23)
project(KadNode C)
#NOTE: The file is not used by build but useful for IDE
OPTION(DNS "DNS Proxy" ON)
OPTION(TLS "TLS Authentication" ON)
OPTION(BOB "BOB Authentication" ON)
OPTION(LPD "Local Peer Discovery (LPD) Support" ON)
OPTION(CMD "kadnode-ctl KadNode Control Program" ON)
OPTION(NATPMP "Port Forwarding NAT-PMP/PCP" OFF)
OPTION(UPNP "Port Forwarding UPnP" OFF)
SET(CMAKE_C_STANDARD 11)
ADD_DEFINITIONS(-Os -Wall -Wwrite-strings -pedantic)
SET(SOURCES src/announces.c
src/conf.c
src/kad.c
src/log.c
src/main.c
src/net.c
src/peerfile.c
src/searches.c
src/utils.c
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(SOURCES ${SOURCES} src/tests.c)
ADD_DEFINITIONS(-DDEBUG)
endif()
IF(UNIX)
SET(SOURCES ${SOURCES} src/unix.c)
ENDIF()
IF(WIN32)
SET(SOURCES ${SOURCES} src/unix.c src/windows.c)
ENDIF()
IF(CMD)
SET(SOURCES ${SOURCES} src/ext-cmd.c)
ADD_DEFINITIONS(-DCMD)
ENDIF()
IF(BOB)
SET(SOURCES ${SOURCES} src/ext-bob.c src/ecc_point_compression.c)
ADD_DEFINITIONS(-DBOB)
ENDIF()
IF(DNS)
SET(SOURCES ${SOURCES} src/ext-dns.c)
ADD_DEFINITIONS(-DDNS)
ENDIF()
IF(TLS)
SET(SOURCES ${SOURCES} src/ext-tls-server.c src/ext-tls-client.c)
ADD_DEFINITIONS(-DTLS)
ENDIF()
IF(LPD)
SET(SOURCES ${SOURCES} src/ext-lpd.c)
ADD_DEFINITIONS(-DLPD)
ENDIF()
IF(NATPMP)
SET(SOURCES ${SOURCES} src/ext-fwd.c src/natpmp.c)
ADD_DEFINITIONS(-DFWD -DFWD_NATPMP)
ADD_LINK_OPTIONS(-Wl,-Bdynamic -lnatpmp)
ENDIF()
IF(UPNP)
SET(SOURCES ${SOURCES} src/ext-fwd.c src/upnp.c)
ADD_DEFINITIONS(-DFWD -DFWD_UPNP)
ADD_LINK_OPTIONS(-Wl,-Bdynamic -lminiupnpc)
ENDIF()
add_executable(kadnode ${SOURCES})
target_link_libraries(kadnode mbedtls mbedx509 mbedcrypto)