diff --git a/cmake/Modules/FindSoapySDR.cmake b/cmake/Modules/FindSoapySDR.cmake index d52c3432ef..3d4604a645 100644 --- a/cmake/Modules/FindSoapySDR.cmake +++ b/cmake/Modules/FindSoapySDR.cmake @@ -9,44 +9,45 @@ if(NOT SOAPYSDR_FOUND) set(${VERSION} "${CMAKE_MATCH_1}" PARENT_SCOPE) endfunction(_SOAPY_SDR_GET_ABI_VERSION) - pkg_search_module (LIBSOAPYSDR_PKG soapysdr>=0.4.0 SoapySDR>=0.4.0) + pkg_search_module (SOAPYSDR SoapySDR>=0.4.0) - if(NOT LIBSOAPYSDR_PKG_FOUND OR (DEFINED SOAPYSDR_DIR)) + if(NOT SOAPYSDR_FOUND OR (DEFINED SOAPYSDR_DIR)) - find_path (SOAPYSDR_INCLUDE_DIR + find_path (SOAPYSDR_INCLUDE_DIRS NAMES SoapySDR/Version.h HINTS ${SOAPYSDR_DIR}/include - ${LIBSOAPYSDR_PKG_INCLUDE_DIRS} PATHS /usr/include /usr/local/include - ) + ) - find_library (SOAPYSDR_LIBRARY + find_library (SOAPYSDR_LINK_LIBRARIES NAMES SoapySDR HINTS ${SOAPYSDR_DIR}/lib ${SOAPYSDR_DIR}/lib64 ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - ${LIBSOAPYSDR_PKG_LIBRARY_DIRS} PATHS /usr/local/lib /usr/local/lib64 /usr/lib /usr/lib64 - ) + ) - if (SOAPYSDR_INCLUDE_DIR AND SOAPYSDR_LIBRARY) + if (SOAPYSDR_INCLUDE_DIRS AND SOAPYSDR_LINK_LIBRARIES) 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") + string(REGEX REPLACE "/lib/.*${CMAKE_SHARED_LIBRARY_SUFFIX}" "" SOAPYSDR_LIBDIR ${SOAPYSDR_LINK_LIBRARIES}) + # get the soapy version + _SOAPY_SDR_GET_ABI_VERSION(SOAPYSDR_VERSION ${SOAPYSDR_INCLUDE_DIRS}) endif() - mark_as_advanced(SOAPYSDR_INCLUDE_DIR SOAPYSDR_LIBRARY SOAPYSDR_ROOT SOAPYSDR_ABI_VERSION) + endif(NOT SOAPYSDR_FOUND OR (DEFINED SOAPYSDR_DIR)) - endif(NOT LIBSOAPYSDR_PKG_FOUND OR (DEFINED SOAPYSDR_DIR)) + if (SOAPYSDR_FOUND) + message (STATUS "Found SoapySDR: version ${SOAPYSDR_VERSION}, ${SOAPYSDR_LIBDIR}, ${SOAPYSDR_INCLUDE_DIRS}, ${SOAPYSDR_LINK_LIBRARIES}") + else() + message (STATUS "SoapySDR not found") + endif() + + mark_as_advanced(SOAPYSDR_INCLUDE_DIRS SOAPYSDR_LINK_LIBRARIES SOAPYSDR_LIBDIR SOAPYSDR_VERSION) endif(NOT SOAPYSDR_FOUND) diff --git a/cmake/cpack/CMakeLists.txt b/cmake/cpack/CMakeLists.txt index e454d467a3..3ce2842473 100644 --- a/cmake/cpack/CMakeLists.txt +++ b/cmake/cpack/CMakeLists.txt @@ -43,11 +43,11 @@ if(APPLE AND BUNDLE AND BUILD_GUI) # 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 "${SOAPYSDR_ROOT}/lib/SoapySDR/modules${SOAPYSDR_ABI_VERSION}") + set(SOAPY_SDR_MOD_PATH "${SOAPYSDR_LIBDIR}/lib/SoapySDR/modules${SOAPYSDR_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${SOAPYSDR_ABI_VERSION}" + DESTINATION "../Frameworks/SoapySDR/modules${SOAPYSDR_VERSION}" COMPONENT Runtime ) endforeach() diff --git a/devices/soapysdr/CMakeLists.txt b/devices/soapysdr/CMakeLists.txt index bcc90e206d..f9e1bbced8 100644 --- a/devices/soapysdr/CMakeLists.txt +++ b/devices/soapysdr/CMakeLists.txt @@ -15,7 +15,7 @@ set(soapysdrdevice_HEADERS ) include_directories( - ${SOAPYSDR_INCLUDE_DIR} + ${SOAPYSDR_INCLUDE_DIRS} ) add_library(soapysdrdevice SHARED @@ -26,7 +26,7 @@ set_target_properties(soapysdrdevice PROPERTIES DEFINE_SYMBOL "devices_EXPORTS") target_link_libraries(soapysdrdevice - ${SOAPYSDR_LIBRARY} + ${SOAPYSDR_LINK_LIBRARIES} sdrbase ) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index aaa9dc8deb..618a858999 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1224,7 +1224,7 @@ if (WIN32 OR APPLE) if (ENABLE_SOAPYSDR) if (WIN32) - set(SOAPYSDR_LIBRARY "${SDRANGEL_BINARY_LIB_DIR}/SoapySDR.lib" CACHE INTERNAL "") + set(SOAPYSDR_LINK_LIBRARIES "${SDRANGEL_BINARY_LIB_DIR}/SoapySDR.lib" CACHE INTERNAL "") endif () ExternalProject_Add(soapysdr GIT_REPOSITORY https://github.com/pothosware/SoapySDR.git @@ -1235,7 +1235,7 @@ if (WIN32 OR APPLE) -DENABLE_PYTHON=OFF -DENABLE_PYTHON3=OFF -DENABLE_TESTS=OFF - BUILD_BYPRODUCTS "${SOAPYSDR_LIBRARY}" + BUILD_BYPRODUCTS "${SOAPYSDR_LINK_LIBRARIES}" BUILD_COMMAND ${CMAKE_COMMAND} --build --config $ -- SoapySDR INSTALL_COMMAND "" TEST_COMMAND "" @@ -1243,12 +1243,12 @@ if (WIN32 OR APPLE) ExternalProject_Get_Property(soapysdr source_dir binary_dir) set_global_cache(SOAPYSDR_FOUND ON) set(SOAPYSDR_EXTERNAL ON CACHE INTERNAL "") - set(SOAPYSDR_INCLUDE_DIR "${source_dir}/include" CACHE INTERNAL "") + set(SOAPYSDR_INCLUDE_DIRS "${source_dir}/include" CACHE INTERNAL "") if (WIN32) install(FILES "${SDRANGEL_BINARY_BIN_DIR}/SoapySDR${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION "${INSTALL_LIB_DIR}") install(DIRECTORY "${SDRANGEL_BINARY_LIB_DIR}/SoapySDR" DESTINATION "${INSTALL_LIB_DIR}/lib") elseif (APPLE) - set(SOAPYSDR_LIBRARY "${binary_dir}/lib/libSoapySDR${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") + set(SOAPYSDR_LINK_LIBRARIES "${binary_dir}/lib/libSoapySDR${CMAKE_SHARED_LIBRARY_SUFFIX}" CACHE INTERNAL "") install(DIRECTORY "${binary_dir}/lib/" DESTINATION "${INSTALL_LIB_DIR}" FILES_MATCHING PATTERN "libSoapySDR*${CMAKE_SHARED_LIBRARY_SUFFIX}") set(MACOS_EXTERNAL_LIBS_FIXUP "${MACOS_EXTERNAL_LIBS_FIXUP};${binary_dir}/lib/") diff --git a/plugins/samplesink/soapysdroutput/CMakeLists.txt b/plugins/samplesink/soapysdroutput/CMakeLists.txt index 0fa5833b91..030adfee44 100644 --- a/plugins/samplesink/soapysdroutput/CMakeLists.txt +++ b/plugins/samplesink/soapysdroutput/CMakeLists.txt @@ -19,7 +19,7 @@ set(soapysdroutput_HEADERS include_directories( ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ${CMAKE_SOURCE_DIR}/devices - ${SOAPYSDR_INCLUDE_DIR} + ${SOAPYSDR_INCLUDE_DIRS} ) if(NOT SERVER_MODE) @@ -55,7 +55,7 @@ target_link_libraries(${TARGET_NAME} sdrbase ${TARGET_LIB_GUI} swagger - ${SOAPYSDR_LIBRARY} + ${SOAPYSDR_LINK_LIBRARIES} soapysdrdevice ) diff --git a/plugins/samplesource/soapysdrinput/CMakeLists.txt b/plugins/samplesource/soapysdrinput/CMakeLists.txt index 1bd2abe926..adbe5262db 100644 --- a/plugins/samplesource/soapysdrinput/CMakeLists.txt +++ b/plugins/samplesource/soapysdrinput/CMakeLists.txt @@ -19,7 +19,7 @@ set(soapysdrinput_HEADERS include_directories( ${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client ${CMAKE_SOURCE_DIR}/devices - ${SOAPYSDR_INCLUDE_DIR} + ${SOAPYSDR_INCLUDE_DIRS} ) if(NOT SERVER_MODE) @@ -55,7 +55,7 @@ target_link_libraries(${TARGET_NAME} sdrbase ${TARGET_LIB_GUI} swagger - ${SOAPYSDR_LIBRARY} + ${SOAPYSDR_LINK_LIBRARIES} soapysdrdevice )