From 6eb0472ac3962bcd94c7e9a1dcfef5c9c9e32011 Mon Sep 17 00:00:00 2001 From: Paul Date: Fri, 1 Sep 2023 15:59:07 +0200 Subject: [PATCH] update cmake --- CMakeLists.bak | 23 ++++++++++++++++++++ CMakeLists.txt | 43 ++++++++++++++++++++++++++++---------- SoapyHifiBerrySettings.cpp | 3 ++- 3 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 CMakeLists.bak diff --git a/CMakeLists.bak b/CMakeLists.bak new file mode 100644 index 0000000..fa95bc8 --- /dev/null +++ b/CMakeLists.bak @@ -0,0 +1,23 @@ +#Generated by VisualGDB project wizard. +#Note: VisualGDB will automatically update this file when you add new sources to the project. + +cmake_minimum_required(VERSION 3.3.0) +project(SoapyHifiBerrySDR) +set(LIBRARIES_FROM_REFERENCES -lpthread -lSoapySDR -lliquid -lasound) +add_library(SoapyHifiBerrySDR SHARED SoapyHifiBerry.cpp AudioInput.cpp AudioOutput.cpp configfile.cpp configoption.cpp RtAudio.cpp TCA9548.cpp TCA9548.h si5351.cpp SoapyHifiBerrySettings.cpp SoapyHifiBerryStreaming.cpp strlib.cpp Audiodefs.h AudioInput.h AudioOutput.h configfile.h configoption.h DataBuffer.h RtAudio.h si5351.h SoapyHifiBerry.h strlib.h) +target_compile_definitions(SoapyHifiBerrySDR PRIVATE __LINUX_ALSA__) +target_compile_options(SoapyHifiBerrySDR PRIVATE -O3 -ggdb ) +set_property(TARGET SoapyHifiBerrySDR PROPERTY CXX_STANDARD 17) +target_link_libraries(SoapyHifiBerrySDR "${LIBRARIES_FROM_REFERENCES}") + +######################################################################## +# build the module +######################################################################## +find_package(SoapySDR CONFIG) + +if (NOT SoapySDR_FOUND) + message(WARNING "SoapySDR development files not found - skipping support") + return() +endif () + +install(TARGETS SoapyHifiBerrySDR DESTINATION ${CMAKE_LIB_DEST}) diff --git a/CMakeLists.txt b/CMakeLists.txt index fa95bc8..cab11cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,25 @@ -#Generated by VisualGDB project wizard. -#Note: VisualGDB will automatically update this file when you add new sources to the project. +######################################################################## +# Project setup -- only needed if device support is a stand-alone build +# We recommend that the support module be built in-tree with the driver. +######################################################################## +cmake_minimum_required(VERSION 2.6) +project(SoapyHifiBerrySDR CXX) +enable_testing() + +#select the release build type by default to get optimization flags +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") + message(STATUS "Build type not specified: defaulting to release.") +endif(NOT CMAKE_BUILD_TYPE) +set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") + +######################################################################## +# Header and library resources needed to communicate with the device. +# These may be found within the build tree or in an external project. +######################################################################## +set(MY_DEVICE_INCLUDE_DIRS "") +set(MY_DEVICE_LIBRARIES -lpthread -lSoapySDR -lliquid -lasound) -cmake_minimum_required(VERSION 3.3.0) -project(SoapyHifiBerrySDR) -set(LIBRARIES_FROM_REFERENCES -lpthread -lSoapySDR -lliquid -lasound) -add_library(SoapyHifiBerrySDR SHARED SoapyHifiBerry.cpp AudioInput.cpp AudioOutput.cpp configfile.cpp configoption.cpp RtAudio.cpp TCA9548.cpp TCA9548.h si5351.cpp SoapyHifiBerrySettings.cpp SoapyHifiBerryStreaming.cpp strlib.cpp Audiodefs.h AudioInput.h AudioOutput.h configfile.h configoption.h DataBuffer.h RtAudio.h si5351.h SoapyHifiBerry.h strlib.h) -target_compile_definitions(SoapyHifiBerrySDR PRIVATE __LINUX_ALSA__) -target_compile_options(SoapyHifiBerrySDR PRIVATE -O3 -ggdb ) -set_property(TARGET SoapyHifiBerrySDR PROPERTY CXX_STANDARD 17) -target_link_libraries(SoapyHifiBerrySDR "${LIBRARIES_FROM_REFERENCES}") ######################################################################## # build the module @@ -20,4 +31,14 @@ if (NOT SoapySDR_FOUND) return() endif () -install(TARGETS SoapyHifiBerrySDR DESTINATION ${CMAKE_LIB_DEST}) +include_directories(${MY_DEVICE_INCLUDE_DIRS}) +SOAPY_SDR_MODULE_UTIL( + TARGET SoapyHifiBerrySDR + SOURCES SoapyHifiBerry.cpp AudioInput.cpp AudioOutput.cpp configfile.cpp configoption.cpp RtAudio.cpp TCA9548.cpp TCA9548.h si5351.cpp SoapyHifiBerrySettings.cpp SoapyHifiBerryStreaming.cpp strlib.cpp Audiodefs.h AudioInput.h AudioOutput.h configfile.h configoption.h DataBuffer.h RtAudio.h si5351.h SoapyHifiBerry.h strlib.h + LIBRARIES ${MY_DEVICE_LIBRARIES} +) + +target_compile_definitions(SoapyHifiBerrySDR PRIVATE __LINUX_ALSA__) +target_compile_options(SoapyHifiBerrySDR PRIVATE -O3 -ggdb ) +set_property(TARGET SoapyHifiBerrySDR PROPERTY CXX_STANDARD 17) + diff --git a/SoapyHifiBerrySettings.cpp b/SoapyHifiBerrySettings.cpp index c3984b2..0d8ef7d 100644 --- a/SoapyHifiBerrySettings.cpp +++ b/SoapyHifiBerrySettings.cpp @@ -141,7 +141,7 @@ SoapyHifiBerry::SoapyHifiBerry(const SoapySDR::Kwargs &args) if (vfoIQMode == Single || vfoIQMode == IQSingle) { - cout << "IQ mode single multpilier " << multiplier << endl; + cout << "IQ mode single multiplier = " << multiplier << endl; pSI5351 = make_unique("/dev/i2c-1", SI5351_BUS_BASE_ADDR); if (!pSI5351) @@ -183,6 +183,7 @@ SoapyHifiBerry::SoapyHifiBerry(const SoapySDR::Kwargs &args) } if (vfoIQMode == IQMulti) { + cout << "IQMulti mode multiplier = " << multiplier << endl; pTCA9548 = std::make_unique("/dev/i2c-1", 0x70); pTCA9548->begin(1); pSI5351 = make_unique("/dev/i2c-1", SI5351_BUS_BASE_ADDR, CLK_VFO_I, CLK_VFO_Q);