build able but not implemented
This commit is contained in:
2026-02-14 14:31:22 +01:00
parent 6631267010
commit a0d75c7e4e
2 changed files with 32 additions and 7 deletions
+30 -2
View File
@@ -9,10 +9,24 @@ find_package(Qt6 REQUIRED COMPONENTS Core WebSockets SerialBus Network)
qt_standard_project_setup()
qt_add_executable(server)
file(GLOB_RECURSE SOURCES "*.[hc]pp")
set_target_properties(
server
PROPERTIES
LINK_FLAGS "-Wl,--export-dynamic"
)
file(GLOB_RECURSE CANSOURCES "CAN/*.[hc]pp")
target_sources(server PRIVATE
${SOURCES}
${CANSOURCES}
main.cpp
message_parser.cpp
simulator_base.cpp
simulator_base.hpp
simulators.cpp
simulators.hpp
websocket.cpp
websocket.hpp
)
target_compile_options(server PRIVATE $<$<CONFIG:Debug>:
@@ -42,3 +56,17 @@ target_link_libraries(server PRIVATE
cpp_templates
${GPIOD_LIB}
)
file(GLOB_RECURSE sims "simulators/*.cpp")
# Loop through each .cpp file and create a library for it
foreach(sim ${sims})
# Extract the base name of the file (without the directory and extension)
get_filename_component(LIB_NAME ${sim} NAME_WE)
# Create a library for each .cpp file
add_library(sim_${LIB_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.hpp ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.cpp)
target_link_libraries(sim_${LIB_NAME} PRIVATE Qt::SerialBus magic_enum::magic_enum nlohmann_json::nlohmann_json)
target_include_directories(sim_${LIB_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/CAN ${CMAKE_SOURCE_DIR}/UI ${CMAKE_SOURCE_DIR}/external/color)
endforeach()
+2 -5
View File
@@ -1,7 +1,4 @@
#include "simulators.hpp"
#include "can_debugger.hpp"
#include "cvs_i10.hpp"
#include "test_sim.hpp"
#include <unordered_set>
Simulators::Simulators(uint16_t port, QString can_dev, QString uart_dev, QObject *parent)
@@ -31,8 +28,8 @@ Simulators::Simulators(uint16_t port, QString can_dev, QString uart_dev, QObject
m_com.c_if1 = m_can_wrapper;
m_com.s_if1 = m_serial;
INSERT_SIMULATOR(Test_Sim);
INSERT_SIMULATOR(Can_Debugger);
// Insert Debug sims here
// INSERT_SIMULATOR(TEST_SIM);
connect(m_server, &Websocket::on_message, this, [this](QWebSocket *conn, QString message) {
QString response = message_parser(message);