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

View File

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