6 Commits

8 changed files with 115 additions and 34 deletions

View File

@ -97,13 +97,56 @@ set(SDRPP_MODULE_COMPILER_FLAGS ${SDRPP_COMPILER_FLAGS})
# Set a default install prefix # Set a default install prefix
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if (MSVC)
set(CMAKE_INSTALL_PREFIX "C:/Program Files/SDR++/" CACHE PATH "..." FORCE)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "..." FORCE) set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "..." FORCE)
else() else()
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE) set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
endif() endif()
endif() endif()
# Include standard install directory definitions
include(GNUInstallDirs)
# Set up SDR++ directory load paths
if (MSVC)
set(SDRPP_MODULES_LOAD_DIR "./modules")
set(SDRPP_RES_LOAD_DIR "./res")
elseif (USE_BUNDLE_DEFAULTS)
set(SDRPP_MODULES_LOAD_DIR "../Plugins")
set(SDRPP_RES_LOAD_DIR "../Resources")
elseif (ANDROID)
set(SDRPP_MODULES_LOAD_DIR "/modules")
set(SDRPP_RES_LOAD_DIR "/res")
else()
set(SDRPP_MODULES_LOAD_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/sdrpp/plugins")
set(SDRPP_RES_LOAD_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/sdrpp")
endif()
# Set up SDR++ directory install paths
if (MSVC)
set(SDRPP_BIN_INSTALL_DIR "/")
set(SDRPP_LIB_INSTALL_DIR "/")
set(SDRPP_MODULES_INSTALL_DIR "modules")
set(SDRPP_RES_INSTALL_DIR "res")
elseif (USE_BUNDLE_DEFAULTS)
set(SDRPP_BIN_INSTALL_DIR "Contents/MacOS")
set(SDRPP_LIB_INSTALL_DIR "Contents/Frameworks")
set(SDRPP_MODULES_INSTALL_DIR "Contents/Plugins")
set(SDRPP_RES_INSTALL_DIR "Contents/Resources")
elseif (ANDROID)
set(SDRPP_BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
set(SDRPP_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
set(SDRPP_MODULES_INSTALL_DIR "/modules")
set(SDRPP_RES_INSTALL_DIR "/res")
else()
set(SDRPP_BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}")
set(SDRPP_LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
set(SDRPP_MODULES_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/sdrpp/plugins")
set(SDRPP_RES_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/sdrpp")
endif()
# Configure toolchain for android # Configure toolchain for android
if (ANDROID) if (ANDROID)
set(CMAKE_SHARED_LINKER_FLAGS set(CMAKE_SHARED_LINKER_FLAGS
@ -363,17 +406,18 @@ endif ()
# Create module cmake file # Create module cmake file
configure_file(${CMAKE_SOURCE_DIR}/sdrpp_module.cmake ${CMAKE_CURRENT_BINARY_DIR}/sdrpp_module.cmake @ONLY) configure_file(${CMAKE_SOURCE_DIR}/sdrpp_module.cmake ${CMAKE_CURRENT_BINARY_DIR}/sdrpp_module.cmake @ONLY)
# Install directives # Create desktop entry file
install(TARGETS sdrpp DESTINATION bin)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/bandplans DESTINATION share/sdrpp)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/colormaps DESTINATION share/sdrpp)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/fonts DESTINATION share/sdrpp)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/icons DESTINATION share/sdrpp)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/themes DESTINATION share/sdrpp)
configure_file(${CMAKE_SOURCE_DIR}/sdrpp.desktop ${CMAKE_CURRENT_BINARY_DIR}/sdrpp.desktop @ONLY) configure_file(${CMAKE_SOURCE_DIR}/sdrpp.desktop ${CMAKE_CURRENT_BINARY_DIR}/sdrpp.desktop @ONLY)
# Install directives
install(TARGETS sdrpp DESTINATION ${SDRPP_BIN_INSTALL_DIR})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/bandplans DESTINATION ${SDRPP_RES_INSTALL_DIR})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/colormaps DESTINATION ${SDRPP_RES_INSTALL_DIR})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/fonts DESTINATION ${SDRPP_RES_INSTALL_DIR})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/icons DESTINATION ${SDRPP_RES_INSTALL_DIR})
install(DIRECTORY ${CMAKE_SOURCE_DIR}/root/res/themes DESTINATION ${SDRPP_RES_INSTALL_DIR})
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sdrpp.desktop DESTINATION share/applications) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sdrpp.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
endif () endif ()
# Create uninstall target # Create uninstall target

