forked from microsoft/vcpkg
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rtlsdr] Update to 2.0.2, cleanup (microsoft#43042)
Co-authored-by: Martin Pool <[email protected]>
- Loading branch information
1 parent
06058fe
commit a3a2cda
Showing
15 changed files
with
309 additions
and
151 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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,60 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 1ff6c9a..95c335c 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -73,6 +73,7 @@ if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(LIBUSB libusb-1.0 IMPORTED_TARGET) | ||
if(LIBUSB_LINK_LIBRARIES) | ||
set(LIBUSB_LIBRARIES "${LIBUSB_LINK_LIBRARIES}") | ||
+ set(LIBUSB_LIBRARY_DIRS "") | ||
endif() | ||
else() | ||
set(LIBUSB_LIBRARIES "" CACHE STRING "manual libusb path") | ||
@@ -80,7 +81,8 @@ else() | ||
endif() | ||
|
||
if(MSVC) | ||
- set(THREADS_PTHREADS_LIBRARY "" CACHE STRING "manual pthread-win32 path") | ||
+ find_package(PThreads4W REQUIRED) | ||
+ set(THREADS_PTHREADS_LIBRARY "PThreads4W::PThreads4W" CACHE INTERNAL "") | ||
set(THREADS_PTHREADS_INCLUDE_DIR "" CACHE STRING "manual pthread-win32 includepath") | ||
else() | ||
set(THREADS_PTHREADS_LIBRARY "" CACHE INTERNAL "manual pthread-win32 path") | ||
diff --git a/cmake/rtlsdrConfig.cmake b/cmake/rtlsdrConfig.cmake | ||
index eeff2f3..23702ca 100644 | ||
--- a/cmake/rtlsdrConfig.cmake | ||
+++ b/cmake/rtlsdrConfig.cmake | ||
@@ -1,5 +1,7 @@ | ||
-include(FindPkgConfig) | ||
-pkg_check_modules(LIBUSB libusb-1.0 IMPORTED_TARGET) | ||
+if(MSVC) | ||
+ include(CMakeFindDependencyMacro) | ||
+ find_dependency(PThreads4W) | ||
+endif() | ||
|
||
get_filename_component(RTLSDR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) | ||
|
||
diff --git a/librtlsdr.pc.in b/librtlsdr.pc.in | ||
index e46519a..92bbddf 100644 | ||
--- a/librtlsdr.pc.in | ||
+++ b/librtlsdr.pc.in | ||
@@ -8,4 +8,5 @@ Description: C Utility Library | ||
Version: @VERSION@ | ||
Cflags: -I${includedir}/ | ||
Libs: -L${libdir} -lrtlsdr | ||
-Libs.private: -lusb-1.0 @RTLSDR_PC_LIBS@ | ||
+Libs.private: @RTLSDR_PC_LIBS@ | ||
+Requires.private: libusb-1.0 | ||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | ||
index a2bcb3d..ecc3c90 100644 | ||
--- a/src/CMakeLists.txt | ||
+++ b/src/CMakeLists.txt | ||
@@ -38,7 +38,7 @@ 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) | ||
-target_link_libraries(rtlsdr ${LIBUSB_LIBRARIES} ${THREADS_PTHREADS_LIBRARY}) | ||
+target_link_libraries(rtlsdr_static ${LIBUSB_LIBRARIES} ${THREADS_PTHREADS_LIBRARY}) | ||
target_include_directories(rtlsdr_static PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include> # <prefix>/include |
This file was deleted.
Oops, something went wrong.
This file contains 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,100 @@ | ||
diff --git a/librtlsdr.pc.in b/librtlsdr.pc.in | ||
index 92bbddf..20a2735 100644 | ||
--- a/librtlsdr.pc.in | ||
+++ b/librtlsdr.pc.in | ||
@@ -7,6 +7,7 @@ Name: RTL-SDR Library | ||
Description: C Utility Library | ||
Version: @VERSION@ | ||
Cflags: -I${includedir}/ | ||
+Cflags.private: -Drtlsdr_STATIC | ||
Libs: -L${libdir} -lrtlsdr | ||
Libs.private: @RTLSDR_PC_LIBS@ | ||
Requires.private: libusb-1.0 | ||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | ||
index 3c02e6c..e6585ee 100644 | ||
--- a/src/CMakeLists.txt | ||
+++ b/src/CMakeLists.txt | ||
@@ -45,12 +45,11 @@ target_include_directories(rtlsdr_static PUBLIC | ||
${LIBUSB_INCLUDE_DIRS} | ||
${THREADS_PTHREADS_INCLUDE_DIR} | ||
) | ||
-set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" ) | ||
+target_compile_definitions(rtlsdr_static PUBLIC "rtlsdr_STATIC") | ||
if(NOT WIN32) | ||
# Force same library filename for static and shared variants of the library | ||
set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr) | ||
endif() | ||
-generate_export_header(rtlsdr_static) | ||
|
||
######################################################################## | ||
# Set up Windows DLL resource files | ||
@@ -66,6 +65,14 @@ IF(MSVC) | ||
target_sources(rtlsdr_static PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc) | ||
ENDIF(MSVC) | ||
|
||
+if(BUILD_SHARED_LIBS) | ||
+ set(rtlsdr_target rtlsdr) | ||
+ set_target_properties(rtlsdr_static PROPERTIES EXCLUDE_FROM_ALL 1) | ||
+else() | ||
+ set(rtlsdr_target rtlsdr_static) | ||
+ set_target_properties(rtlsdr PROPERTIES EXCLUDE_FROM_ALL 1) | ||
+endif() | ||
+ | ||
######################################################################## | ||
# Setup libraries used in executables | ||
######################################################################## | ||
@@ -79,7 +86,7 @@ add_library(libgetopt_static STATIC | ||
getopt/getopt.c | ||
) | ||
target_link_libraries(convenience_static | ||
- rtlsdr | ||
+ ${rtlsdr_target} | ||
) | ||
endif() | ||
|
||
@@ -96,6 +103,10 @@ add_executable(rtl_power rtl_power.c) | ||
add_executable(rtl_biast rtl_biast.c) | ||
set(INSTALL_TARGETS rtlsdr rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast) | ||
|
||
+foreach(executable IN ITEMS rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast) | ||
+ target_link_libraries(${executable} convenience_static ${rtlsdr_target} ${THREADS_PTHREADS_LIBRARY}) | ||
+endforeach() | ||
+if(0) | ||
target_link_libraries(rtl_sdr rtlsdr convenience_static | ||
${LIBUSB_LIBRARIES} | ||
${CMAKE_THREAD_LIBS_INIT} | ||
@@ -128,6 +139,7 @@ target_link_libraries(rtl_biast rtlsdr convenience_static | ||
${LIBUSB_LIBRARIES} | ||
${CMAKE_THREAD_LIBS_INIT} | ||
) | ||
+endif(0) | ||
if(UNIX) | ||
target_link_libraries(rtl_fm m) | ||
target_link_libraries(rtl_adsb m) | ||
@@ -148,6 +160,7 @@ 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) | ||
+if(0) | ||
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" ) | ||
@@ -156,16 +169,12 @@ set_property(TARGET rtl_eeprom APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATI | ||
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(0) | ||
endif() | ||
######################################################################## | ||
# Install built library files & utilities | ||
######################################################################## | ||
-install(TARGETS rtlsdr EXPORT RTLSDR-export | ||
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file | ||
- ) | ||
-install(TARGETS rtlsdr_static EXPORT RTLSDR-export | ||
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file | ||
- ) | ||
+install(TARGETS ${rtlsdr_target} EXPORT RTLSDR-export) | ||
install(TARGETS rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast | ||
DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) |
This file contains 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 |
---|---|---|
@@ -1,44 +1,50 @@ | ||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO osmocom/rtl-sdr | ||
REF d794155ba65796a76cd0a436f9709f4601509320 | ||
SHA512 21fe10f1dbecca651650f03d1008560930fac439d220c33b4a23acce98d78d8476ff200765eed8cfa6cddde761d45f7ba36c8b5bc3662aa85819172830ea4938 | ||
REF v${VERSION} | ||
SHA512 20a1630df7d4da5d263c5ffd4d83a7c2a6fc674e3838bf02b2b59c1da8d946dafc48790d410ab2fcbc0362c2ac70e5cdcae9391c5f04803bf2cdddafd6f58483 | ||
HEAD_REF master | ||
PATCHES | ||
Compile-with-msvc.patch | ||
fix-version.patch | ||
dependencies.diff | ||
library-linkage.diff | ||
tools.diff | ||
) | ||
|
||
file( | ||
COPY "${CMAKE_CURRENT_LIST_DIR}/Findlibusb.cmake" | ||
DESTINATION "${SOURCE_PATH}/cmake/Modules" | ||
vcpkg_check_features(OUT_FEATURE_OPTIONS options | ||
FEATURES | ||
tools BUILD_TOOLS | ||
) | ||
|
||
vcpkg_find_acquire_program(PKGCONFIG) | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
OPTIONS | ||
${options} | ||
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" | ||
"-DCMAKE_REQUIRE_FIND_PACKAGE_PkgConfig=1" | ||
"-DCMAKE_DISABLE_FIND_PACKAGE_Git=1" | ||
OPTIONS_DEBUG | ||
-DBUILD_TOOLS=OFF | ||
) | ||
|
||
vcpkg_cmake_install() | ||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/rtlsdr) | ||
vcpkg_copy_pdbs() | ||
vcpkg_fixup_pkgconfig() | ||
|
||
file( | ||
INSTALL "${SOURCE_PATH}/COPYING" | ||
DESTINATION "${CURRENT_PACKAGES_DIR}/share/rtlsdr" | ||
RENAME copyright | ||
) | ||
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static") | ||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/librtlsdr.pc" " -lrtlsdr" " -lrtlsdr_static") | ||
if(NOT VCPKG_BUILD_TYPE) | ||
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/librtlsdr.pc" " -lrtlsdr" " -lrtlsdr_static") | ||
endif() | ||
endif() | ||
|
||
if("tools" IN_LIST FEATURES) | ||
vcpkg_copy_tools(TOOL_NAMES rtl_adsb rtl_biast rtl_eeprom rtl_fm rtl_power rtl_sdr rtl_tcp rtl_test AUTO_CLEAN) | ||
endif() | ||
|
||
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() | ||
file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") |
This file contains 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,26 @@ | ||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | ||
index 18c3821..52f4991 100644 | ||
--- a/src/CMakeLists.txt | ||
+++ b/src/CMakeLists.txt | ||
@@ -103,8 +103,12 @@ add_executable(rtl_power rtl_power.c) | ||
add_executable(rtl_biast rtl_biast.c) | ||
set(INSTALL_TARGETS rtlsdr rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast) | ||
|
||
+option(BUILD_TOOLS "Build tools" ON) | ||
foreach(executable IN ITEMS rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast) | ||
target_link_libraries(${executable} convenience_static ${rtlsdr_target} ${THREADS_PTHREADS_LIBRARY}) | ||
+ if(NOT BUILD_TOOLS) | ||
+ set_target_properties(${executable} PROPERTIES EXCLUDE_FROM_ALL 1) | ||
+ endif() | ||
endforeach() | ||
if(0) | ||
target_link_libraries(rtl_sdr rtlsdr convenience_static | ||
@@ -175,6 +179,8 @@ endif() | ||
# Install built library files & utilities | ||
######################################################################## | ||
install(TARGETS ${rtlsdr_target} EXPORT RTLSDR-export) | ||
+if(BUILD_TOOLS) | ||
install(TARGETS rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast | ||
DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
+endif() |
This file contains 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,9 @@ | ||
rtlsdr provides CMake targets: | ||
|
||
find_package(rtlsdr CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:rtlsdr::rtlsdr>,rtlsdr::rtlsdr,rtlsdr::rtlsdr_static>) | ||
|
||
rtlsdr provides pkg-config modules: | ||
|
||
# C Utility Library | ||
librtlsdr |
Oops, something went wrong.