forked from 5G-MAG/rt-libflute
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
98 lines (82 loc) · 2.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
cmake_minimum_required(VERSION 3.16)
project (libflute VERSION 0.11.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_C_STANDARD_REQUIRED True)
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Wall -Wextra -Werror")
set(CMAKE_C_FLAGS_DEBUG_INIT "-Wall -Wextra -Werror")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "-Wall -O3")
set(CMAKE_C_FLAGS_RELEASE_INIT "-Wall -O3")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Boost REQUIRED)
find_package(spdlog REQUIRED)
find_package(PkgConfig REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(PCAP REQUIRED)
pkg_check_modules(TINYXML REQUIRED IMPORTED_TARGET tinyxml2)
pkg_check_modules(NETLINK REQUIRED IMPORTED_TARGET libnl-3.0)
option(ENABLE_RAPTOR "Enable support for Raptor FEC" ON)
add_subdirectory(examples)
include_directories(
"${PROJECT_BINARY_DIR}"
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/raptor
SYSTEM
${PROJECT_SOURCE_DIR}/utils
${SPDLOG_INCLUDEDIR}
${PCAP_INCLUDEDIR}
PkgConfig::NETLINK
)
configure_file("include/Version.h.in" "Version.h")
set(CMAKE_CXX_CLANG_TIDY clang-tidy)
if(ENABLE_RAPTOR)
message(STATUS "Compiling raptor library for Raptor FEC support. To disable support build with -DENABLE_RAPTOR=OFF")
add_library(raptor STATIC)
target_sources(raptor
PRIVATE
${PROJECT_SOURCE_DIR}/lib/raptor/bipartite.c
${PROJECT_SOURCE_DIR}/lib/raptor/decoder.c
${PROJECT_SOURCE_DIR}/lib/raptor/encoder.c
${PROJECT_SOURCE_DIR}/lib/raptor/galois.c
${PROJECT_SOURCE_DIR}/lib/raptor/gaussian.c
${PROJECT_SOURCE_DIR}/lib/raptor/pivoting.c
${PROJECT_SOURCE_DIR}/lib/raptor/random.c
PUBLIC
${PROJECT_SOURCE_DIR}/lib/raptor/raptor.h
)
target_link_libraries(raptor LINK_PUBLIC m)
else()
message(STATUS "Skipping raptor library for Raptor FEC support. To enable support build with -DENABLE_RAPTOR=ON")
endif()
add_library(flute "")
target_sources(flute
PRIVATE
src/Transmitter.cpp src/AlcPacket.cpp src/EncodingSymbol.cpp src/FileDeliveryTable.cpp src/IpSec.cpp src/File.cpp
src/ReceiverBase.cpp src/Receiver.cpp src/PcapReceiver.cpp
utils/base64.cpp
PUBLIC
include/Receiver.h include/Transmitter.h include/File.h
)
target_include_directories(flute PUBLIC ${PROJECT_SOURCE_DIR}/include/)
if(ENABLE_RAPTOR)
add_compile_definitions(RAPTOR_ENABLED)
target_include_directories(flute PUBLIC ${PROJECT_SOURCE_DIR}/lib/raptor/)
target_sources(flute
PRIVATE
src/fec/RaptorFEC.cpp
PUBLIC
include/fec/RaptorFEC.h
)
target_link_libraries(flute LINK_PUBLIC raptor)
endif()
target_link_libraries( flute
LINK_PUBLIC
spdlog::spdlog
z
pthread
crypto
${PCAP_LIBRARY}
PkgConfig::TINYXML
PkgConfig::NETLINK
)