File: 0011-Fixed-issues-compiling-on-Windows-with-MSVC-CMake-an.patch

package info (click to toggle)
rtl-sdr 0.6.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,660 kB
  • sloc: ansic: 9,305; python: 102; sh: 86; makefile: 74; xml: 57
file content (75 lines) | stat: -rw-r--r-- 3,151 bytes parent folder | download
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
From b5af355b1d833b3c898a61cf1e072b59b0ea3440 Mon Sep 17 00:00:00 2001
From: leonsal <leonsal@users.noreply.github.com>
Date: Tue, 3 Dec 2019 16:47:17 -0300
Subject: [PATCH 11/33] Fixed issues compiling on Windows with MSVC, CMake and
 NMake (#61)

When trying to build a simple program which uses librtlsdr
as a subproject on Windows, CMake reported several problems
which were solved by:
- Added complete name of libusb in FindLibUSB module.
- Replaced CMAKE_SOURCE_DIR to PROJECT_SOURCE_DIR in src/CMakeLists.txt.
- Replaced header file <afxres.h> in src/rtlsdr.rc.in (only present when windows MFC is
  installed) by <windows.h> which defines the same constants.
---
 cmake/Modules/FindLibUSB.cmake | 2 +-
 src/CMakeLists.txt             | 4 +++-
 src/rtlsdr.rc.in               | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/cmake/Modules/FindLibUSB.cmake b/cmake/Modules/FindLibUSB.cmake
index c2c3f63..bbf5593 100644
--- a/cmake/Modules/FindLibUSB.cmake
+++ b/cmake/Modules/FindLibUSB.cmake
@@ -9,7 +9,7 @@ if(NOT LIBUSB_FOUND)
   )
 
 #standard library name for libusb-1.0
-set(libusb1_library_names usb-1.0)
+set(libusb1_library_names usb-1.0 libusb-1.0)
 
 #libusb-1.0 compatible library on freebsd
 if((CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") OR (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD"))
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8713fba..5d6aff0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -34,7 +34,7 @@ RTLSDR_APPEND_SRCS(
 # Set up Windows DLL resource files
 ########################################################################
 IF(MSVC)
-    include(${CMAKE_SOURCE_DIR}/cmake/Modules/Version.cmake)
+    include(${PROJECT_SOURCE_DIR}/cmake/Modules/Version.cmake)
 
     configure_file(
         ${CMAKE_CURRENT_SOURCE_DIR}/rtlsdr.rc.in
@@ -146,6 +146,7 @@ target_link_libraries(rtl_fm libgetopt_static)
 target_link_libraries(rtl_eeprom libgetopt_static)
 target_link_libraries(rtl_adsb libgetopt_static)
 target_link_libraries(rtl_power libgetopt_static)
+target_link_libraries(rtl_biast libgetopt_static)
 set_property(TARGET rtl_sdr APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
 set_property(TARGET rtl_tcp APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
 set_property(TARGET rtl_test APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
@@ -153,6 +154,7 @@ set_property(TARGET rtl_fm APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
 set_property(TARGET rtl_eeprom APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
 set_property(TARGET rtl_adsb APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
 set_property(TARGET rtl_power APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
+set_property(TARGET rtl_biast APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
 endif()
 ########################################################################
 # Install built library files & utilities
diff --git a/src/rtlsdr.rc.in b/src/rtlsdr.rc.in
index bf603c3..0861ecb 100644
--- a/src/rtlsdr.rc.in
+++ b/src/rtlsdr.rc.in
@@ -1,5 +1,5 @@
 
-#include <afxres.h>
+#include <windows.h>
 
 VS_VERSION_INFO VERSIONINFO
   FILEVERSION 0,0,0,0
-- 
2.30.2