Merge pull request #177 from cjcliffe/soapysdr-loadmodule

SoapySDR bundling support for windows
This commit is contained in:
Charles J. Cliffe 2015-11-01 11:32:03 -05:00
commit d0b0606050
3 changed files with 35 additions and 20 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.8)
SET(CUBICSDR_VERSION_MAJOR "0")
SET(CUBICSDR_VERSION_MINOR "1")
SET(CUBICSDR_VERSION_PATCH "14")
SET(CUBICSDR_VERSION_PATCH "15")
SET(CUBICSDR_VERSION_REL "alpha")
SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}-${CUBICSDR_VERSION_REL}")
@ -35,7 +35,6 @@ macro(configure_files srcDir destDir globStr)
endforeach(templateFile)
endmacro(configure_files)
macro(configure_files_recurse srcDir destDir)
message(STATUS "Configuring directory ${destDir}")
make_directory(${destDir})
@ -396,7 +395,8 @@ IF (NOT BUNDLE_APP)
configure_files(${PROJECT_SOURCE_DIR}/font ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.png")
configure_files(${PROJECT_SOURCE_DIR}/icon ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} CubicSDR.ico)
IF(MSVC)
configure_files(${PROJECT_SOURCE_DIR}/external/fftw-3.3.4/${EX_PLATFORM}/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} libfftw3f-3.dll)
configure_files(${SOAPY_SDR_ROOT}/bin/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME} "*.dll")
configure_files(${SOAPY_SDR_ROOT}/lib/SoapySDR/modules/ ${CMAKE_BINARY_DIR}/${EX_PLATFORM_NAME}/modules/ "*.dll")
ENDIF()
add_executable(CubicSDR ${cubicsdr_sources} ${cubicsdr_headers} ${RES_FILES})
target_link_libraries(CubicSDR ${LIQUID_LIB} ${FFTW_LIB} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} ${OTHER_LIBRARIES})
@ -500,6 +500,8 @@ IF (APPLE AND BUNDLE_APP)
ENDIF (APPLE AND BUNDLE_APP)
IF (WIN32 AND BUILD_INSTALLER)
set(BUNDLE_SOAPY_MODS OFF CACHE BOOL "Bundle local SoapySDR modules")
set(CPACK_GENERATOR NSIS)
set(CPACK_PACKAGE_NAME "CubicSDR")
set(CPACK_PACKAGE_VENDOR "cubicsdr.com")
@ -522,6 +524,7 @@ IF (WIN32 AND BUILD_INSTALLER)
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
install(TARGETS CubicSDR RUNTIME DESTINATION .)
install(FILES
${PROJECT_SOURCE_DIR}/font/vera_sans_mono12.fnt
${PROJECT_SOURCE_DIR}/font/vera_sans_mono16.fnt
@ -537,24 +540,24 @@ IF (WIN32 AND BUILD_INSTALLER)
${PROJECT_SOURCE_DIR}/font/vera_sans_mono48_0.png
${PROJECT_SOURCE_DIR}/icon/CubicSDR.ico
${PROJECT_SOURCE_DIR}/external/fftw-3.3.4/${EX_PLATFORM}/libfftw3f-3.dll
${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/libliquid.dll
DESTINATION .)
IF (MSVC)
install(FILES
# ${PROJECT_SOURCE_DIR}/external/liquid-dsp/msvc/${EX_PLATFORM}/libliquid.dll
# ${PROJECT_SOURCE_DIR}/external/rtl-sdr-release/msvc/${EX_PLATFORM}/libusb-1.0.dll
${OTHER_INSTALL_FILES}
DESTINATION .)
ELSE (MSVC)
install(FILES
# ${PROJECT_SOURCE_DIR}/external/liquid-dsp/gcc/${EX_PLATFORM}/libliquid.dll
# ${PROJECT_SOURCE_DIR}/external/rtl-sdr-release/gcc/${EX_PLATFORM}/libusb-1.0.dll
${OTHER_INSTALL_FILES}
DESTINATION .)
ENDIF(MSVC)
IF (BUNDLE_SOAPY_MODS)
ADD_DEFINITIONS(
-DBUNDLE_SOAPY_MODS=1
)
file(GLOB SOAPY_BINS ${SOAPY_SDR_ROOT}/bin/*.dll)
file(GLOB SOAPY_MODS ${SOAPY_SDR_ROOT}/lib/SoapySDR/modules/*.dll)
message(STATUS "SOAPY_BINS: ${SOAPY_BINS}")
message(STATUS "SOAPY_MODS: ${SOAPY_MODS}")
install(FILES ${SOAPY_BINS} DESTINATION .)
install(FILES ${SOAPY_MODS} DESTINATION modules)
ENDIF(BUNDLE_SOAPY_MODS)
IF(MSVC AND EX_PLATFORM EQUAL 32)
install(FILES
# ${PROJECT_SOURCE_DIR}/external/msvc/${EX_PLATFORM_NAME}/libgcc_s_dw2-1.dll
${PROJECT_SOURCE_DIR}/external/msvc/${EX_PLATFORM_NAME}/libgcc_s_dw2-1.dll
DESTINATION .)
ENDIF(MSVC AND EX_PLATFORM EQUAL 32)
@ -572,7 +575,7 @@ ENDIF (WIN32 AND BUILD_INSTALLER)
IF (UNIX AND BUILD_DEB)
set(CPACK_GENERATOR DEB)
set(CPACK_GENERATOR DEB)
set(CPACK_PACKAGE_NAME "CubicSDR")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS " libfftw3-single3, libwxgtk3.0-0, libpulse0")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Charles J. Cliffe <cj@cubicproductions.com>")

View File

@ -46,7 +46,19 @@ std::vector<SDRDeviceInfo *> *SDREnumerator::enumerate_devices(std::string remot
}
std::cout << "\tLoading modules... " << std::flush;
SoapySDR::loadModules();
#ifdef BUNDLE_SOAPY_MODS
wxFileName exePath = wxFileName(wxStandardPaths::Get().GetExecutablePath());
std::vector<std::string> localMods = SoapySDR::listModules(exePath.GetPath().ToStdString() + "/modules/");
for (std::vector<std::string>::iterator mods_i = localMods.begin(); mods_i != localMods.end(); mods_i++) {
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Initializing bundled SoapySDR module " + (*mods_i) + "..");
SoapySDR::loadModule(*mods_i);
}
wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, "Loading SoapySDR modules..");
SoapySDR::loadModules();
#else
SoapySDR::loadModules();
#endif
std::cout << "done" << std::endl;
if (SDREnumerator::factories.size()) {

View File

@ -81,7 +81,7 @@ void SDRThread::init() {
if (chan->hasHardwareDC()) {
hasHardwareDC.store(true);
// wxGetApp().sdrEnumThreadNotify(SDREnumerator::SDR_ENUM_MESSAGE, std::string("Found hardware DC offset correction support, internal disabled."));
device->setDCOffsetMode(SOAPY_SDR_RX, chan->getChannel(), true);
device->setDCOffsetMode(SOAPY_SDR_RX, chan->getChannel(), false);
} else {
hasHardwareDC.store(false);
}