Skip to content

Commit

Permalink
update cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
paulh002 committed Sep 1, 2023
1 parent 80b25f1 commit 6eb0472
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 12 deletions.
23 changes: 23 additions & 0 deletions CMakeLists.bak
Original file line number Diff line number Diff line change
@@ -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})
43 changes: 32 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)

3 changes: 2 additions & 1 deletion SoapyHifiBerrySettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Si5351>("/dev/i2c-1", SI5351_BUS_BASE_ADDR);
if (!pSI5351)
Expand Down Expand Up @@ -183,6 +183,7 @@ SoapyHifiBerry::SoapyHifiBerry(const SoapySDR::Kwargs &args)
}
if (vfoIQMode == IQMulti)
{
cout << "IQMulti mode multiplier = " << multiplier << endl;
pTCA9548 = std::make_unique<TCA9548>("/dev/i2c-1", 0x70);
pTCA9548->begin(1);
pSI5351 = make_unique<Si5351>("/dev/i2c-1", SI5351_BUS_BASE_ADDR, CLK_VFO_I, CLK_VFO_Q);
Expand Down

0 comments on commit 6eb0472

Please sign in to comment.