Started work for older system support

This commit is contained in:
Ryzerth
2021-08-16 18:49:00 +02:00
parent dcc17cdee7
commit 9f0e050d1b
7 changed files with 6121 additions and 0 deletions

21
scanner/CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.13)
project(scanner)
if (MSVC)
set(CMAKE_CXX_FLAGS "-O2 /std:c++17 /EHsc")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup")
else ()
set(CMAKE_CXX_FLAGS "-O3 -std=c++17")
endif ()
file(GLOB SRC "src/*.cpp")
include_directories("src/")
add_library(scanner SHARED ${SRC})
target_link_libraries(scanner PRIVATE sdrpp_core)
set_target_properties(scanner PROPERTIES PREFIX "")
# Install directives
install(TARGETS scanner DESTINATION lib/sdrpp/plugins)

63
scanner/src/main.cpp Normal file
View File

@ -0,0 +1,63 @@
#include <imgui.h>
#include <module.h>
#include <gui/gui.h>
SDRPP_MOD_INFO {
/* Name: */ "scanner",
/* Description: */ "Frequency scanner for SDR++",
/* Author: */ "Ryzerth",
/* Version: */ 0, 1, 0,
/* Max instances */ -1
};
class ScannerModule : public ModuleManager::Instance {
public:
ScannerModule(std::string name) {
this->name = name;
gui::menu.registerEntry(name, menuHandler, this, NULL);
}
~ScannerModule() {
gui::menu.removeEntry(name);
}
void postInit() {}
void enable() {
enabled = true;
}
void disable() {
enabled = false;
}
bool isEnabled() {
return enabled;
}
private:
static void menuHandler(void* ctx) {
ScannerModule* _this = (ScannerModule*)ctx;
ImGui::Text("Hello SDR++, my name is %s", _this->name.c_str());
}
std::string name;
bool enabled = true;
};
MOD_EXPORT void _INIT_() {
// Nothing here
}
MOD_EXPORT ModuleManager::Instance* _CREATE_INSTANCE_(std::string name) {
return new ScannerModule(name);
}
MOD_EXPORT void _DELETE_INSTANCE_(void* instance) {
delete (ScannerModule*)instance;
}
MOD_EXPORT void _END_() {
// Nothing here
}