mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 18:31:15 +08:00
[rtlsdr] Add new port (#10901)
* Add rtlsdr port * Update ci.baseline.txt * Update to use github mirror in portfile.cmake Co-authored-by: Egor Chesakov <echesakov@users.noreply.github.com>
This commit is contained in:
parent
aa0b9d7ca9
commit
2459c7c4ba
6
ports/rtlsdr/CONTROL
Normal file
6
ports/rtlsdr/CONTROL
Normal file
@ -0,0 +1,6 @@
|
||||
Source: rtlsdr
|
||||
Version: 2020-04-16
|
||||
Homepage: https://osmocom.org/projects/rtl-sdr
|
||||
Description: rtl-sdr is a library that turns your Realtek RTL2832 based DVB dongle into a SDR receiver
|
||||
Build-Depends: libusb, pthreads (windows)
|
||||
Supports: windows&(x86|x64)
|
88
ports/rtlsdr/Compile-with-msvc.patch
Normal file
88
ports/rtlsdr/Compile-with-msvc.patch
Normal file
@ -0,0 +1,88 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2def354..674ff2d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -66,6 +66,12 @@ endif()
|
||||
########################################################################
|
||||
# Find build dependencies
|
||||
########################################################################
|
||||
+if(MSVC)
|
||||
+find_package(pthreads)
|
||||
+find_package(libusb)
|
||||
+include_directories(${PThreads4W_INCLUDE_DIR})
|
||||
+include_directories(${LIBUSB_INCLUDE_DIRS})
|
||||
+else()
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(THREADS_USE_PTHREADS_WIN32 true)
|
||||
endif()
|
||||
@@ -79,6 +85,7 @@ endif()
|
||||
if(NOT THREADS_FOUND)
|
||||
message(FATAL_ERROR "pthreads(-win32) required to compile rtl-sdr")
|
||||
endif()
|
||||
+endif()
|
||||
|
||||
########################################################################
|
||||
# Create uninstall target
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index 33faee7..fda4612 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -20,7 +20,11 @@
|
||||
########################################################################
|
||||
add_library(rtlsdr SHARED librtlsdr.c
|
||||
tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c)
|
||||
+if(MSVC)
|
||||
+target_link_libraries(rtlsdr ${LIBUSB_LIBRARIES})
|
||||
+else()
|
||||
target_link_libraries(rtlsdr PkgConfig::LIBUSB)
|
||||
+endif()
|
||||
target_include_directories(rtlsdr PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include> # <prefix>/include
|
||||
@@ -36,7 +40,11 @@ generate_export_header(rtlsdr)
|
||||
########################################################################
|
||||
add_library(rtlsdr_static STATIC librtlsdr.c
|
||||
tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c)
|
||||
+if(MSVC)
|
||||
+target_link_libraries(rtlsdr_static ${LIBUSB_LIBRARIES})
|
||||
+else()
|
||||
target_link_libraries(rtlsdr_static PkgConfig::LIBUSB)
|
||||
+endif()
|
||||
target_include_directories(rtlsdr_static PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include> # <prefix>/include
|
||||
@@ -58,8 +66,8 @@ IF(MSVC)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rtlsdr.rc.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc
|
||||
@ONLY)
|
||||
- target_sources(rtlsdr ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
|
||||
- target_sources(rtlsdr_static ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
|
||||
+ target_sources(rtlsdr PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
|
||||
+ target_sources(rtlsdr_static PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
|
||||
ENDIF(MSVC)
|
||||
|
||||
########################################################################
|
||||
@@ -77,6 +85,11 @@ add_library(libgetopt_static STATIC
|
||||
target_link_libraries(convenience_static
|
||||
rtlsdr
|
||||
)
|
||||
+if(MSVC)
|
||||
+target_link_libraries(convenience_static
|
||||
+ ${PThreads4W_LIBRARY}
|
||||
+)
|
||||
+endif()
|
||||
endif()
|
||||
|
||||
########################################################################
|
||||
diff --git a/src/rtl_tcp.c b/src/rtl_tcp.c
|
||||
index 562198f..b4bfa51 100644
|
||||
--- a/src/rtl_tcp.c
|
||||
+++ b/src/rtl_tcp.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <winsock2.h>
|
||||
+#include <ws2tcpip.h>
|
||||
#include "getopt/getopt.h"
|
||||
#endif
|
||||
|
17
ports/rtlsdr/Findlibusb.cmake
Normal file
17
ports/rtlsdr/Findlibusb.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
find_path(
|
||||
LIBUSB_INCLUDE_DIRS
|
||||
NAMES libusb.h
|
||||
PATH_SUFFIXES libusb-1.0
|
||||
)
|
||||
|
||||
find_library(
|
||||
LIBUSB_LIBRARIES
|
||||
NAMES libusb-1.0
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(
|
||||
LIBUSB
|
||||
REQUIRED_VARS LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS
|
||||
)
|
48
ports/rtlsdr/portfile.cmake
Normal file
48
ports/rtlsdr/portfile.cmake
Normal file
@ -0,0 +1,48 @@
|
||||
vcpkg_fail_port_install(
|
||||
ON_TARGET "uwp" "linux" "osx" "android" "freebsd"
|
||||
ON_ARCH "arm" "arm64"
|
||||
)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO osmocom/rtl-sdr
|
||||
REF d794155ba65796a76cd0a436f9709f4601509320
|
||||
SHA512 21fe10f1dbecca651650f03d1008560930fac439d220c33b4a23acce98d78d8476ff200765eed8cfa6cddde761d45f7ba36c8b5bc3662aa85819172830ea4938
|
||||
HEAD_REF master
|
||||
PATCHES Compile-with-msvc.patch
|
||||
)
|
||||
|
||||
file(
|
||||
COPY ${CMAKE_CURRENT_LIST_DIR}/Findlibusb.cmake
|
||||
DESTINATION ${SOURCE_PATH}/cmake/Modules
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/rtlsdr)
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(
|
||||
INSTALL ${SOURCE_PATH}/COPYING
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}/share/rtlsdr
|
||||
RENAME copyright
|
||||
)
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
else()
|
||||
file(GLOB DEBUG_TOOLS "${CURRENT_PACKAGES_DIR}/debug/bin/*.exe")
|
||||
file(GLOB RELEASE_TOOLS "${CURRENT_PACKAGES_DIR}/bin/*.exe")
|
||||
file(
|
||||
INSTALL ${RELEASE_TOOLS}
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}
|
||||
)
|
||||
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
|
||||
file(REMOVE ${DEBUG_TOOLS} ${RELEASE_TOOLS})
|
||||
endif()
|
@ -1584,6 +1584,11 @@ rpclib:x64-uwp=fail
|
||||
rpclib:x64-windows=ignore
|
||||
rpclib:x86-windows=ignore
|
||||
rpclib:x64-windows-static=ignore
|
||||
rtlsdr:x64-uwp=fail
|
||||
rtlsdr:arm64-windows=fail
|
||||
rtlsdr:arm-uwp=fail
|
||||
rtlsdr:x64-linux=fail
|
||||
rtlsdr:x64-osx=fail
|
||||
rttr:arm-uwp=fail
|
||||
rttr:x64-uwp=fail
|
||||
rxspencer:x64-uwp=fail
|
||||
|
Loading…
x
Reference in New Issue
Block a user