2020-07-27 18:30:39 +02:00
|
|
|
From c8878472bf84c656979ea1d07e7ed55b0aa2c939 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
|
|
|
|
Date: Fri, 15 May 2020 16:14:48 +0200
|
2018-06-03 16:17:51 +02:00
|
|
|
Subject: [PATCH] disable shared library target in build
|
|
|
|
|
|
|
|
Disable shared library target if BUILD_SHARED_LIBS if OFF.
|
|
|
|
|
|
|
|
Patch retrieved from
|
2020-07-27 18:30:39 +02:00
|
|
|
https://git.buildroot.net/buildroot/tree/package/librtlsdr/0001-disable_shared_library_target_in_build.patch?h=2020.02.x
|
2018-06-03 16:17:51 +02:00
|
|
|
|
2020-07-27 18:30:39 +02:00
|
|
|
Patch has been updated to work with master and to be able to keep current
|
2018-06-03 16:17:51 +02:00
|
|
|
behavior of building shared and static version of library if
|
|
|
|
BUILD_SHARED_LIBS and BUILD_STATIC_LIBS are both set.
|
|
|
|
Moreover, if BUILD_STATIC_LIBS is OFF, only shared version of library
|
|
|
|
will be install.
|
|
|
|
|
2020-07-27 18:30:39 +02:00
|
|
|
[Upstream status: http://lists.osmocom.org/pipermail/osmocom-sdr/2020-May/002075.html]
|
2018-06-03 16:17:51 +02:00
|
|
|
|
|
|
|
Signed-off-by: Yuvaraj Patil <yuvaraj.patil@wipro.com>
|
|
|
|
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
2020-07-27 18:30:39 +02:00
|
|
|
Signed-off-by: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
|
2018-06-03 16:17:51 +02:00
|
|
|
---
|
2020-07-27 18:30:39 +02:00
|
|
|
src/CMakeLists.txt | 30 +++++++++++++++++++++---------
|
|
|
|
1 file changed, 21 insertions(+), 9 deletions(-)
|
2018-06-03 16:17:51 +02:00
|
|
|
|
|
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
2020-07-27 18:30:39 +02:00
|
|
|
index 33faee7..d82fc87 100644
|
2018-06-03 16:17:51 +02:00
|
|
|
--- a/src/CMakeLists.txt
|
|
|
|
+++ b/src/CMakeLists.txt
|
2020-07-27 18:30:39 +02:00
|
|
|
@@ -18,6 +18,8 @@
|
2018-06-03 16:17:51 +02:00
|
|
|
########################################################################
|
|
|
|
# Setup shared library variant
|
|
|
|
########################################################################
|
|
|
|
+option(BUILD_SHARED_LIBS "Build shared library" ON)
|
|
|
|
+if(BUILD_SHARED_LIBS)
|
2020-07-27 18:30:39 +02:00
|
|
|
add_library(rtlsdr SHARED librtlsdr.c
|
|
|
|
tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c)
|
|
|
|
target_link_libraries(rtlsdr PkgConfig::LIBUSB)
|
|
|
|
@@ -30,10 +32,14 @@ set_target_properties(rtlsdr PROPERTIES OUTPUT_NAME rtlsdr)
|
|
|
|
set_target_properties(rtlsdr PROPERTIES SOVERSION ${MAJOR_VERSION})
|
|
|
|
set_target_properties(rtlsdr PROPERTIES VERSION ${LIBVER})
|
|
|
|
generate_export_header(rtlsdr)
|
|
|
|
+list(APPEND rtlsdr_lib rtlsdr)
|
2018-06-03 16:17:51 +02:00
|
|
|
+endif()
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# Setup static library variant
|
|
|
|
########################################################################
|
|
|
|
+option(BUILD_STATIC_LIBS "Build static library" ON)
|
|
|
|
+if(BUILD_STATIC_LIBS)
|
2020-07-27 18:30:39 +02:00
|
|
|
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_static PkgConfig::LIBUSB)
|
|
|
|
@@ -47,6 +53,8 @@ if(NOT WIN32)
|
2018-06-03 16:17:51 +02:00
|
|
|
set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
|
|
|
|
endif()
|
2020-07-27 18:30:39 +02:00
|
|
|
generate_export_header(rtlsdr_static)
|
2018-06-03 16:17:51 +02:00
|
|
|
+list(APPEND rtlsdr_lib rtlsdr_static)
|
|
|
|
+endif()
|
|
|
|
|
|
|
|
########################################################################
|
2020-07-27 18:30:39 +02:00
|
|
|
# Set up Windows DLL resource files
|
|
|
|
@@ -90,37 +98,37 @@ add_executable(rtl_eeprom rtl_eeprom.c)
|
2018-06-03 16:17:51 +02:00
|
|
|
add_executable(rtl_adsb rtl_adsb.c)
|
|
|
|
add_executable(rtl_power rtl_power.c)
|
2020-07-27 18:30:39 +02:00
|
|
|
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)
|
|
|
|
+set(INSTALL_TARGETS ${rtlsdr_lib} rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast)
|
2018-06-03 16:17:51 +02:00
|
|
|
|
2020-07-27 18:30:39 +02:00
|
|
|
-target_link_libraries(rtl_sdr rtlsdr convenience_static
|
2018-06-03 16:17:51 +02:00
|
|
|
+target_link_libraries(rtl_sdr ${rtlsdr_lib} convenience_static
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2020-07-27 18:30:39 +02:00
|
|
|
-target_link_libraries(rtl_tcp rtlsdr convenience_static
|
2018-06-03 16:17:51 +02:00
|
|
|
+target_link_libraries(rtl_tcp ${rtlsdr_lib} convenience_static
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2020-07-27 18:30:39 +02:00
|
|
|
-target_link_libraries(rtl_test rtlsdr convenience_static
|
2018-06-03 16:17:51 +02:00
|
|
|
+target_link_libraries(rtl_test ${rtlsdr_lib} convenience_static
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2020-07-27 18:30:39 +02:00
|
|
|
-target_link_libraries(rtl_fm rtlsdr convenience_static
|
2018-06-03 16:17:51 +02:00
|
|
|
+target_link_libraries(rtl_fm ${rtlsdr_lib} convenience_static
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2020-07-27 18:30:39 +02:00
|
|
|
-target_link_libraries(rtl_eeprom rtlsdr convenience_static
|
2018-06-03 16:17:51 +02:00
|
|
|
+target_link_libraries(rtl_eeprom ${rtlsdr_lib} convenience_static
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2020-07-27 18:30:39 +02:00
|
|
|
-target_link_libraries(rtl_adsb rtlsdr convenience_static
|
2018-06-03 16:17:51 +02:00
|
|
|
+target_link_libraries(rtl_adsb ${rtlsdr_lib} convenience_static
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2020-07-27 18:30:39 +02:00
|
|
|
-target_link_libraries(rtl_power rtlsdr convenience_static
|
2018-06-03 16:17:51 +02:00
|
|
|
+target_link_libraries(rtl_power ${rtlsdr_lib} convenience_static
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2020-07-27 18:30:39 +02:00
|
|
|
-target_link_libraries(rtl_biast rtlsdr convenience_static
|
|
|
|
+target_link_libraries(rtl_biast ${rtlsdr_lib} convenience_static
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
|
|
|
@@ -156,12 +164,16 @@ endif()
|
|
|
|
########################################################################
|
|
|
|
# Install built library files & utilities
|
|
|
|
########################################################################
|
|
|
|
+if(BUILD_SHARED_LIBS)
|
|
|
|
install(TARGETS rtlsdr EXPORT RTLSDR-export
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file
|
|
|
|
)
|
|
|
|
+endif()
|
|
|
|
+if(BUILD_STATIC_LIBS)
|
|
|
|
install(TARGETS rtlsdr_static EXPORT RTLSDR-export
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so/.dylib file
|
|
|
|
)
|
|
|
|
+endif()
|
|
|
|
install(TARGETS rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power
|
|
|
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
)
|
2018-06-03 16:17:51 +02:00
|
|
|
--
|
2020-07-27 18:30:39 +02:00
|
|
|
2.26.2
|
2018-06-03 16:17:51 +02:00
|
|
|
|