From 1fb3e9814645b055de815b68569e457863fd21f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedek=20L=C3=A1szl=C3=B3?= Date: Tue, 14 May 2024 16:08:39 +0200 Subject: [PATCH] basic layout --- CMakeLists.txt | 28 +----- src/graph/plugins/http/CMakeLists.txt | 3 +- src/graph/server/CMakeLists.txt | 28 ++++++ src/graph/server/gui/mainwindow.cpp | 2 +- src/graph/server/gui/mainwindow.ui | 135 ++++++++++++++++++-------- src/graph/server/main.cpp | 2 +- 6 files changed, 131 insertions(+), 67 deletions(-) create mode 100644 src/graph/server/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a64004..79d1650 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,32 +19,10 @@ if(DEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -DDEBUG") endif() +include_directories("${CMAKE_SOURCE_DIR}/inc") + # build plugins -include_directories("${CMAKE_SOURCE_DIR}/inc" "${CMAKE_SOURCE_DIR}/build") add_subdirectory("${CMAKE_SOURCE_DIR}/src/graph/plugins") # build gui server -find_package(Qt6 REQUIRED COMPONENTS Widgets) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -file(GLOB_RECURSE SERVER_SOURCES "${CMAKE_SOURCE_DIR}/src/graph/server/*.cpp") -file(GLOB_RECURSE SERVER_UI "${CMAKE_SOURCE_DIR}/src/graph/server/*.ui") -file(GLOB_RECURSE SERVER_RES "${CMAKE_SOURCE_DIR}/src/graph/server/*.qrc") -file(GLOB_RECURSE SERVER_HEADERS "${CMAKE_SOURCE_DIR}/inc/graph/server/*.h") - -cmake_print_variables(SERVER_SOURCES) -cmake_print_variables(SERVER_UI) -cmake_print_variables(SERVER_RES) -cmake_print_variables(SERVER_HEADERS) - -qt_wrap_cpp(SERVER_GEN_SRC ${SERVER_SRC}) -qt_wrap_ui(SERVER_GEN_UI ${SERVER_UI}) - -add_executable(server - ${SERVER_SOURCES} ${SERVER_RES} ${SERVER_UI} ${SERVER_HEADERS} - ${SERVER_GEN_SRC} ${SERVER_GEN_UI} -) - -target_link_libraries(server PRIVATE dl Qt6::Widgets) \ No newline at end of file +add_subdirectory("${CMAKE_SOURCE_DIR}/src/graph/server") \ No newline at end of file diff --git a/src/graph/plugins/http/CMakeLists.txt b/src/graph/plugins/http/CMakeLists.txt index 23b5415..ca44733 100644 --- a/src/graph/plugins/http/CMakeLists.txt +++ b/src/graph/plugins/http/CMakeLists.txt @@ -1,2 +1,3 @@ file(GLOB_RECURSE HTTP_SOURCES "./*.cpp") -add_library(http SHARED ${HTTP_SOURCES}) \ No newline at end of file +add_library(http SHARED ${HTTP_SOURCES}) +set_target_properties(http PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") \ No newline at end of file diff --git a/src/graph/server/CMakeLists.txt b/src/graph/server/CMakeLists.txt new file mode 100644 index 0000000..407bfe1 --- /dev/null +++ b/src/graph/server/CMakeLists.txt @@ -0,0 +1,28 @@ +find_package(Qt6 REQUIRED COMPONENTS Widgets) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +file(GLOB_RECURSE SERVER_SOURCES "*.cpp") +file(GLOB_RECURSE SERVER_UI "*.ui") +file(GLOB_RECURSE SERVER_RES "*.qrc") +# file(GLOB_RECURSE SERVER_HEADERS "${CMAKE_SOURCE_DIR}/inc/graph/server/*.h") +file(GLOB_RECURSE SERVER_HEADERS "../../../inc/graph/server/*.h") + +cmake_print_variables(SERVER_SOURCES) +cmake_print_variables(SERVER_UI) +cmake_print_variables(SERVER_RES) +cmake_print_variables(SERVER_HEADERS) +cmake_print_variables(CMAKE_BINARY_DIR) + +qt_wrap_cpp(SERVER_GEN_SRC ${SERVER_SRC}) +qt_wrap_ui(SERVER_GEN_UI ${SERVER_UI}) + +add_executable(server + ${SERVER_SOURCES} ${SERVER_RES} ${SERVER_UI} ${SERVER_HEADERS} + ${SERVER_GEN_SRC} ${SERVER_GEN_UI} +) + +target_include_directories(server PRIVATE "${CMAKE_BINARY_DIR}/src") +target_link_libraries(server PRIVATE dl Qt6::Widgets) +set_target_properties(server PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") \ No newline at end of file diff --git a/src/graph/server/gui/mainwindow.cpp b/src/graph/server/gui/mainwindow.cpp index 5261f66..4d8ace5 100644 --- a/src/graph/server/gui/mainwindow.cpp +++ b/src/graph/server/gui/mainwindow.cpp @@ -1,5 +1,5 @@ #include -#include +#include namespace Graph::GUI { MainWindow::MainWindow(QWidget *parent) diff --git a/src/graph/server/gui/mainwindow.ui b/src/graph/server/gui/mainwindow.ui index a47d899..67a6d68 100644 --- a/src/graph/server/gui/mainwindow.ui +++ b/src/graph/server/gui/mainwindow.ui @@ -1,41 +1,98 @@ - MainWindow - - - MainWindow - - - Graph - - - - 0 - 0 - 640 - 480 - - - - - - &File - - - - - - - - E&xit - - - - - - - - - - - \ No newline at end of file + MainWindow + + + + 0 + 0 + 800 + 600 + + + + Graphs + + + + + + + 0 + + + false + + + + Graphs + + + + + + + + + + Plugins + + + + + + + + + + + + + + + 0 + 0 + 800 + 22 + + + + + &Graph + + + + + + + &Plugin + + + + + + + + + &Load + + + + + &Unload + + + + + &Add + + + + + &Remove + + + + + + diff --git a/src/graph/server/main.cpp b/src/graph/server/main.cpp index 4d752d6..ec489ac 100644 --- a/src/graph/server/main.cpp +++ b/src/graph/server/main.cpp @@ -5,7 +5,7 @@ #include int main(int argc, char** argv) { - Graph::Plugin plugin("src/graph/plugins/http/libhttp.so"); + Graph::Plugin plugin("plugins/libhttp.so"); plugin.init((update_callback_t)1); QApplication app(argc, argv);