mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-17 23:28:50 -05:00
cmake: fix *_DIR usage on FindLib and re-import SoapySDR module
This commit is contained in:
parent
e29500fc6d
commit
a4c8a9978a
@ -287,14 +287,7 @@ if(ENABLE_RTLSDR)
|
||||
find_package(LibRTLSDR)
|
||||
endif()
|
||||
if(ENABLE_SOAPYSDR)
|
||||
find_package(SoapySDR 0.4.0 NO_MODULE)
|
||||
if(NOT "${SoapySDR_LIBRARIES}" STREQUAL "" AND NOT "${SoapySDR_INCLUDE_DIRS}" STREQUAL "")
|
||||
set(SOAPYSDR_FOUND ON)
|
||||
message(STATUS "Found SoapySDR: ${SoapySDR_INCLUDE_DIRS}, ${SoapySDR_LIBRARIES}")
|
||||
endif()
|
||||
# Only on APPLE; bad!
|
||||
string(REPLACE "-flat_namespace" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
||||
string(REPLACE "-flat_namespace" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
|
||||
find_package(SoapySDR)
|
||||
endif()
|
||||
if(ENABLE_XTRX)
|
||||
find_package(LibXTRX)
|
||||
|
@ -2,7 +2,7 @@ if(NOT LIBBLADERF_FOUND)
|
||||
|
||||
pkg_check_modules (LIBBLADERF_PKG libbladerf>=2.0)
|
||||
|
||||
if(LIBBLADERF_PKG_FOUND)
|
||||
if(LIBBLADERF_PKG_FOUND OR (DEFINED BLADERF_DIR))
|
||||
find_path(LIBBLADERF_INCLUDE_DIRS
|
||||
NAMES libbladeRF.h
|
||||
PATHS ${BLADERF_DIR}/include
|
||||
@ -29,6 +29,6 @@ if(NOT LIBBLADERF_FOUND)
|
||||
|
||||
mark_as_advanced(LIBBLADERF_INCLUDE_DIRS LIBBLADERF_LIBRARIES)
|
||||
|
||||
endif(LIBBLADERF_PKG_FOUND)
|
||||
endif(LIBBLADERF_PKG_FOUND OR (DEFINED BLADERF_DIR))
|
||||
|
||||
endif(NOT LIBBLADERF_FOUND)
|
||||
|
@ -2,7 +2,7 @@ if(NOT LIBIIO_FOUND)
|
||||
|
||||
pkg_check_modules (LIBIIO_PKG libiio>=0.7)
|
||||
|
||||
if(LIBIIO_PKG_FOUND)
|
||||
if(LIBIIO_PKG_FOUND OR (DEFINED IIO_DIR))
|
||||
find_path(LIBIIO_INCLUDE_DIR
|
||||
NAMES iio.h
|
||||
PATHS ${IIO_DIR}/include
|
||||
@ -20,15 +20,15 @@ if(NOT LIBIIO_FOUND)
|
||||
)
|
||||
|
||||
if(LIBIIO_INCLUDE_DIR AND LIBIIO_LIBRARIES)
|
||||
set(LIBIIO_FOUND TRUE CACHE INTERNAL "libiio found")
|
||||
message(STATUS "Found libiio: ${LIBIIO_INCLUDE_DIR}, ${LIBIIO_LIBRARIES}")
|
||||
else(LIBIIO_INCLUDE_DIR AND LIBIIO_LIBRARIES)
|
||||
set(LIBIIO_FOUND FALSE CACHE INTERNAL "libiio found")
|
||||
message(STATUS "libiio not found.")
|
||||
endif(LIBIIO_INCLUDE_DIR AND LIBIIO_LIBRARIES)
|
||||
set(LIBIIO_FOUND TRUE CACHE INTERNAL "libiio found")
|
||||
message(STATUS "Found libiio: ${LIBIIO_INCLUDE_DIR}, ${LIBIIO_LIBRARIES}")
|
||||
else(LIBIIO_INCLUDE_DIR AND LIBIIO_LIBRARIES)
|
||||
set(LIBIIO_FOUND FALSE CACHE INTERNAL "libiio found")
|
||||
message(STATUS "libiio not found.")
|
||||
endif(LIBIIO_INCLUDE_DIR AND LIBIIO_LIBRARIES)
|
||||
|
||||
mark_as_advanced(LIBIIO_INCLUDE_DIR LIBIIO_LIBRARIES)
|
||||
mark_as_advanced(LIBIIO_INCLUDE_DIR LIBIIO_LIBRARIES)
|
||||
|
||||
endif(LIBIIO_PKG_FOUND)
|
||||
endif(LIBIIO_PKG_FOUND OR (DEFINED IIO_DIR))
|
||||
|
||||
endif(NOT LIBIIO_FOUND)
|
||||
|
52
cmake/Modules/FindSoapySDR.cmake
Normal file
52
cmake/Modules/FindSoapySDR.cmake
Normal file
@ -0,0 +1,52 @@
|
||||
if(NOT SOAPYSDR_FOUND)
|
||||
|
||||
function(_SOAPY_SDR_GET_ABI_VERSION VERSION SOAPY_SDR_INCLUDE_DIR)
|
||||
file(READ "${SOAPY_SDR_INCLUDE_DIR}/SoapySDR/Version.h" version_h)
|
||||
string(REGEX MATCH "\\#define SOAPY_SDR_ABI_VERSION \"([0-9]+\\.[0-9]+(-[A-Za-z0-9]+)?)\"" SOAPY_SDR_ABI_VERSION_MATCHES "${version_h}")
|
||||
if(NOT SOAPY_SDR_ABI_VERSION_MATCHES)
|
||||
message(FATAL_ERROR "Failed to extract version number from Version.h")
|
||||
endif(NOT SOAPY_SDR_ABI_VERSION_MATCHES)
|
||||
set(${VERSION} "${CMAKE_MATCH_1}" PARENT_SCOPE)
|
||||
endfunction(_SOAPY_SDR_GET_ABI_VERSION)
|
||||
|
||||
pkg_check_modules (LIBSOAPYSDR_PKG soapysdr>=0.4.0)
|
||||
|
||||
if(LIBSOAPYSDR_PKG_FOUND OR (DEFINED SOAPYSDR_DIR))
|
||||
|
||||
find_path (SOAPYSDR_INCLUDE_DIR
|
||||
NAMES SoapySDR/Version.h
|
||||
PATHS ${SOAPYSDR_DIR}/include
|
||||
${LIBSOAPYSDR_PKG_INCLUDE_DIRS}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
)
|
||||
|
||||
find_library (SOAPYSDR_LIBRARY
|
||||
NAMES SoapySDR
|
||||
HINTS ${CMAKE_INSTALL_PREFIX}/lib
|
||||
${CMAKE_INSTALL_PREFIX}/lib64
|
||||
PATHS ${SOAPYSDR_DIR}/lib
|
||||
${SOAPYSDR_DIR}/lib64
|
||||
${LIBSOAPYSDR_PKG_LIBRARY_DIRS}
|
||||
/usr/local/lib
|
||||
/usr/local/lib64
|
||||
/usr/lib
|
||||
/usr/lib64
|
||||
)
|
||||
|
||||
if (SOAPYSDR_INCLUDE_DIR AND SOAPYSDR_LIBRARY)
|
||||
set(SOAPYSDR_FOUND TRUE)
|
||||
# get the root of SoapySDR; used on cpack
|
||||
string(REGEX REPLACE "/lib/.*${CMAKE_SHARED_LIBRARY_SUFFIX}" "" SOAPYSDR_ROOT ${SOAPYSDR_LIBRARY})
|
||||
# get the soapy version; to using FindPkgConfig because we can use SOAPYSDR_DIR
|
||||
_SOAPY_SDR_GET_ABI_VERSION(SOAPYSDR_ABI_VERSION ${SOAPYSDR_INCLUDE_DIR})
|
||||
message (STATUS "Found SoapySDR: ${SOAPYSDR_INCLUDE_DIR}, ${SOAPYSDR_LIBRARY}")
|
||||
else()
|
||||
message (STATUS "SoapySDR not found")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(SOAPYSDR_INCLUDE_DIR SOAPYSDR_LIBRARY SOAPYSDR_ROOT SOAPYSDR_ABI_VERSION)
|
||||
|
||||
endif(LIBSOAPYSDR_PKG_FOUND OR (DEFINED SOAPYSDR_DIR))
|
||||
|
||||
endif(NOT SOAPYSDR_FOUND)
|
@ -69,11 +69,11 @@ Plugins = ../PlugIns
|
||||
# probably libmirsdrapi-rsp.dylib can't be re-distribuited
|
||||
# we remove the file at the end of fixup_bundle
|
||||
if(ENABLE_SOAPYSDR AND SOAPYSDR_FOUND)
|
||||
set(SOAPY_SDR_MOD_PATH "${SOAPY_SDR_ROOT}/lib/SoapySDR/modules${SOAPY_SDR_ABI_VERSION}")
|
||||
set(SOAPY_SDR_MOD_PATH "${SOAPYSDR_ROOT}/lib/SoapySDR/modules${SOAPYSDR_ABI_VERSION}")
|
||||
file(GLOB SOAPY_MODS ${SOAPY_SDR_MOD_PATH}/*.so)
|
||||
foreach(SOAPY_MOD_FILE ${SOAPY_MODS})
|
||||
install( FILES "${SOAPY_MOD_FILE}"
|
||||
DESTINATION "../Frameworks/SoapySDR/modules${SOAPY_SDR_ABI_VERSION}"
|
||||
DESTINATION "../Frameworks/SoapySDR/modules${SOAPYSDR_ABI_VERSION}"
|
||||
COMPONENT Runtime
|
||||
)
|
||||
endforeach()
|
||||
|
@ -15,7 +15,7 @@ set(soapysdrdevice_HEADERS
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${SoapySDR_INCLUDE_DIRS}
|
||||
${SOAPYSDR_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
add_library(soapysdrdevice SHARED
|
||||
@ -26,7 +26,7 @@ set_target_properties(soapysdrdevice
|
||||
PROPERTIES DEFINE_SYMBOL "devices_EXPORTS")
|
||||
|
||||
target_link_libraries(soapysdrdevice
|
||||
${SoapySDR_LIBRARIES}
|
||||
${SOAPYSDR_LIBRARY}
|
||||
sdrbase
|
||||
)
|
||||
|
||||
|
@ -17,7 +17,7 @@ set(soapysdroutput_HEADERS
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${CMAKE_SOURCE_DIR}/devices
|
||||
${SoapySDR_INCLUDE_DIRS}
|
||||
${SOAPYSDR_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
if(NOT SERVER_MODE)
|
||||
@ -53,7 +53,7 @@ target_link_libraries(${TARGET_NAME}
|
||||
sdrbase
|
||||
${TARGET_LIB_GUI}
|
||||
swagger
|
||||
${SoapySDR_LIBRARIES}
|
||||
${SOAPYSDR_LIBRARY}
|
||||
soapysdrdevice
|
||||
)
|
||||
|
||||
|
@ -17,7 +17,7 @@ set(soapysdrinput_HEADERS
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
|
||||
${CMAKE_SOURCE_DIR}/devices
|
||||
${SoapySDR_INCLUDE_DIRS}
|
||||
${SOAPYSDR_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
if(NOT SERVER_MODE)
|
||||
@ -53,7 +53,7 @@ target_link_libraries(${TARGET_NAME}
|
||||
sdrbase
|
||||
${TARGET_LIB_GUI}
|
||||
swagger
|
||||
${SOAPYSDR_LIBRARIES}
|
||||
${SOAPYSDR_LIBRARY}
|
||||
soapysdrdevice
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user