forked from JvanKatwijk/sdr-j-fm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
558 lines (483 loc) · 15.6 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
cmake_minimum_required( VERSION 2.8.11 )
set (objectName fmreceiver-3.15)
set (CMAKE_CXX_FLAGS "${CMAKE_XCC_FLAGS} -Wall -std=c++14 -flto")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
set(CMAKE_AUTORCC ON)
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set (CMAKE_INSTALL_PREFIX "/usr/local/bin" CACHE PATH "default install path" FORCE )
endif()
#set (CMAKE_INSTALL_PREFIX /usr/local/bin)
if(MINGW)
add_definitions ( -municode)
#else (MINGW)
# add_definitions (-DSSE_AVAILABLE)
endif()
IF(EXISTS (".git") AND IS_DIRECTORY (".git"))
execute_process (
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif ()
if(GIT_COMMIT_HASH)
add_definitions("-DGITHASH=\"${GIT_COMMIT_HASH}\"")
else ()
add_definitions ("-DGITHASH=\" \"")
endif()
########################################################################
# select the release build type by default to get optimization flags
########################################################################
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 "")
### make sure our local CMake Modules path comes first
list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake/Modules)
######################################################################
#
######################################################################
# R E A D T H I S
#####################################################################
# adjust to your likings
# if you want to use the SSE support on your machine, comment
# set(NO_SSE_SUPPORT true)
#
# if you want support for any of these devices, uncomment the line
# set(PMSDR true)
set(SDRPLAY true)
# set(SDRPLAY_V3 true)
# set(AIRSPY true)
set(DABSTICK true)
# set(ELAD_S1 true)
########################################################################
find_package (PkgConfig)
find_package (LSBId)
find_package (Qt5Core REQUIRED)
find_package (Qt5Widgets REQUIRED)
find_package (Qt5Network REQUIRED)
find_package (Qt5Xml REQUIRED)
include_directories (
${Qt5Network_INCLUDE_DIRS}
${Qt5Xml_INCLUDE_DIRS}
)
find_package(Qwt)
if (NOT QWT_FOUND)
message(FATAL_ERROR "please install qwt library")
endif ()
include_directories ( ${QWT_INCLUDE_DIRS})
list(APPEND extraLibs ${QWT_LIBRARIES})
find_library (DYNAMIC_LOAD dl)
if(NOT(DYNAMIC_LOAD))
message(FATAL_ERROR "please install -ldl")
else(NOT(DYNAMIC_LOAD))
set(extraLibs ${DYNAMIC_LOAD})
endif(NOT(DYNAMIC_LOAD))
#
include (FindPackageHandleStandardArgs)
if (FFTW_INCLUDE_DIRS)
# Already in cache, be silent
set (FFTW_FIND_QUIETLY TRUE)
endif (FFTW_INCLUDE_DIRS)
find_path (FFTW_INCLUDE_DIR fftw3.h
HINTS
ENV FFTW_ROOT
PATHS
PATH_SUFFIXES
include
Include
)
list (APPEND FFTW_INCLUDE_DIRS ${FFTW_INCLUDE_DIR})
find_library (FFTW_LIBRARIES NAMES fftw3f
HINTS ENV FFTW_ROOT
PATHS
PATH_SUFFIXES lib64 Lib64 lib Lib)
message (STATUS ${FFTW_LIBRARIES} ${FFTW_INCLUDE_DIRS})
# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
# all listed variables are TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (
FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDE_DIRS)
mark_as_advanced (FFTW_LIBRARIES FFTW_INCLUDE_DIRS)
Find_Package (PkgConfig)
pkg_check_modules (SAMPLERATE samplerate REQUIRED)
link_directories (${SAMPLERATE})
find_library (PORTAUDIO portaudio)
if (NOT(PORTAUDIO))
message(FATAL_ERROR "please install portaudio V19")
else(NOT(PORTAUDIO))
set (extraLibs ${extraLibs} ${PORTAUDIO})
endif(NOT(PORTAUDIO))
SET (CMAKE_FIND_LIBRARY_SUFFIXES .so .a)
find_library (USB1 usb-1.0 HINTS /usr/lib)
if (NOT(USB1))
message (FATAL_ERROR "please install libusb-1.0")
else(NOT(USB1))
set(extraLibs ${extraLibs} ${USB1})
endif(NOT(USB1))
find_library (SNDFILE sndfile)
if (NOT(SNDFILE))
message (FATAL_ERROR "please install libsndfile")
else (NOT(SNDFILE))
set (extraLibs ${extraLibs} ${SNDFILE})
endif (NOT(SNDFILE))
find_library (PTHREADS pthread)
if (NOT(PTHREADS))
message (FATAL_ERROR "please install libpthread")
else (NOT(PTHREADS))
set (extraLibs ${extraLibs} ${PTHREADS})
endif (NOT(PTHREADS))
#######################################################################
include_directories (
${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
./
./includes
./includes/output
./includes/various
./includes/fm
./includes/rds
./includes/scopes-qwt6
./src
./src/output
./src/various
./src/fm
./src/rds
./src/various
./devices
./devices/filereader
)
set ( ${objectName}_HDRS
./includes/popup-keypad.h
./includes/fm-constants.h
./includes/various/program-list.h
./includes/various/keyboardfilter.h
./includes/various/squelchClass.h
./includes/various/fft.h
./includes/various/oscillator.h
./includes/various/ringbuffer.h
./includes/various/pllC.h
./includes/various/sincos.h
./includes/various/newconverter.h
./includes/various/fir-filters.h
./includes/various/fft-filters.h
./includes/various/iir-filters.h
./includes/various/Xtan2.h
./includes/various/themechoser.h
./includes/output/audiosink.h
./includes/scopes-qwt6/iqdisplay.h
./includes/scopes-qwt6/scope.h
./includes/scopes-qwt6/spectrogramdata.h
./includes/scopes-qwt6/fft-scope.h
./includes/fm/fm-demodulator.h
./includes/fm/pilot-recover.h
./includes/fm/stereo-separation.h
./includes/fm/fm-processor.h
./includes/rds/rds-decoder.h
./includes/rds/rds-decoder-1.h
./includes/rds/rds-decoder-2.h
./includes/rds/rds-decoder-3.h
./includes/rds/rds-blocksynchronizer.h
./includes/rds/rds-group.h
./includes/rds/rds-groupdecoder.h
./includes/various/agc.h
./includes/various/costas.h
./includes/various/shaping_filter.h
./devices/device-handler.h
./devices/deviceselect.h
./devices/filereader/filereader.h
./devices/filereader/filehulp.h
)
set ( ${objectName}_SRCS
./main.cpp
./radio.cpp
./src/popup-keypad.cpp
./src/various/program-list.cpp
./src/various/keyboardfilter.cpp
./src/various/squelchClass.cpp
./src/various/fft.cpp
./src/various/oscillator.cpp
./src/various/pllC.cpp
./src/various/sincos.cpp
./src/various/newconverter.cpp
./src/various/fir-filters.cpp
./src/various/fft-filters.cpp
./src/various/iir-filters.cpp
./src/various/Xtan2.cpp
./src/various/themechoser.cpp
./src/output/audiosink.cpp
./src/scopes-qwt6/iqdisplay.cpp
./src/scopes-qwt6/scope.cpp
./src/scopes-qwt6/fft-scope.cpp
./src/fm/fm-demodulator.cpp
./src/fm/pilot-recover.cpp
./src/fm/stereo-separation.cpp
./src/fm/fm-processor.cpp
./src/rds/rds-decoder.cpp
./src/rds/rds-decoder-1.cpp
./src/rds/rds-decoder-2.cpp
./src/rds/rds-decoder-3.cpp
./src/rds/rds-blocksynchronizer.cpp
./src/rds/rds-group.cpp
./src/rds/rds-groupdecoder.cpp
./src/various/shaping_filter.cpp
./devices/device-handler.cpp
./devices/deviceselect.cpp
./devices/filereader/filereader.cpp
./devices/filereader/filehulp.cpp
)
set ( ${objectName}_UIS
./forms/radio.ui
./forms/configwidget.ui
./devices/filereader/filereader-widget.ui
)
#####################################################################
#
if (PMSDR)
set (${objectName}_UIS
${${objectName}_UIS}
./devices/pmsdr/pmsdr-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/pmsdr/pmsdr.h
./devices/pmsdr/pa-reader.h
./devices/pmsdr/pmsdr-usb.h
)
include_directories (
./devices/pmsdr
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/pmsdr/pmsdr.h
./devices/pmsdr/pmsdr-comm.h
./devices/pmsdr/pmsdr-usb.h
./devices/pmsdr/pa-reader.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/pmsdr/pmsdr.cpp
./devices/pmsdr/pmsdr-comm.cpp
./devices/pmsdr/pmsdr-usb.cpp
./devices/pmsdr/pa-reader.cpp
)
add_definitions (-DHAVE_PMSDR)
endif (PMSDR)
if (SDRPLAY)
find_library (SDRPLAYLIB libmirsdrapi-rsp.so)
if (NOT(SDRPLAYLIB))
message (FATAL_ERROR "please install sdrplay library")
else (NOT(SDRPLAYLIB))
set (extraLibs ${extraLibs} ${SDRPLAYLIB})
endif()
find_path (SDRPLAYLIB_INCLUDE_DIR
NAMES mirsdrapi-rsp.h
PATHS
/usr/local/include/
)
include_directories (${SDRPLAYLIB_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/sdrplay-handler/sdrplay-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/sdrplay-handler/sdrplay-handler.h
./devices/sdrplay-handler/sdrplayselect.h
)
include_directories (
./devices/sdrplay-handler
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/sdrplay-handler/sdrplay-handler.h
./devices/sdrplay-handler/sdrplayselect.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/sdrplay-handler/sdrplay-handler.cpp
./devices/sdrplay-handler/sdrplayselect.cpp
)
add_definitions (-DHAVE_SDRPLAY)
endif (SDRPLAY)
if (SDRPLAY_V3)
find_library (SDRPLAYLIB_V3 libsdrplay_api.so)
if (NOT(SDRPLAYLIB_V3))
message (FATAL_ERROR "please install sdrplay-v3 library")
else (NOT(SDRPLAYLIB_V3))
set (extraLibs ${extraLibs} ${SDRPLAYLIB_V3})
endif()
find_path (SDRPLAYLIB_V3_INCLUDE_DIR
NAMES sdrplay_api.h
PATHS
/usr/local/include/
)
#message ("Tatata" ${SDRPLAYLIB_V3_INCLUDE_DIR})
include_directories (${SDRPLAYLIB_V3_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/sdrplay-handler-v3/sdrplay-widget-v3.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/sdrplay-handler-v3/sdrplay-handler-v3.h
#./devices/sdrplay-handler/sdrplayselect.h
)
include_directories (
./devices/sdrplay-handler-v3
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/sdrplay-handler-v3/sdrplay-handler.h
./devices/sdrplay-handler-v3/sdrplay-commands.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/sdrplay-handler-v3/sdrplay-handler-v3.cpp
#./devices/sdrplay-handler-v3/sdrplayselect.cpp
)
add_definitions (-DHAVE_SDRPLAY_V3)
endif (SDRPLAY_V3)
if (AIRSPY)
find_library (AIRSPY_LIB airspy)
if (NOT(AIRSPY_LIB))
message (FATAL_ERROR "please install airspy library")
else (NOT(AIRSPY_LIB))
set (extraLibs ${extraLibs} ${AIRSPY_LIB})
endif()
find_path (AIRSPYLIB_INCLUDE_DIR
NAMES airspy.h
PATHS
/usr/local/include/
/usr/local/include/libairspy
)
include_directories (${AIRSPYLIB_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/airspy/airspy-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/airspy/airspy-handler.h
)
include_directories (
./devices/airspy
)
set ($(objectName)_HDRS
${${objectName}_HDRS}
./devices/airspy/airspy-handler.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/airspy/airspy-handler.cpp
)
add_definitions (-DHAVE_AIRSPY)
endif (AIRSPY)
if (DABSTICK)
find_library (RTLSDR rtlsdr)
if (NOT(RTLSDR))
message (FATAL_ERROR "please install librtlsdr")
else (NOT(RTLSDR))
set (extraLibs ${extraLibs} ${RTLSDR})
endif()
find_path (DABSTICK_INCLUDE_DIR
NAMES rtl-sdr.h
PATHS
/usr/local/include/
/usr/include/
)
include_directories (${RTLSDR_INCLUDE_DIR})
set (${objectName}_UIS
${${objectName}_UIS}
./devices/rtlsdr-handler/dabstick-widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/rtlsdr-handler/dongleselect.h
./devices/rtlsdr-handler/rtlsdr-handler.h
)
include_directories (
./devices/rtlsdr-handler/
)
set (${objectName}_HDRS
${${objectName}_HDRS}
./devices/rtlsdr-handler/rtlsdr-handler.h
./devices/rtlsdr-handler/dongleselect.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/rtlsdr-handler/rtlsdr-handler.cpp
./devices/rtlsdr-handler/dongleselect.cpp
)
add_definitions (-DHAVE_DABSTICK)
endif()
if (ELAD_S1)
set (${objectName}_UIS
${${objectName}_UIS}
./devices/sw-elad-s1/elad_widget.ui
)
set (${objectName}_MOCS
${${objectName}_MOCS}
./devices/sw-elad-s1/elad-s1.h
./devices/sw-elad-s1/elad-worker.h
)
include_directories (
./devices/sw-elad-s1/
)
set (${objectName}_HDRS
${${objectName}_HDRS}
./devices/sw-elad-s1/elad-s1.h
./devices/sw-elad-s1/elad-loader.h
./devices/sw-elad-s1/elad-worker.h
)
set (${objectName}_SRCS
${${objectName}_SRCS}
./devices/sw-elad-s1/elad-s1.cpp
./devices/sw-elad-s1/elad-loader.cpp
./devices/sw-elad-s1/elad-worker.cpp
)
add_definitions (-DHAVE_ELAD_S1)
endif()
#
QT5_WRAP_UI(UIS ${${objectName}_UIS})
set ( ${objectName}_MOCS
${${objectName}_MOCS}
./radio.h
./includes/popup-keypad.h
./devices/device-handler.h
./includes/rds/rds-groupdecoder.h
./includes/rds/rds-blocksynchronizer.h
./includes/rds/rds-decoder.h
./includes/rds/rds-decoder-1.h
./includes/rds/rds-decoder-2.h
./includes/rds/rds-decoder-3.h
./includes/fm/fm-processor.h
./includes/scopes-qwt6/iqdisplay.h
./includes/scopes-qwt6/scope.h
./includes/various/keyboardfilter.h
./includes/various/program-list.h
./includes/various/squelchClass.h
./devices/filereader/filereader.h
./devices/filereader/filehulp.h
./devices/deviceselect.h
./includes/scopes-qwt6/fft-scope.h
)
QT5_WRAP_CPP (MOCS ${${objectName}_MOCS})
include_directories (SYSTEM
${QWT_INCLUDE_DIRS}
${FFTW_INCLUDE_DIRS}
${SAMPLERATE_INCLUDE_DIRS}
${PORTAUDIO_INCLUDE_DIRS}
${SNDFILES_INCLUDE_DIRS})
add_executable (${objectName}
${${objectName}_SRCS}
${UIS}
${MOCS}
)
target_link_libraries (${objectName}
Qt5::Widgets
${FFTW_LIBRARIES}
${extraLibs}
${SAMPLERATE_LIBRARIES}
${QWT_LIBRARIES})
INSTALL (TARGETS ${objectName} DESTINATION ./linux-bin)