1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 13:51:47 -05:00

SoapySDR support: new attempt for Debian build

This commit is contained in:
f4exb 2018-11-30 08:38:22 +01:00
parent f3b75ead00
commit 781eb0d97b
3 changed files with 85 additions and 38 deletions

View File

@ -346,6 +346,7 @@ if (BUILD_DEBIAN)
add_subdirectory(libmirisdr)
add_subdirectory(libperseus)
add_subdirectory(libiio)
add_subdirectory(libsoapysdr)
endif (BUILD_DEBIAN)
add_subdirectory(devices)

2
debian/rules vendored
View File

@ -21,5 +21,5 @@
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
override_dh_auto_configure:
dh_auto_configure -- -DCMAKE_INSTALL_PREFIX=/opt/sdrangel -DDEBUG_OUTPUT=ON -DBUILD_TYPE=DEBIAN -DRX_SAMPLE_24BIT=ON -DLIBCM256CCSRC=/z1/development/cm256cc -DLIBDSDCCSRC=/z1/development/dsdcc -DLIBAIRSPYSRC=/z1/development/libairspy -DLIBAIRSPYHFSRC=/z1/softs/airspyhf -DLIBHACKRFSRC=/z1/development/hackrf/host -DLIBRTLSDRSRC=/z1/development/librtlsdr.f4exb -DLIBMBELIBSRC=/z1/development/mbelib -DLIBSERIALDVSRC=/z1/development/serialDV -DLIBBLADERFSRC=/z1/softs/bladeRF -DLIBBLADERFCOMMONSRC=/z1/softs/bladeRF/host/common -DLIBBLADERFLIBSRC=/z1/softs/bladeRF/host/libraries/libbladeRF -DLIBMIRISDRSRC=/z1/development/libmirisdr-4 -DLIBLIMESUITESRC=/z1/softs/LimeSuite -DLIBIIOSRC=/z1/softs/libiio -DLIBPERSEUSSRC=/z1/softs/libperseus-sdr -DLIBSOAPYSDRSRC=/z1/softs/SoapySDR
dh_auto_configure -- -DCMAKE_INSTALL_PREFIX=/opt/sdrangel -DDEBUG_OUTPUT=ON -DBUILD_TYPE=DEBIAN -DRX_SAMPLE_24BIT=ON -DLIBCM256CCSRC=/z1/development/cm256cc -DLIBDSDCCSRC=/z1/development/dsdcc -DLIBAIRSPYSRC=/z1/development/libairspy -DLIBAIRSPYHFSRC=/z1/softs/airspyhf -DLIBHACKRFSRC=/z1/development/hackrf/host -DLIBRTLSDRSRC=/z1/development/librtlsdr.f4exb -DLIBMBELIBSRC=/z1/development/mbelib -DLIBSERIALDVSRC=/z1/development/serialDV -DLIBBLADERFSRC=/z1/softs/bladeRF -DLIBBLADERFCOMMONSRC=/z1/softs/bladeRF/host/common -DLIBBLADERFLIBSRC=/z1/softs/bladeRF/host/libraries/libbladeRF -DLIBMIRISDRSRC=/z1/development/libmirisdr-4 -DLIBLIMESUITESRC=/z1/softs/LimeSuite -DLIBIIOSRC=/z1/softs/libiio -DLIBPERSEUSSRC=/z1/softs/libperseus-sdr -DSOAPYSDR_SOURCE_DIR=/z1/softs/SoapySDR

View File

