-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
46 lines (37 loc) · 1.21 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
cmake_minimum_required (VERSION 3.2)
project (adsbdec C)
add_compile_options(-O3 -march=native)
add_executable(adsbdec demod.c main.c crc.c output.c valid.c )
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( adsbdec PRIVATE rtl.c)
target_link_libraries( adsbdec ${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( adsbdec PRIVATE air.c)
target_link_libraries( adsbdec ${LIBAIR})
endif()
if(rtl AND airspy )
message ("Sorry, could not compile for rtl AND airspy")
message ("try : cmake -Drtl=ON -Dairspy=OFF" ..)
message ("or cmake -Drtl=OFF -Dairspy=ON" ..)
endif()
if(NOT rtl AND NOT airspy )
message ("No sdr option set ! Are you sure ?")
message ("try cmake -Drtl=ON or -Dairspy=ON ..")
endif()
target_link_libraries( adsbdec pthread m )
install(TARGETS adsbdec RUNTIME DESTINATION bin)
install(FILES adsbdec.service DESTINATION /lib/systemd/system)
install(FILES adsbdec.default RENAME adsbdec DESTINATION /etc/default)