mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-26 04:17:50 +02:00
Changed project structure
This commit is contained in:
21
misc_modules/demo_module/CMakeLists.txt
Normal file
21
misc_modules/demo_module/CMakeLists.txt
Normal file
@ -0,0 +1,21 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(demo)
|
||||
|
||||
if (MSVC)
|
||||
add_compile_options(/O2 /Ob2 /std:c++17 /EHsc)
|
||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(-O3 -std=c++17 -Wno-unused-command-line-argument -undefined dynamic_lookup)
|
||||
else ()
|
||||
add_compile_options(-O3 -std=c++17)
|
||||
endif ()
|
||||
|
||||
file(GLOB SRC "src/*.cpp")
|
||||
|
||||
include_directories("src/")
|
||||
|
||||
add_library(demo SHARED ${SRC})
|
||||
target_link_libraries(demo PRIVATE sdrpp_core)
|
||||
set_target_properties(demo PROPERTIES PREFIX "")
|
||||
|
||||
# Install directives
|
||||
install(TARGETS demo DESTINATION lib/sdrpp/plugins)
|
63
misc_modules/demo_module/src/main.cpp
Normal file
63
misc_modules/demo_module/src/main.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
#include <imgui.h>
|
||||
#include <module.h>
|
||||
#include <gui/gui.h>
|
||||
|
||||
SDRPP_MOD_INFO {
|
||||
/* Name: */ "demo",
|
||||
/* Description: */ "My fancy new module",
|
||||
/* Author: */ "author1;author2,author3,etc...",
|
||||
/* Version: */ 0, 1, 0,
|
||||
/* Max instances */ -1
|
||||
};
|
||||
|
||||
class DemoModule : public ModuleManager::Instance {
|
||||
public:
|
||||
DemoModule(std::string name) {
|
||||
this->name = name;
|
||||
gui::menu.registerEntry(name, menuHandler, this, NULL);
|
||||
}
|
||||
|
||||
~DemoModule() {
|
||||
gui::menu.removeEntry(name);
|
||||
}
|
||||
|
||||
void postInit() {}
|
||||
|
||||
void enable() {
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
void disable() {
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
bool isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
private:
|
||||
static void menuHandler(void* ctx) {
|
||||
DemoModule* _this = (DemoModule*)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 DemoModule(name);
|
||||
}
|
||||
|
||||
MOD_EXPORT void _DELETE_INSTANCE_(void* instance) {
|
||||
delete (DemoModule*)instance;
|
||||
}
|
||||
|
||||
MOD_EXPORT void _END_() {
|
||||
// Nothing here
|
||||
}
|
Reference in New Issue
Block a user