@ -1,12 +1,17 @@
project(soapysdr)
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 2.8.7)
project(SoapySDR)
enable_language(CXX)
enable_testing()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#set(SOAPYSDR_SOURCE_DIR "/opt/build/SoapySDR")
########################################################################
# gather version information
# packagers may specify -DSOAPY_SDR_EXTVER="foo" to replace the git hash
########################################################################
file(READ "${LIBSOAPYSDRSRC}/Changelog.txt" changelog_txt)
file(READ "${SOAPYSDR_SOURCE_DIR}/Changelog.txt" changelog_txt)
string(REGEX MATCH "Release ([0-9]+\\.[0-9]+\\.[0-9]+) \\(" CHANGELOG_MATCH "${changelog_txt}")
if(NOT CHANGELOG_MATCH)
message(FATAL_ERROR "Failed to extract version number from Changelog.txt")
@ -14,7 +19,7 @@ endif(NOT CHANGELOG_MATCH)
set(SOAPY_SDR_LIBVER "${CMAKE_MATCH_1}")
if (NOT SOAPY_SDR_EXTVER)
include(${LIBSOAPYSDRSRC}/cmake/Modules/GetGitRevisionDescription.cmake)
include(${SOAPYSDR_SOURCE_DIR}/cmake/Modules/GetGitRevisionDescription.cmake)
get_git_head_revision(GITREFSPEC GITHASH)
if (GITHASH)
string(SUBSTRING "${GITHASH}" 0 8 GITHASH)
@ -72,44 +77,85 @@ endif(CMAKE_AUTOSET_INSTALL_RPATH)
# which point to directories outside the build tree to the install RPATH
option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "build with automatic rpath" TRUE)
########################################################################
list(APPEND SOAPY_SDR_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/Modules.cpp)
configure_file(
${LIBSOAPYSDRSRC}/lib/Modules.in.cpp
${CMAKE_CURRENT_BINARY_DIR}/Modules.cpp
@ONLY)
list(APPEND SOAPY_SDR_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/Version.cpp)
configure_file(
${LIBSOAPYSDRSRC}/lib/Version.in.cpp
${CMAKE_CURRENT_BINARY_DIR}/Version.cpp
@ONLY)
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
endif()
########################################################################
# Allows in-tree module util
########################################################################
set(SoapySDR_DIR ${SOAPYSDR_SOURCE_DIR}/cmake/Modules)
set(SOAPY_SDR_IN_TREE_SOURCE_DIR ${SOAPYSDR_SOURCE_DIR})
find_package(SoapySDR NO_MODULE REQUIRED)
include_directories(${SoapySDR_INCLUDE_DIRS}) #local include precedence
file(GLOB soapysdr_SOURCES
${LIBSOAPYSDRSRC}/lib/*.cpp
)
########################################################################
# Install cmake helper modules
########################################################################
configure_file(
${SOAPYSDR_SOURCE_DIR}/cmake/Modules/SoapySDRConfigVersion.in.cmake
${PROJECT_BINARY_DIR}/SoapySDRConfigVersion.cmake
@ONLY)
set(cmake_files
${SOAPYSDR_SOURCE_DIR}/cmake/Modules/SoapySDRConfig.cmake
${SOAPYSDR_SOURCE_DIR}/cmake/Modules/SoapySDRUtil.cmake
${PROJECT_BINARY_DIR}/SoapySDRConfigVersion.cmake)
if (UNIX)
install(FILES ${cmake_files} DESTINATION share/cmake/${PROJECT_NAME})
elseif (WIN32)
install(FILES ${cmake_files} DESTINATION cmake)
endif ()
file(GLOB soapysdr_HEADERS
${LIBSOAPYSDRSRC}/include/SoapySDR/*.hpp
${LIBSOAPYSDRSRC}/include/SoapySDR/*.h
)
########################################################################
# Install headers
########################################################################
#install(DIRECTORY include/SoapySDR DESTINATION include)
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${LIBSOAPYSDRSRC}/include
${LIBSOAPYSDRSRC}/lib
)
########################################################################
# Build subdirs
########################################################################
add_subdirectory(${SOAPYSDR_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib)
#add_subdirectory(apps)
#add_subdirectory(tests)
#add_subdirectory(docs)
add_definitions(-DQT_SHARED)
########################################################################
# uninstall target
########################################################################
configure_file(
"${SOAPYSDR_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${SOAPYSDR_SOURCE_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
message( STATUS "soapysdr_SOURCES: ${soapysdr_SOURCES}" )
#only add uninstall target if this is the top project
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()
add_library(soapysdr SHARED
${soapysdr_SOURCES}
)
#########################################################################
# summary
#########################################################################
include(FeatureSummary)
message(STATUS "")
message(STATUS "######################################################")
message(STATUS "## ${PROJECT_NAME} enabled features")
message(STATUS "######################################################")
feature_summary(WHAT ENABLED_FEATURES)
message(STATUS "######################################################")
message(STATUS "## ${PROJECT_NAME} disabled features")
message(STATUS "######################################################")
feature_summary(WHAT DISABLED_FEATURES)
message(STATUS "SoapySDR version: v${SOAPY_SDR_VERSION}")
message(STATUS "ABI/so version: v${SOAPY_SDR_ABI_VERSION}")
message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
install(TARGETS soapysdr DESTINATION lib)
#add_definitions(-DQT_SHARED)
#
#message( STATUS "soapysdr_SOURCES: ${soapysdr_SOURCES}" )
#
#add_library(soapysdr SHARED
# ${soapysdr_SOURCES}
#)
#
#install(TARGETS soapysdr DESTINATION lib)