mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
server cmake
cleanup
This commit is contained in:
+35
-15
@@ -9,20 +9,11 @@ find_package(Qt6 REQUIRED COMPONENTS Core WebSockets SerialBus Network)
|
||||
qt_standard_project_setup()
|
||||
qt_add_executable(unisim_server)
|
||||
|
||||
set_target_properties(
|
||||
unisim_server
|
||||
PROPERTIES
|
||||
LINK_FLAGS "-Wl,--export-dynamic"
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE EXTSOURCES "extensions/*.[hc]pp")
|
||||
|
||||
target_sources(unisim_server PRIVATE
|
||||
${EXTSOURCES}
|
||||
main.cpp
|
||||
message_parser.cpp
|
||||
simulator_base.cpp
|
||||
simulator_base.hpp
|
||||
simulators.cpp
|
||||
simulators.hpp
|
||||
websocket.cpp
|
||||
@@ -36,9 +27,6 @@ target_compile_options(unisim_server PRIVATE $<$<CONFIG:Debug>:
|
||||
target_include_directories(unisim_server
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${CMAKE_CURRENT_LIST_DIR}/simulators
|
||||
${CMAKE_CURRENT_LIST_DIR}/extensions
|
||||
PRIVATE
|
||||
)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
@@ -53,12 +41,44 @@ target_link_libraries(unisim_server PRIVATE
|
||||
Qt::Network
|
||||
magic_enum::magic_enum
|
||||
spdlog
|
||||
cpp_templates
|
||||
git_tag
|
||||
server_common
|
||||
)
|
||||
|
||||
add_library(server_common SHARED)
|
||||
target_sources(server_common
|
||||
PRIVATE
|
||||
${EXTSOURCES}
|
||||
simulator_base.cpp
|
||||
simulator_base.hpp
|
||||
)
|
||||
|
||||
target_link_libraries(server_common
|
||||
PUBLIC
|
||||
UI
|
||||
spdlog
|
||||
cpp_templates
|
||||
${GPIOD_LIB}
|
||||
git_tag
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
server_common
|
||||
PROPERTIES
|
||||
AUTOMOC ON
|
||||
)
|
||||
|
||||
target_include_directories(server_common
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${CMAKE_CURRENT_LIST_DIR}/extensions
|
||||
)
|
||||
|
||||
add_custom_command(TARGET server_common POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:server_common>
|
||||
$<TARGET_FILE_DIR:unisim_server>)
|
||||
|
||||
file(GLOB_RECURSE sims "simulators/*.cpp")
|
||||
|
||||
# Loop through each .cpp file and create a library for it
|
||||
@@ -68,8 +88,8 @@ foreach(sim ${sims})
|
||||
|
||||
# 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}/extensions ${CMAKE_CURRENT_LIST_DIR}/../UI ${CMAKE_CURRENT_LIST_DIR}/../external/color ${CMAKE_CURRENT_LIST_DIR}/../external/cpp-templates)
|
||||
target_link_libraries(sim_${LIB_NAME} PUBLIC Qt::SerialBus magic_enum::magic_enum nlohmann_json::nlohmann_json server_common)
|
||||
target_include_directories(sim_${LIB_NAME} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/extensions)
|
||||
add_custom_command(TARGET sim_${LIB_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:sim_${LIB_NAME}>
|
||||
|
||||
Reference in New Issue
Block a user