-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
164 lines (134 loc) · 4.32 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
cmake_minimum_required(VERSION 3.2)
project(Welle.Io VERSION 0.0.0 LANGUAGES C CXX)
if(NOT WELLE-IO_VERSION)
set(WELLE-IO_VERSION ${PROJECT_VERSION})
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
option(BUILD_WELLE_CLI "Build welle-cli" ON )
option(PROFILING "Enable profiling (see README.md)" OFF)
option(AIRSPY "Compile with Airspy support" ON )
option(RTLSDR "Compile with RTL-SDR support" ON )
option(SOAPYSDR "Compile with SoapySDR support" ON )
add_definitions(-Wall)
add_definitions(-g)
add_definitions(-DDABLIN_AAC_FAAD2)
if(MINGW)
add_definitions(-municode)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Build type not specified: defaulting to release.")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
#enable_testing()
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
include(GNUInstallDirs)
set(GUI_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
if(PROFILING)
add_definitions(-DWITH_PROFILING)
endif()
find_package(FFTW3f REQUIRED)
set(fft_sources "")
find_package(Threads REQUIRED)
find_package(Faad REQUIRED)
if (RTLSDR)
find_package(LibRTLSDR REQUIRED)
endif()
if (AIRSPY)
find_package(LibAIRSPY REQUIRED)
endif()
if (SOAPYSDR)
find_package(SoapySDR NO_MODULE REQUIRED)
# Note: SoapySDRConfig.cmake sets C++11 standard so it needs to be reset to C++14
set(CMAKE_CXX_STANDARD 14)
endif()
include_directories(
src
src/backend
src/output
src/various
src/input
src/libs/fec
${FFTW3F_INCLUDE_DIRS}
${FAAD_INCLUDE_DIRS}
${LIBRTLSDR_INCLUDE_DIRS}
${SoapySDR_INCLUDE_DIRS}
)
set(backend_sources
src/backend/dab-audio.cpp
src/backend/decoder_adapter.cpp
src/backend/dabplus_decoder.cpp
src/backend/charsets.cpp
src/backend/dab-constants.cpp
src/backend/mot_manager.cpp
src/backend/pad_decoder.cpp
src/backend/eep-protection.cpp
src/backend/fib-processor.cpp
src/backend/fic-handler.cpp
src/backend/msc-handler.cpp
src/backend/freq-interleaver.cpp
src/backend/ofdm-decoder.cpp
src/backend/ofdm-processor.cpp
src/backend/phasereference.cpp
src/backend/phasetable.cpp
src/backend/tii-decoder.cpp
src/backend/protTables.cpp
src/backend/radio-receiver.cpp
src/backend/tools.cpp
src/backend/uep-protection.cpp
src/backend/viterbi.cpp
src/various/Xtan2.cpp
src/various/channels.cpp
src/various/fft.cpp
src/various/profiling.cpp
src/libs/fec/decode_rs_char.c
src/libs/fec/encode_rs_char.c
src/libs/fec/init_rs_char.c
)
set(welle_cli_sources
src/welle-cli/welle-cli.cpp
)
set(input_sources
src/input/input_factory.cpp
src/input/null_device.cpp
)
if(LIBRTLSDR_FOUND)
add_definitions (-DHAVE_RTLSDR)
set(input_sources ${input_sources} src/input/rtl_sdr.cpp)
endif()
if(LIBAIRSPY_FOUND)
add_definitions (-DHAVE_AIRSPY)
set(input_sources ${input_sources} src/input/airspy_sdr.cpp)
endif()
if(SoapySDR_FOUND)
add_definitions (-DHAVE_SOAPYSDR)
set(input_sources ${input_sources} src/input/soapy_sdr.cpp)
endif()
STRING(TIMESTAMP BUILD_DATE "%s" UTC)
add_definitions("-DBUILD_DATE=\"${BUILD_DATE}\"")
if(BUILD_WELLE_CLI)
set(cliExecutableName welle-cli)
add_executable (${cliExecutableName} ${welle_cli_sources} ${backend_sources} ${input_sources} ${fft_sources})
if(CMAKE_BUILD_TYPE MATCHES Debug)
SET_TARGET_PROPERTIES(${cliExecutableName} PROPERTIES COMPILE_FLAGS "-O2 -fno-omit-frame-pointer -fsanitize=address")
SET_TARGET_PROPERTIES(${cliExecutableName} PROPERTIES LINK_FLAGS "-fno-omit-frame-pointer -fsanitize=address")
endif(CMAKE_BUILD_TYPE MATCHES Debug)
target_link_libraries (${cliExecutableName}
${LIBRTLSDR_LIBRARIES}
${LIBAIRSPY_LIBRARIES}
${FFTW3F_LIBRARIES}
${FAAD_LIBRARIES}
${SoapySDR_LIBRARIES}
Threads::Threads
)
if(UNIX)
INSTALL (TARGETS ${cliExecutableName} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)