Skip to content

Commit f1dad45

Browse files
committed
Some experiments merged here, mixed with windows build fixes
1 parent 85aa2a3 commit f1dad45

40 files changed

+1888
-90
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ android/deps
1919
android/app/assets
2020
.aider*
2121
.env
22+
node_modules

CMakeLists.txt

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
cmake_minimum_required(VERSION 3.13)
22
project(sdrpp)
33

4+
45
if(CMAKE_INSTALL_PREFIX MATCHES "^/usr") # default prefix
56
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
67
set(CMAKE_INSTALL_PREFIX "/usr/local")
@@ -10,18 +11,6 @@ if(CMAKE_INSTALL_PREFIX MATCHES "^/usr") # default prefix
1011
else()
1112
# keep the prefix as user wants
1213
endif()
13-
#
14-
## Configure toolchain for android
15-
#if (ANDROID)
16-
# set(CMAKE_SHARED_LINKER_FLAGS
17-
# "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate"
18-
# )
19-
# set(CMAKE_C_STANDARD 11)
20-
# set(CMAKE_CXX_STANDARD 14)
21-
# set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=c++17")
22-
# set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
23-
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
24-
#endif (ANDROID)
2514

2615
# Backends
2716
option(OPT_BACKEND_GLFW "Use the GLFW backend" ON)
@@ -31,40 +20,40 @@ option(OPT_BACKEND_ANDROID "Use the Android backend" OFF)
3120
option(OPT_OVERRIDE_STD_FILESYSTEM "Use a local version of std::filesystem on systems that don't have it yet" OFF)
3221

