forked from steve-m/librtlsdr
/
CMakeLists.txt
93 lines (69 loc) · 2.56 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
project(rtlsdr)
cmake_minimum_required(VERSION 2.8)
# created and tested with
# Qt 5.6.1 for Windows 32-bit (MinGW 4.9.2) from
# https://www.qt.io/download-open-source/#section-2
#
# and QtCreator 4.1.0
#
# and LibUSB 1.0.20 from
# https://sourceforge.net/projects/libusb/files/
# libusb-1.0.20.7z
#
# edit this path
SET( LIBUSBBASE C:/src/_foreign/libusb-1.0.20 )
OPTION(RTL_FULL_STATIC_BUILD "Build rtl-tools fully static." OFF)
if(RTL_FULL_STATIC_BUILD)
if (WIN32)
if(MINGW)
# Special MINGW stuff here
# see https://cmake.org/pipermail/cmake/2012-September/051970.html
# see http://stackoverflow.com/questions/13768515/how-to-do-static-linking-of-libwinpthread-1-dll-in-mingw
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++")
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static -static-libgcc -s")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static -static-libgcc -static-libstdc++ -s")
endif()
endif()
endif()
add_definitions( -DWIN32 -D_WIN32 -DNDEBUG )
include_directories(
../include
${LIBUSBBASE}/include/libusb-1.0
)
SET( LIBUSB ${LIBUSBBASE}/MinGW32/static/libusb-1.0.a )
SET( SOCKLIBS ws2_32 wsock32 )
SET( RTLLIBFILES
../include/rtl_tcp.h
../include/reg_field.h
../include/rtlsdr_i2c.h
../src/convenience/convenience.c
../src/convenience/convenience.h
../src/getopt/getopt.c
../src/getopt/getopt.h
../include/rtl-sdr_export.h
../include/rtl-sdr.h
../src/librtlsdr.c
../include/tuner_e4k.h
../src/tuner_e4k.c
../include/tuner_fc0012.h
../src/tuner_fc0012.c
../include/tuner_fc0013.h
../src/tuner_fc0013.c
../include/tuner_fc2580.h
../src/tuner_fc2580.c
../include/tuner_r82xx.h
../src/tuner_r82xx.c
)
add_executable( rtl_test ../src/rtl_test.c ${RTLLIBFILES} )
target_link_libraries( rtl_test ${LIBUSB} )
add_executable( rtl_fm ../src/rtl_fm.c ${RTLLIBFILES} )
target_link_libraries( rtl_fm ${LIBUSB} )
add_executable( rtl_tcp ../src/rtl_tcp.c ${RTLLIBFILES} )
target_link_libraries( rtl_tcp ${LIBUSB} ${SOCKLIBS} )
add_executable( rtl_adsb ../src/rtl_adsb.c ${RTLLIBFILES} )
target_link_libraries( rtl_adsb ${LIBUSB} )
add_executable( rtl_power ../src/rtl_power.c ${RTLLIBFILES} )
target_link_libraries( rtl_power ${LIBUSB} )
add_executable( rtl_ir ../src/rtl_ir.c ${RTLLIBFILES} )
target_link_libraries( rtl_ir ${LIBUSB} )