mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-26 21:51:13 +01:00
client
now works on windows
This commit is contained in:
+41
-35
@@ -6,43 +6,17 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
file(GLOB_RECURSE ui "ui/*")
|
||||
|
||||
set(PROJECT_SOURCES
|
||||
${ui}
|
||||
helpers.cpp
|
||||
helpers.hpp
|
||||
IterableEnum.hpp
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.hpp
|
||||
mainwindow.ui
|
||||
ui_base.cpp
|
||||
ui_base.hpp
|
||||
web_socket_wrapper.cpp
|
||||
web_socket_wrapper.hpp
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
qt_add_executable(unisim_client
|
||||
MANUAL_FINALIZATION
|
||||
${PROJECT_SOURCES}
|
||||
$<$<BOOL:${EMSCRIPTEN}>:${sims}>
|
||||
)
|
||||
# Define target properties for Android with Qt 6 as:
|
||||
# set_property(TARGET Simulator - CVS_I10 APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
|
||||
# ${CMAKE_CURRENT_SOURCE_DIR } / android)
|
||||
# For more information, see https: // doc.qt.io/qt-6/qt-add-executable.html#target-creation
|
||||
else()
|
||||
if(ANDROID)
|
||||
add_library(unisim_client SHARED
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
# Define properties for Android with Qt 5 after find_package() calls as:
|
||||
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
|
||||
else()
|
||||
add_executable(unisim_client
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
qt_add_executable(unisim_client
|
||||
MANUAL_FINALIZATION
|
||||
${PROJECT_SOURCES}
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
unisim_client
|
||||
@@ -50,18 +24,16 @@ set_target_properties(
|
||||
AUTOMOC ON
|
||||
AUTORCC ON
|
||||
AUTOUIC ON
|
||||
LINK_FLAGS "-Wl,--export-dynamic"
|
||||
)
|
||||
|
||||
target_include_directories(unisim_client
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${CMAKE_CURRENT_LIST_DIR}/simulators
|
||||
${CMAKE_CURRENT_LIST_DIR}/ui
|
||||
${PROJECT_BINARY_DIR}/
|
||||
)
|
||||
|
||||
target_link_libraries(unisim_client PRIVATE qwt spdlog Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::WebSockets magic_enum::magic_enum nlohmann_json::nlohmann_json git_tag)
|
||||
target_link_libraries(unisim_client PUBLIC Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::WebSockets spdlog magic_enum::magic_enum nlohmann_json::nlohmann_json git_tag client_common)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS unisim_client
|
||||
@@ -74,6 +46,40 @@ if(QT_VERSION_MAJOR EQUAL 6)
|
||||
qt_finalize_executable(unisim_client)
|
||||
endif()
|
||||
|
||||
add_library(client_common SHARED)
|
||||
target_sources(client_common
|
||||
PRIVATE
|
||||
${ui}
|
||||
helpers.cpp
|
||||
helpers.hpp
|
||||
ui_base.cpp
|
||||
ui_base.hpp
|
||||
web_socket_wrapper.cpp
|
||||
web_socket_wrapper.hpp
|
||||
)
|
||||
target_compile_definitions(client_common PRIVATE
|
||||
INTERNAL
|
||||
)
|
||||
target_link_libraries(client_common
|
||||
PUBLIC
|
||||
qwt Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::WebSockets magic_enum::magic_enum nlohmann_json::nlohmann_json
|
||||
)
|
||||
|
||||
set_target_properties(
|
||||
client_common
|
||||
PROPERTIES
|
||||
AUTOMOC ON
|
||||
AUTORCC ON
|
||||
AUTOUIC ON
|
||||
)
|
||||
|
||||
target_include_directories(client_common
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_LIST_DIR}
|
||||
${CMAKE_CURRENT_LIST_DIR}/ui
|
||||
${PROJECT_BINARY_DIR}
|
||||
)
|
||||
|
||||
if (NOT EMSCRIPTEN)
|
||||
file(GLOB_RECURSE sims "simulators/*.cpp")
|
||||
# Loop through each .cpp file and create a library for it
|
||||
@@ -83,8 +89,8 @@ if (NOT EMSCRIPTEN)
|
||||
|
||||
# Create a library for each .cpp file
|
||||
add_library(ui_${LIB_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.hpp ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.cpp ${CMAKE_CURRENT_SOURCE_DIR}/simulators/${LIB_NAME}.ui)
|
||||
target_link_libraries(ui_${LIB_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets magic_enum::magic_enum nlohmann_json::nlohmann_json)
|
||||
target_include_directories(ui_${LIB_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/ui ${CMAKE_SOURCE_DIR}/external/qwt/src ${PROJECT_BINARY_DIR}/)
|
||||
target_link_libraries(ui_${LIB_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Widgets client_common)
|
||||
target_include_directories(ui_${LIB_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/ui ${PROJECT_BINARY_DIR}/)
|
||||
|
||||
set_target_properties(
|
||||
ui_${LIB_NAME}
|
||||
|
||||
Reference in New Issue
Block a user