-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[rtlsdr] Add new port #10901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
[rtlsdr] Add new port #10901
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.