3322
# Sources
34-
option(OPT_BUILD_AIRSPY_SOURCE "Build Airspy Source Module (Dependencies: libairspy)" ON)
35-
option(OPT_BUILD_AIRSPYHF_SOURCE "Build Airspy HF+ Source Module (Dependencies: libairspyhf)" ON)
36-
option(OPT_BUILD_AUDIO_SOURCE "Build Audio Source Module (Dependencies: rtaudio)" ON)
23+
option(OPT_BUILD_AIRSPY_SOURCE "Build Airspy Source Module (Dependencies: libairspy)" OFF)
24+
option(OPT_BUILD_AIRSPYHF_SOURCE "Build Airspy HF+ Source Module (Dependencies: libairspyhf)" OFF)
25+
option(OPT_BUILD_AUDIO_SOURCE "Build Audio Source Module (Dependencies: rtaudio)" OFF)
3726
option(OPT_BUILD_BADGESDR_SOURCE "Build BadgeSDR Source Module (Dependencies: libusb)" OFF)
3827
option(OPT_BUILD_BLADERF_SOURCE "Build BladeRF Source Module (Dependencies: libbladeRF)" OFF)
3928
option(OPT_BUILD_FILE_SOURCE "Wav file source" ON)
4029
option(OPT_BUILD_FOBOSSDR_SOURCE "Build FobosSDR Source Module (Dependencies: libfobos)" OFF)
41-
option(OPT_BUILD_HACKRF_SOURCE "Build HackRF Source Module (Dependencies: libhackrf)" ON)
42-
option(OPT_BUILD_HAROGIC_SOURCE "Build Harogic Source Module (Dependencies: htra_api)" OFF)
43-
option(OPT_BUILD_HERMES_SOURCE "Build Hermes Source Module (no dependencies required)" ON)
30+
option(OPT_BUILD_HACKRF_SOURCE "Build HackRF Source Module (Dependencies: libhackrf)" OFF)
31+
#option(OPT_BUILD_HAROGIC_SOURCE "Build Harogic Source Module (Dependencies: htra_api)" OFF)
32+
option(OPT_BUILD_HERMES_SOURCE "Build Hermes Source Module (no dependencies required)" OFF)
4433
option(OPT_BUILD_KCSDR_SOURCE "Build KCSDR Source Module (Dependencies: libkcsdr)" OFF)
4534
option(OPT_BUILD_LIMESDR_SOURCE "Build LimeSDR Source Module (Dependencies: liblimesuite)" OFF)
46-
option(OPT_BUILD_NETWORK_SOURCE "Build Network Source Module (no dependencies required)" ON)
35+
option(OPT_BUILD_NETWORK_SOURCE "Build Network Source Module (no dependencies required)" OFF)
4736
option(OPT_BUILD_PERSEUS_SOURCE "Build Perseus Source Module (Dependencies: libperseus-sdr)" OFF)
48-
option(OPT_BUILD_PLUTOSDR_SOURCE "Build PlutoSDR Source Module (Dependencies: libiio, libad9361)" ON)
37+
option(OPT_BUILD_PLUTOSDR_SOURCE "Build PlutoSDR Source Module (Dependencies: libiio, libad9361)" OFF)
4938
option(OPT_BUILD_RFNM_SOURCE "Build RFNM Source Module (Dependencies: librfnm)" OFF)
50-
option(OPT_BUILD_RFSPACE_SOURCE "Build RFspace Source Module (no dependencies required)" ON)
51-
option(OPT_BUILD_RTL_SDR_SOURCE "Build RTL-SDR Source Module (Dependencies: librtlsdr)" ON)
52-
option(OPT_BUILD_RTL_TCP_SOURCE "Build RTL-TCP Source Module (no dependencies required)" ON)
39+
option(OPT_BUILD_RFSPACE_SOURCE "Build RFspace Source Module (no dependencies required)" OFF)
40+
option(OPT_BUILD_RTL_SDR_SOURCE "Build RTL-SDR Source Module (Dependencies: librtlsdr)" OFF)
41+
option(OPT_BUILD_RTL_TCP_SOURCE "Build RTL-TCP Source Module (no dependencies required)" OFF)
5342
option(OPT_BUILD_SDRPP_SERVER_SOURCE "Build SDR++ Server Source Module (no dependencies required)" ON)
5443
option(OPT_BUILD_SDRPLAY_SOURCE "Build SDRplay Source Module (Dependencies: libsdrplay)" OFF)
5544
option(OPT_BUILD_SOAPY_SOURCE "Build SoapySDR Source Module (Dependencies: soapysdr)" OFF)
5645
option(OPT_BUILD_SPECTRAN_SOURCE "Build Spectran Source Module (Dependencies: Aaronia RTSA Suite)" OFF)
57-
option(OPT_BUILD_SPECTRAN_HTTP_SOURCE "Build Spectran HTTP Source Module (no dependencies required)" ON)
58-
option(OPT_BUILD_SPYSERVER_SOURCE "Build SpyServer Source Module (no dependencies required)" ON)
46+
option(OPT_BUILD_SPECTRAN_HTTP_SOURCE "Build Spectran HTTP Source Module (no dependencies required)" OFF)
47+
option(OPT_BUILD_SPYSERVER_SOURCE "Build SpyServer Source Module (no dependencies required)" OFF)
5948
option(OPT_BUILD_HL2_SOURCE "Build Hermes Lite 2 Source Module" ON)
6049
option(OPT_BUILD_USRP_SOURCE "Build USRP Source Module (libuhd)" OFF)
6150
option(OPT_BUILD_KIWISDR_SOURCE "Build KiwiSDR (web) Source Module" ON)
6251

6352
# Sinks
64-
option(OPT_BUILD_ANDROID_AUDIO_SINK "Build Android Audio Sink Module (Dependencies: AAudio, only for android)" OFF)
53+
#option(OPT_BUILD_ANDROID_AUDIO_SINK "Build Android Audio Sink Module (Dependencies: AAudio, only for android)" OFF)
6554
option(OPT_BUILD_AUDIO_SINK "Build Audio Sink Module (Dependencies: rtaudio)" ON)
66-
option(OPT_BUILD_NETWORK_SINK "Build Audio Sink Module (no dependencies required)" ON)
67-
option(OPT_BUILD_MPEG_ADTS_SINK "Build MPEG ADTS Sink Module (lame will be used)" ON)
55+
option(OPT_BUILD_NETWORK_SINK "Build Audio Sink Module (no dependencies required)" OFF)
56+
option(OPT_BUILD_MPEG_ADTS_SINK "Build MPEG ADTS Sink Module (lame will be used)" OFF)
6857
option(OPT_BUILD_NEW_PORTAUDIO_SINK "Build the new PortAudio Sink Module (Dependencies: portaudio)" ON)
6958
option(OPT_BUILD_PORTAUDIO_SINK "Build PortAudio Sink Module (Dependencies: portaudio)" OFF)
7059

