-
Notifications
You must be signed in to change notification settings - Fork 89
/
CMakeLists.txt
94 lines (82 loc) · 2.4 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
cmake_minimum_required (VERSION 3.2)
project (acarsdec C)
add_compile_options(-Ofast -march=native)
add_executable(acarsdec acars.c acarsdec.c cJSON.c label.c msk.c output.c netout.c fileout.c )
find_package(PkgConfig)
if(PKG_CONFIG_FOUND)
pkg_check_modules(LIBACARS libacars-2>=2.0.0)
if(LIBACARS_FOUND)
message ( STATUS "Using libacars")
add_definitions(-DHAVE_LIBACARS )
target_link_libraries(acarsdec ${LIBACARS_LIBRARIES})
target_include_directories(acarsdec PUBLIC ${LIBACARS_INCLUDE_DIRS})
link_directories(${LIBACARS_LIBRARY_DIRS})
else()
message ( STATUS "Not using libacars")
endif()
endif()
find_library(MQTT paho-mqtt3a)
if(MQTT)
message ( STATUS "Using MQTT")
add_definitions(-DWITH_MQTT )
target_sources( acarsdec PRIVATE mqttout.c)
target_link_libraries(acarsdec ${MQTT})
else()
message ( STATUS "Not using MQTT")
endif()
find_library(LIBSNDFILE sndfile)
if(LIBSNDFILE)
message ( STATUS "Using libsnd")
add_definitions(-DWITH_SNDFILE )
target_sources( acarsdec PRIVATE soundfile.c)
target_link_libraries(acarsdec ${LIBSNDFILE})
else()
message ( STATUS "Not using libsndfile")
endif()
option(rtl "Compiling for rtl sdr" )
if(rtl)
find_library(LIBRTL rtlsdr)
if(NOT LIBRTL)
message (FATAL_ERROR "librtlsdr path not found")
endif()
add_definitions(-DWITH_RTL )
target_sources( acarsdec PRIVATE rtl.c)
target_link_libraries( acarsdec ${LIBRTL})
endif()
option(airspy "Compiling for airspy sdr" )
if(airspy)
find_library(LIBAIR airspy)
if(NOT LIBAIR)
message ( FATAL_ERROR "libairspy path not found")
endif()
add_definitions(-DWITH_AIR )
target_sources( acarsdec PRIVATE air.c)
target_link_libraries( acarsdec ${LIBAIR})
endif()
option(sdrplay "Compiling for sdrplay sdr" )
if(sdrplay)
find_library(LIBPLAY mirsdrapi-rsp)
if(NOT LIBPLAY)
message ( FATAL_ERROR "libmirsdrapi-rsp path not found")
endif()
add_definitions(-DWITH_SDRPLAY )
target_sources( acarsdec PRIVATE sdrplay.c)
target_link_libraries( acarsdec ${LIBPLAY})
endif()
option(soapy "Compiling for soapy sdr" )
if(soapy)
find_library(LIBSOAPY SoapySDR)
if(NOT LIBSOAPY)
message ( FATAL_ERROR "libSoapySDR path not found")
endif()
add_definitions(-DWITH_SOAPY )
target_sources( acarsdec PRIVATE soapy.c)
target_link_libraries( acarsdec ${LIBSOAPY})
endif()
if(NOT rtl AND NOT airspy AND NOT sdrplay AND NOT soapy)
message ("No sdr option set ! are you sure ?")
endif()
target_link_libraries( acarsdec pthread m )
install(TARGETS acarsdec
RUNTIME DESTINATION bin
)