View File

@ -18,6 +18,10 @@ if (MSVC)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif () endif ()
# Add compiler definitions for the directories
add_definitions(-DSDRPP_MODULES_LOAD_DIR="${SDRPP_MODULES_LOAD_DIR}")
add_definitions(-DSDRPP_RES_LOAD_DIR="${SDRPP_RES_LOAD_DIR}")
# Configure backend sources # Configure backend sources
if (OPT_BACKEND_GLFW) if (OPT_BACKEND_GLFW)
file(GLOB_RECURSE BACKEND_SRC "backends/glfw/*.cpp" "backends/glfw/*.c") file(GLOB_RECURSE BACKEND_SRC "backends/glfw/*.cpp" "backends/glfw/*.c")
@ -33,9 +37,6 @@ add_library(sdrpp_core SHARED ${SRC} ${BACKEND_SRC})
# Set compiler options # Set compiler options
target_compile_options(sdrpp_core PRIVATE ${SDRPP_COMPILER_FLAGS}) target_compile_options(sdrpp_core PRIVATE ${SDRPP_COMPILER_FLAGS})
# Set the install prefix
target_compile_definitions(sdrpp_core PUBLIC INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
# Include core headers # Include core headers
target_include_directories(sdrpp_core PUBLIC "src/") target_include_directories(sdrpp_core PUBLIC "src/")
target_include_directories(sdrpp_core PUBLIC "src/imgui") target_include_directories(sdrpp_core PUBLIC "src/imgui")
@ -167,4 +168,4 @@ set(CORE_FILES ${RUNTIME_OUTPUT_DIRECTORY} PARENT_SCOPE)
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake" # cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake"
# Install directives # Install directives
install(TARGETS sdrpp_core DESTINATION lib) install(TARGETS sdrpp_core DESTINATION ${SDRPP_LIB_INSTALL_DIR})

View File

@ -24,14 +24,16 @@
#include <Windows.h> #include <Windows.h>
#endif #endif
#ifndef INSTALL_PREFIX
#ifdef __APPLE__ // Default install dirs to make the IDE happy
#define INSTALL_PREFIX "/usr/local" #ifndef SDRPP_MODULES_LOAD_DIR
#else #define SDRPP_MODULES_LOAD_DIR ""
#define INSTALL_PREFIX "/usr"
#endif #endif
#ifndef SDRPP_RES_LOAD_DIR
#define SDRPP_RES_LOAD_DIR ""
#endif #endif
namespace core { namespace core {
ConfigManager configManager; ConfigManager configManager;
ModuleManager moduleManager; ModuleManager moduleManager;
@ -248,20 +250,15 @@ int sdrpp_main(int argc, char* argv[]) {
defConfig["lockMenuOrder"] = false; defConfig["lockMenuOrder"] = false;
#endif #endif
#if defined(_WIN32) #ifdef __ANDROID__
defConfig["modulesDirectory"] = "./modules"; defConfig["modulesDirectory"] = root + SDRPP_MODULES_LOAD_DIR;
defConfig["resourcesDirectory"] = "./res"; defConfig["resourcesDirectory"] = root + SDRPP_RES_LOAD_DIR;
#elif defined(IS_MACOS_BUNDLE)
defConfig["modulesDirectory"] = "../Plugins";
defConfig["resourcesDirectory"] = "../Resources";
#elif defined(__ANDROID__)
defConfig["modulesDirectory"] = root + "/modules";
defConfig["resourcesDirectory"] = root + "/res";
#else #else
defConfig["modulesDirectory"] = INSTALL_PREFIX "/lib/sdrpp/plugins"; defConfig["modulesDirectory"] = SDRPP_MODULES_LOAD_DIR;
defConfig["resourcesDirectory"] = INSTALL_PREFIX "/share/sdrpp"; defConfig["resourcesDirectory"] = SDRPP_RES_LOAD_DIR;
#endif #endif
// Load config // Load config
flog::info("Loading config"); flog::info("Loading config");
core::configManager.setPath(root + "/config.json"); core::configManager.setPath(root + "/config.json");

View File

@ -0,0 +1,4 @@
FROM fedora:40
ENV DEBIAN_FRONTEND=noninteractive
COPY do_build.sh /root
RUN chmod +x /root/do_build.sh

View File

@ -0,0 +1,31 @@
#!/bin/bash
set -e
cd /root
# Install dependencies and tools
dnf update -y
dnf install -y make gcc g++ cmake git wget p7zip fftw-devel glfw-devel volk-devel libzstd-devel codec2-devel airspyone_host-devel rtaudio-devel \
hackrf-devel rtl-sdr-devel portaudio-devel spdlog-devel libusbg-devel
# Install SDRPlay libraries
wget https://www.sdrplay.com/software/SDRplay_RSP_API-Linux-3.15.1.run
7za x ./SDRplay_RSP_API-Linux-3.15.1.run
7za x ./SDRplay_RSP_API-Linux-3.15.1
cp x86_64/libsdrplay_api.so.3.15 /usr/lib/libsdrplay_api.so
cp inc/* /usr/include/
# Install librfnm
git clone https://github.com/AlexandreRouma/librfnm
cd librfnm
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
make -j2
make install
cd ../../
cd SDRPlusPlus
mkdir build
cd build
cmake .. -DOPT_BUILD_AIRSPYHF_SOURCE=OFF -DOPT_BUILD_PLUTOSDR_SOURCE=OFF -DOPT_BUILD_RFNM_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
make VERBOSE=1 -j2

View File

@ -3,7 +3,7 @@ Encoding=UTF-8
Version=1.0 Version=1.0
Type=Application Type=Application
Terminal=false Terminal=false
Exec=@CMAKE_INSTALL_PREFIX@/bin/sdrpp Exec=@SDRPP_BIN_INSTALL_DIR@/sdrpp
Name=SDR++ Name=SDR++
Icon=@CMAKE_INSTALL_PREFIX@/share/sdrpp/icons/sdrpp.png Icon=@SDRPP_RES_INSTALL_DIR@/icons/sdrpp.png
Categories=HamRadio Categories=HamRadio

View File

@ -6,6 +6,10 @@ if (NOT SDRPP_MODULE_COMPILER_FLAGS)
set(SDRPP_MODULE_COMPILER_FLAGS @SDRPP_MODULE_COMPILER_FLAGS@) set(SDRPP_MODULE_COMPILER_FLAGS @SDRPP_MODULE_COMPILER_FLAGS@)
endif () endif ()
# Add compiler definitions for the directories
add_definitions(-DSDRPP_MODULES_LOAD_DIR="${SDRPP_MODULES_LOAD_DIR}")
add_definitions(-DSDRPP_RES_LOAD_DIR="${SDRPP_RES_LOAD_DIR}")
# Created shared lib and link to core # Created shared lib and link to core
add_library(${PROJECT_NAME} SHARED ${SRC}) add_library(${PROJECT_NAME} SHARED ${SRC})
target_link_libraries(${PROJECT_NAME} PRIVATE sdrpp_core) target_link_libraries(${PROJECT_NAME} PRIVATE sdrpp_core)
@ -16,4 +20,4 @@ set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_compile_options(${PROJECT_NAME} PRIVATE ${SDRPP_MODULE_COMPILER_FLAGS}) target_compile_options(${PROJECT_NAME} PRIVATE ${SDRPP_MODULE_COMPILER_FLAGS})
# Install directives # Install directives
install(TARGETS ${PROJECT_NAME} DESTINATION lib/sdrpp/plugins) install(TARGETS ${PROJECT_NAME} DESTINATION ${SDRPP_MODULES_INSTALL_DIR})

View File

@ -523,8 +523,8 @@ private:
RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx; RTLSDRSourceModule* _this = (RTLSDRSourceModule*)ctx;
int sampCount = len / 2; int sampCount = len / 2;
for (int i = 0; i < sampCount; i++) { for (int i = 0; i < sampCount; i++) {
_this->stream.writeBuf[i].re = ((float)buf[i * 2] - 127.4) / 128.0f; _this->stream.writeBuf[i].re = ((float)buf[i * 2] - 127.4f) / 128.0f;
_this->stream.writeBuf[i].im = ((float)buf[(i * 2) + 1] - 127.4) / 128.0f; _this->stream.writeBuf[i].im = ((float)buf[(i * 2) + 1] - 127.4f) / 128.0f;
} }
if (!_this->stream.swap(sampCount)) { return; } if (!_this->stream.swap(sampCount)) { return; }
} }