@@ -74,24 +63,24 @@ option(OPT_BUILD_DAB_DECODER "Build the DAB/DAB+ decoder (no dependencies requir
7463
option(OPT_BUILD_FALCON9_DECODER "Build the falcon9 live decoder (Dependencies: ffplay)" OFF)
7564
option(OPT_BUILD_KG_SSTV_DECODER "Build the M17 decoder module (no dependencies required)" OFF)
7665
option(OPT_BUILD_M17_DECODER "Build the M17 decoder module (Dependencies: codec2)" OFF)
77-
option(OPT_BUILD_CH_EXTRAVHF_DECODER "Build the extra VHF decoder module" ON)
66+
option(OPT_BUILD_CH_EXTRAVHF_DECODER "Build the extra VHF decoder module" OFF)
7867
option(OPT_BUILD_FT8_DECODER "Build the FT8 decoder module" ON)
7968
option(OPT_BUILD_DSDCC_DECODER "Build the DSDCC decoder module" OFF)
80-
option(OPT_BUILD_METEOR_DEMODULATOR "Build the meteor demodulator module (no dependencies required)" ON)
81-
option(OPT_BUILD_PAGER_DECODER "Build the pager decoder module (no dependencies required)" ON)
69+
option(OPT_BUILD_METEOR_DEMODULATOR "Build the meteor demodulator module (no dependencies required)" OF)
70+
option(OPT_BUILD_PAGER_DECODER "Build the pager decoder module (no dependencies required)" OF)
8271
option(OPT_BUILD_RADIO "Main audio modulation decoder (AM, FM, SSB, etc...)" ON)
8372
option(OPT_BUILD_RYFI_DECODER "RyFi data link decoder" OFF)
8473
option(OPT_BUILD_VOR_RECEIVER "VOR beacon receiver" OFF)
8574
option(OPT_BUILD_WEATHER_SAT_DECODER "Build the HRPT decoder module (no dependencies required)" OFF)
8675

8776
# Misc
88-
option(OPT_BUILD_DISCORD_PRESENCE "Build the Discord Rich Presence module" ON)
77+
option(OPT_BUILD_DISCORD_PRESENCE "Build the Discord Rich Presence module" OFF)
8978
option(OPT_BUILD_FREQUENCY_MANAGER "Build the Frequency Manager module" ON)
9079
option(OPT_BUILD_IQ_EXPORTER "Build the IQ Exporter module" ON)
9180
option(OPT_BUILD_RECORDER "Audio and baseband recorder" ON)
9281
option(OPT_BUILD_RIGCTL_CLIENT "Rigctl client to make SDR++ act as a panadapter" ON)
9382
option(OPT_BUILD_RIGCTL_SERVER "Rigctl backend for controlling SDR++ with software like gpredict" ON)
94-
option(OPT_BUILD_TCI_SERVER "TCI backend for controlling SDR++ with sunsdr and similar software" ON)
83+
option(OPT_BUILD_TCI_SERVER "TCI backend for controlling SDR++ with sunsdr and similar software" OFF)
9584
option(OPT_BUILD_SCANNER "Frequency scanner" ON)
9685
option(OPT_BUILD_SCHEDULER "Build the scheduler" OFF)
9786
option(OPT_BUILD_NOISE_REDUCTION_LOGMMSE "Build LOGMMSE noise reduction" ON)
@@ -151,6 +140,12 @@ endif (ANDROID)
151140
# Core of SDR++
152141
add_subdirectory("core")
153142

143+
# Tests are added conditionally
144+
if(BUILD_TESTS)
145+
enable_testing()
146+
include(CTest)
147+
endif()
148+
154149
# Source modules
155150
if (OPT_BUILD_AIRSPY_SOURCE)
156151
add_subdirectory("source_modules/airspy_source")
@@ -302,7 +297,7 @@ add_subdirectory("sink_modules/network_sink")
302297
endif (OPT_BUILD_NETWORK_SINK)
303298

304299
if (OPT_BUILD_MPEG_ADTS_SINK)
305-
add_subdirectory("sink_modules/mpeg_adts_sink")
300+
#add_subdirectory("sink_modules/mpeg_adts_sink")
306301
endif (OPT_BUILD_MPEG_ADTS_SINK)
307302

308303
if (NOT ANDROID)
@@ -334,7 +329,7 @@ add_subdirectory("decoder_modules/m17_decoder")
334329
endif (OPT_BUILD_M17_DECODER)
335330

336331
if (OPT_BUILD_CH_EXTRAVHF_DECODER)
337-
add_subdirectory("decoder_modules/ch_extravhf_decoder")
332+
#add_subdirectory("decoder_modules/ch_extravhf_decoder")
338333
endif (OPT_BUILD_CH_EXTRAVHF_DECODER)
339334

340335

@@ -466,7 +461,7 @@ if (MSVC)
466461
foreach(DLL IN LISTS CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
467462
set(REDIST_DLLS_STR COMMAND xcopy /F \"${DLL}\" \"$<TARGET_FILE_DIR:sdrpp>\" /Y ${REDIST_DLLS_STR})
468463
endforeach()
469-
464+
470465
# Create target
471466
add_custom_target(do_always_msvc ALL ${REDIST_DLLS_STR})
472467
endif ()
@@ -514,3 +509,8 @@ configure_file(${CMAKE_SOURCE_DIR}/cmake_uninstall.cmake ${CMAKE_CURRENT_BINARY_
514509
add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
515510

516511
# Create headers target
512+
513+
# Test options
514+
option(BUILD_TESTS "Build test suite" OFF)
515+
option(ENABLE_COVERAGE "Enable code coverage" OFF)
516+

core/CMakeLists.txt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@ endif (USE_BUNDLE_DEFAULTS)
1111

1212
# Main code
1313
file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c"
14-
# "../decoder_modules/ft8_decoder/src/*.cpp"
15-
# "../decoder_modules/ft8_decoder/src/ft8_etc/*.cpp"
1614
"../misc_modules/noise_reduction_logmmse/src/omlsa_mcra/*.cpp"
1715
"../misc_modules/noise_reduction_logmmse/src/omlsa_mcra.cpp"
18-
1916
)
2017
list(FILTER SRC EXCLUDE REGEX "sdrpp_ft8_mshv_main.cpp" )
2118

2219

2320
add_definitions(-DSDRPP_IS_CORE)
2421
add_definitions(-DFLOG_ANDROID_TAG="SDR++")
2522

23+
# Add BUILD_TESTS definition if tests are enabled
24+
if(BUILD_TESTS)
25+
add_definitions(-DBUILD_TESTS)
26+
file(GLOB_RECURSE TEST_SRC "../tests/*.cpp")
27+
set(SRC ${SRC} ${TEST_SRC})
28+
endif()
29+
2630
if(MSVC)
2731
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
2832
add_compile_options(/wd4996)
@@ -33,12 +37,17 @@ endif()
3337
# Configure backend sources
3438
if (OPT_BACKEND_GLFW)
3539
file(GLOB_RECURSE BACKEND_SRC "backends/glfw/*.cpp" "backends/glfw/*.c")
40+
3641
endif (OPT_BACKEND_GLFW)
3742
if (OPT_BACKEND_ANDROID)
3843
file(GLOB_RECURSE BACKEND_SRC "backends/android/*.cpp" "backends/android/*.c")
3944
set(BACKEND_SRC ${BACKEND_SRC} ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
4045
endif (OPT_BACKEND_ANDROID)
4146

47+
if(BUILD_TESTS)
48+
set(SRC ${SRC} ../tests/test_utils.cpp)
49+
endif ()
50+
4251
# Add code to dyn lib
4352
add_library(sdrpp_core SHARED ${SRC} ${BACKEND_SRC})
4453

@@ -172,7 +181,7 @@ else()
172181
${VOLK_INCLUDE_DIRS}
173182
${LIBZSTD_INCLUDE_DIRS}
174183
)
175-
184+
176185
target_link_directories(sdrpp_core PUBLIC
177186
${OPENGL_LIBRARY_DIRS}
178187
${FFTW3_LIBRARY_DIRS}

core/backends/glfw/backend.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
#include <gui/menus/display.h>
1616
#include <utils/usleep.h>
1717

18+
#ifndef WIN32
19+
#include <dlfcn.h>
20+
#endif
21+
22+
#ifdef BUILD_TESTS
23+
#include "../../tests/test_utils.h"
24+
#endif
25+
1826

1927
namespace backend {
2028
const char* OPENGL_VERSIONS_GLSL[] = {
@@ -106,7 +114,7 @@ namespace backend {
106114
#if GLFW_VERSION_MAJOR > 3 || (GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 4)
107115
glfwWindowHintString(GLFW_WAYLAND_APP_ID, "sdrpp");
108116
#endif
109-
117+
110118
// Create window with graphics context
111119
monitor = glfwGetPrimaryMonitor();
112120
window = glfwCreateWindow(winWidth, winHeight, "SDR++Brown v" VERSION_STR " (Built at " __TIME__ ", " __DATE__ ")", NULL, NULL);
@@ -245,15 +253,26 @@ namespace backend {
245253
ImGui_ImplGlfw_CursorPosCallback(window, x, y);
246254
}
247255

256+
// External test function declaration
257+
extern "C" void test_increment_counter();
258+
248259
int renderLoop() {
249260
// Main loop
250261
while (!glfwWindowShouldClose(window)) {
262+
#ifdef BUILD_TESTS
263+
// Check if we should exit for testing purposes
264+
if (sdrpp::test::renderLoopHook.shouldExitRenderLoop()) {
265+
break;
266+
}
267+
// Increment the render loop counter for testing
268+
sdrpp::test::renderLoopHook.insideRenderLoop();
251269

270+
#endif
252271

253272
glfwPollEvents();
254273

255274
beginFrame();
256-
275+
257276

258277
if (_maximized != maximized) {
259278
_maximized = maximized;

core/libcorrect/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ else()
8080
endif()
8181
add_library(correct SHARED ${correct_obj_files})
8282
add_library(correct_static STATIC ${correct_obj_files})
83-
set_target_properties(correct_static PROPERTIES OUTPUT_NAME "correct")
83+
#set_target_properties(correct_static PROPERTIES OUTPUT_NAME "correct")
8484
if(HAVE_SSE)
8585
target_compile_definitions(correct PUBLIC HAVE_SSE=1)
8686
target_compile_definitions(correct_static PUBLIC HAVE_SSE=1)
@@ -96,7 +96,7 @@ add_subdirectory(tools)
9696
# install(FILES ${INSTALL_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
9797

9898
add_library(fec_shim_static EXCLUDE_FROM_ALL src/fec_shim.c ${correct_obj_files})
99-
set_target_properties(fec_shim_static PROPERTIES OUTPUT_NAME "fec")
99+
#set_target_properties(fec_shim_static PROPERTIES OUTPUT_NAME "fec")
100100
add_library(fec_shim_shared SHARED EXCLUDE_FROM_ALL src/fec_shim.c ${correct_obj_files})
101101
set_target_properties(fec_shim_shared PROPERTIES OUTPUT_NAME "fec")
102102
add_custom_target(fec-shim-h COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/include/fec_shim.h ${PROJECT_BINARY_DIR}/include/fec.h)

core/src/command_args.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ void CommandArgsParser::defineAll() {
3030
define('s', "server", "Run in server mode");
3131
define('\0', "password", "Protect server mode protocol with password",std::string(""));
3232
define('\0', "autostart", "Automatically start the SDR after loading");
33+
34+
// Test-related command line arguments. Will not fail in runtime, will be just ignored.
35+
define('t', "test", "Run a specific test", std::string(""));
36+
define('e', "enable_plugins", "Whitelist of plugins to enable (comma-separated)", std::string(""));
37+
define('\0', "test_root", "Root directory for test files", std::string(""));
3338
}
3439

3540
int CommandArgsParser::parse(int argc, char* argv[]) {
3641
this->systemArgv = argv;
3742
for (int i = 1; i < argc; i++) {
3843
std::string arg = argv[i];
39-
44+
4045
// Check for long and short name arguments
4146
if (!arg.rfind("--", 0)) {
4247
arg = arg.substr(2);
@@ -64,7 +69,7 @@ int CommandArgsParser::parse(int argc, char* argv[]) {
6469

6570
// Parse depending on type
6671
CLIArg& carg = args[arg];
67-
72+
6873
// If not void, make sure an argument is available and retrieve it
6974
if (carg.type != CLI_ARG_TYPE_VOID && i + 1 >= argc) {
7075
printf("Missing argument\n");

0 commit comments

Comments
 (0)