forked from TLeconte/acarsdec
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
115 lines (99 loc) · 3.22 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
cmake_minimum_required (VERSION 3.2)
project (acarsdec C)
add_compile_options(-Ofast)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
add_executable(acarsdec acars.c acarsdec.c label.c msk.c output.c netout.c fileout.c lib.c statsd.c)
find_package(PkgConfig)
if(NOT PKG_CONFIG_FOUND)
message ( FATAL_ERROR "pkg-config NOT FOUND")
endif()
pkg_check_modules(LIBCJSON libcjson)
if(LIBCJSON_FOUND)
add_definitions(-DHAVE_CJSON )
target_link_libraries(acarsdec ${LIBCJSON_LIBRARIES})
target_include_directories(acarsdec PUBLIC ${LIBCJSON_INCLUDE_DIRS})
target_link_directories(acarsdec PUBLIC ${LIBCJSON_LIBRARY_DIRS})
SET(WITH_MQTT NO)
find_library(MQTT paho-mqtt3a)
if(MQTT)
add_definitions(-DWITH_MQTT )
target_sources( acarsdec PRIVATE mqttout.c)
find_path(MQTT_INCPATH MQTTAsync.h)
target_include_directories(acarsdec PUBLIC ${MQTT_INCPATH})
target_link_libraries(acarsdec ${MQTT})
SET(WITH_MQTT YES)
endif()
message ( STATUS "Using paho-mqtt3a: ${WITH_MQTT}")
endif()
SET(WITH_ALSA NO)
pkg_check_modules(LIBASOUND alsa)
if(LIBASOUND_FOUND)
add_definitions(-DWITH_ALSA )
target_sources( acarsdec PRIVATE alsa.c)
target_link_libraries(acarsdec ${LIBASOUND_LIBRARIES})
target_include_directories(acarsdec PUBLIC ${LIBASOUND_INCLUDE_DIRS})
target_link_directories(acarsdec PUBLIC ${LIBASOUND_LIBRARY_DIRS})
SET(WITH_ALSA YES)
endif()
message ( STATUS "Using alsa: ${WITH_ALSA}")
SET(WITH_LIBACARS NO)
pkg_check_modules(LIBACARS libacars-2>=2.0.0)
if(LIBACARS_FOUND)
add_definitions(-DHAVE_LIBACARS )
target_link_libraries(acarsdec ${LIBACARS_LIBRARIES})
target_include_directories(acarsdec PUBLIC ${LIBACARS_INCLUDE_DIRS})
target_link_directories(acarsdec PUBLIC ${LIBACARS_LIBRARY_DIRS})
SET(WITH_LIBACARS YES)
endif()
message ( STATUS "Using libacars: ${WITH_LIBACARS}")
SET(WITH_SNDFILE NO)
find_library(LIBSNDFILE sndfile)
if(LIBSNDFILE)
add_definitions(-DWITH_SNDFILE )
target_sources( acarsdec PRIVATE soundfile.c)
find_path(LIBSNDFILE_INCPATH sndfile.h)
target_include_directories(acarsdec PUBLIC ${LIBSNDFILE_INCPATH})
target_link_libraries(acarsdec ${LIBSNDFILE})
SET(WITH_SNDFILE YES)
endif()
message ( STATUS "Using libsnd: ${WITH_SNDFILE}")
SET(WITH_RTL NO)
find_library(LIBRTL rtlsdr)
if(LIBRTL)
add_definitions(-DWITH_RTL )
target_sources( acarsdec PRIVATE rtl.c)
target_link_libraries( acarsdec ${LIBRTL})
SET(WITH_RTL YES)
endif()
message ( STATUS "Using librtlsdr: ${WITH_RTL}")
SET(WITH_AIR NO)
find_library(LIBAIR airspy)
if(LIBAIR)
add_definitions(-DWITH_AIR )
target_sources( acarsdec PRIVATE air.c)
target_link_libraries( acarsdec ${LIBAIR})
SET(WITH_AIR YES)
endif()
message ( STATUS "Using libairspy: ${WITH_AIR}")
SET(WITH_SDRPLAY NO)
find_library(LIBPLAY mirsdrapi-rsp)
if(LIBPLAY)
add_definitions(-DWITH_SDRPLAY )
target_sources( acarsdec PRIVATE sdrplay.c)
target_link_libraries( acarsdec ${LIBPLAY})
SET(WITH_SDRPLAY YES)
endif()
message ( STATUS "Using libmirsdrapi-rsp: ${WITH_SDRPLAY}")
SET(WITH_SOAPY NO)
find_library(LIBSOAPY SoapySDR)
if(LIBSOAPY)
add_definitions(-DWITH_SOAPY )
target_sources( acarsdec PRIVATE soapy.c)
target_link_libraries( acarsdec ${LIBSOAPY})
SET(WITH_SOAPY YES)
endif()
message ( STATUS "Using libSoapySDR: ${WITH_SOAPY}")
target_link_libraries( acarsdec pthread m )
install(TARGETS acarsdec
RUNTIME DESTINATION bin
)