mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-29 22:07:51 +02:00
added module system
This commit is contained in:
55
modules/demo/CMakeLists.txt
Normal file
55
modules/demo/CMakeLists.txt
Normal file
@ -0,0 +1,55 @@
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
project(demo)
|
||||
|
||||
if (MSVC)
|
||||
set(CMAKE_CXX_FLAGS "-O2 /std:c++17")
|
||||
link_directories(demo "C:/Program Files/PothosSDR/lib/")
|
||||
include_directories(demo "C:/Program Files/PothosSDR/include/volk/")
|
||||
include_directories(demo "C:/Program Files/PothosSDR/include/")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "-O3 -std=c++17 -fsanitize=address -g")
|
||||
include_directories(demo "/usr/include/volk")
|
||||
link_libraries(pthread)
|
||||
link_libraries(GL)
|
||||
link_libraries(GLEW)
|
||||
link_libraries(glfw)
|
||||
link_libraries(fftw3)
|
||||
link_libraries(fftw3f)
|
||||
link_libraries(portaudio)
|
||||
link_libraries(X11)
|
||||
link_libraries(Xxf86vm)
|
||||
endif (MSVC)
|
||||
|
||||
link_libraries(volk)
|
||||
link_libraries(SoapySDR)
|
||||
|
||||
# Main code
|
||||
include_directories(demo "src/")
|
||||
include_directories(demo "../../src/")
|
||||
include_directories(demo "../../src/imgui")
|
||||
file(GLOB SRC "src/*.cpp")
|
||||
file(GLOB IMGUI "../../src/imgui/*.cpp")
|
||||
add_library(demo SHARED ${SRC} ${IMGUI})
|
||||
set_target_properties(demo PROPERTIES OUTPUT_NAME demo)
|
||||
|
||||
if (MSVC)
|
||||
# Glew
|
||||
find_package(GLEW REQUIRED)
|
||||
target_link_libraries(demo PRIVATE GLEW::GLEW)
|
||||
|
||||
# GLFW3
|
||||
find_package(glfw3 CONFIG REQUIRED)
|
||||
target_link_libraries(demo PRIVATE glfw)
|
||||
|
||||
# FFTW3
|
||||
find_package(FFTW3 CONFIG REQUIRED)
|
||||
target_link_libraries(demo PRIVATE FFTW3::fftw3)
|
||||
find_package(FFTW3f CONFIG REQUIRED)
|
||||
target_link_libraries(demo PRIVATE FFTW3::fftw3f)
|
||||
|
||||
# PortAudio
|
||||
find_package(portaudio CONFIG REQUIRED)
|
||||
target_link_libraries(demo PRIVATE portaudio portaudio_static)
|
||||
endif (MSVC)
|
||||
|
||||
# cmake .. "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Alex/vcpkg/scripts/buildsystems/vcpkg.cmake" -G "Visual Studio 15 2017 Win64"
|
26
modules/demo/src/main.cpp
Normal file
26
modules/demo/src/main.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <imgui.h>
|
||||
#include <module.h>
|
||||
|
||||
mod::API_t* API;
|
||||
|
||||
struct DemoContext_t {
|
||||
std::string name;
|
||||
};
|
||||
|
||||
MOD_EXPORT void* _INIT_(mod::API_t* _API, ImGuiContext* imctx, std::string _name) {
|
||||
API = _API;
|
||||
DemoContext_t* ctx = new DemoContext_t;
|
||||
ctx->name = _name;
|
||||
ImGui::SetCurrentContext(imctx);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
MOD_EXPORT void _DRAW_MENU_(DemoContext_t* ctx) {
|
||||
char buf[100];
|
||||
sprintf(buf, "I'm %s", ctx->name.c_str());
|
||||
ImGui::Button(buf);
|
||||
}
|
||||
|
||||
MOD_EXPORT void _STOP_(DemoContext_t* ctx) {
|
||||
delete ctx;
|
||||
}
|
Reference in New Issue
Block a user