-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
137 lines (119 loc) · 6.68 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
cmake_minimum_required (VERSION 3.5)
cmake_policy(SET CMP0054 NEW)
project (dvbs2 CXX)
# Enable C++11
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Specify bin path
set (EXECUTABLE_OUTPUT_PATH bin/)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
# DVBS2 Version
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
string(SUBSTRING ${GIT_SHA1} 0 7 GIT_SHA1)
message(STATUS "DVBS2 - Hash: ${GIT_SHA1}")
# CMake options
option(DVBS2_LINK_UHD "Link with the UHD library (used in the radio USRP)" ON)
# Generate the source files lists
file(GLOB_RECURSE SRC_FILES_CO ${CMAKE_CURRENT_SOURCE_DIR}/src/common/*)
set(SRC_FILES_TX ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/TX/main.cpp)
set(SRC_FILES_TX_VAR ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/TX_VAR/main.cpp)
set(SRC_FILES_RX ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/RX/main_sched.cpp)
set(SRC_FILES_RX8 ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/RX/main_8-sta.cpp)
set(SRC_FILES_RX13 ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/RX/main_13-sta.cpp)
set(SRC_FILES_RX_SCHED ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/RX/main_sched.cpp)
set(SRC_FILES_RXB ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/RX/main_bench.cpp)
set(SRC_FILES_RX_DUMP ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/RX/dump.cpp)
set(SRC_FILES_TX_RX ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/TX_RX/main.cpp)
set(SRC_FILES_TX_RX_BB ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/TX_RX_BB/main.cpp)
set(SRC_FILES_CH ${CMAKE_CURRENT_SOURCE_DIR}/src/mains/CH/main.cpp)
# Auto generate a header containing the last Git SHA1
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/common/version.cpp.in"
"${CMAKE_CURRENT_SOURCE_DIR}/src/common/version.cpp" @ONLY)
list(APPEND SRC_FILES_CO "${CMAKE_CURRENT_SOURCE_DIR}/src/common/version.cpp")
# Create the executables from sources
add_library (dvbs2_common STATIC ${SRC_FILES_CO})
add_executable(dvbs2_tx ${SRC_FILES_TX})
add_executable(dvbs2_tx_var ${SRC_FILES_TX_VAR})
add_executable(dvbs2_rx ${SRC_FILES_RX_SCHED})
add_executable(dvbs2_rx8 ${SRC_FILES_RX8})
add_executable(dvbs2_rx13 ${SRC_FILES_RX13})
add_executable(dvbs2_rx_sched ${SRC_FILES_RX_SCHED})
add_executable(dvbs2_rxb ${SRC_FILES_RXB})
add_executable(dvbs2_rx_dump ${SRC_FILES_RX_DUMP})
add_executable(dvbs2_tx_rx ${SRC_FILES_TX_RX})
add_executable(dvbs2_tx_rx_bb ${SRC_FILES_TX_RX_BB})
add_executable(dvbs2_ch ${SRC_FILES_CH})
# Link with common sources
target_link_libraries(dvbs2_tx PRIVATE dvbs2_common)
target_link_libraries(dvbs2_tx_var PRIVATE dvbs2_common)
target_link_libraries(dvbs2_rx PRIVATE dvbs2_common)
target_link_libraries(dvbs2_rx8 PRIVATE dvbs2_common)
target_link_libraries(dvbs2_rx13 PRIVATE dvbs2_common)
target_link_libraries(dvbs2_rx_sched PRIVATE dvbs2_common)
target_link_libraries(dvbs2_rxb PRIVATE dvbs2_common)
target_link_libraries(dvbs2_rx_dump PRIVATE dvbs2_common)
target_link_libraries(dvbs2_tx_rx PRIVATE dvbs2_common)
target_link_libraries(dvbs2_tx_rx_bb PRIVATE dvbs2_common)
target_link_libraries(dvbs2_ch PRIVATE dvbs2_common)
target_include_directories(dvbs2_common PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_tx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_tx_var PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_rx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_rx8 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_rx13 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_rx_sched PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_rxb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_rx_dump PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_tx_rx PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_tx_rx_bb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
target_include_directories(dvbs2_ch PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/common)
# compile `StreamPU` static lib
option(SPU_TESTS "" OFF) # do NOT compile the tests
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/streampu/)
# Configure the AFF3CT library before compiling it
option(AFF3CT_COMPILE_EXE "" OFF )
option(AFF3CT_COMPILE_STATIC_LIB "" ON )
option(AFF3CT_COMPILE_SHARED_LIB "" OFF )
option(AFF3CT_LINK_GSL "" OFF )
option(AFF3CT_LINK_MKL "" OFF )
set (AFF3CT_PREC "MULTI" CACHE STRING "") # can be '8', '16', '32', '64' or 'MULTI'
option(AFF3CT_INCLUDE_SPU_LIB "" OFF )
# Compile the AFF3CT library
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/aff3ct/)
# Link with AFF3CT
target_link_libraries(dvbs2_common PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_tx PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_tx_var PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_rx PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_rx8 PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_rx13 PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_rx_sched PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_rxb PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_rx_dump PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_tx_rx PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_tx_rx_bb PRIVATE aff3ct-static-lib)
target_link_libraries(dvbs2_ch PRIVATE aff3ct-static-lib)
# Link with UHD (& boost)
if(DVBS2_LINK_UHD)
message(STATUS "DVBS2 - UHD: on")
target_compile_definitions(dvbs2_common PUBLIC
$<BUILD_INTERFACE:DVBS2_LINK_UHD>
$<INSTALL_INTERFACE:DVBS2_LINK_UHD>)
# Link UHD
find_package (UHD REQUIRED)
if (UHD_FOUND)
include_directories(${UHD_INCLUDE_DIRS})
target_link_libraries(dvbs2_common PRIVATE ${UHD_LIBRARIES})
endif (UHD_FOUND)
# Link Boost
find_package(Boost QUIET COMPONENTS system filesystem thread REQUIRED)
if (Boost_FOUND)
target_link_libraries(dvbs2_common PRIVATE ${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY})
include_directories(${Boost_INCLUDE_DIRS})
endif (Boost_FOUND)
else()
message(STATUS "DVBS2 - UHD: off")
endif(DVBS2_LINK_UHD)