From 7dfbfbffee0ae36705e076b4eef14ac78378f74a Mon Sep 17 00:00:00 2001 From: Sander Speetjens Date: Mon, 17 Feb 2025 11:56:37 +0100 Subject: [PATCH] move from fetchcontent to submodule --- .gitmodules | 6 ++++++ client/CMakeLists.txt | 16 ---------------- client/simulator_base.h | 2 +- client/web_socket_wrapper.cpp | 2 +- external/CMakeLists.txt | 5 ++++- external/json | 1 + external/magic_enum | 1 + server/CAN/CAN_interface.cpp | 2 +- server/CMakeLists.txt | 5 ----- server/message_parser.cpp | 2 +- src/UI/CMakeLists.txt | 5 ----- 11 files changed, 16 insertions(+), 31 deletions(-) create mode 160000 external/json create mode 160000 external/magic_enum diff --git a/.gitmodules b/.gitmodules index a5c195f..8c4419f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,9 @@ [submodule "external/qwt"] path = external/qwt url = https://github.com/Sani7/qwt.git +[submodule "external/magic_enum"] + path = external/magic_enum + url = https://github.com/Neargye/magic_enum.git +[submodule "external/json"] + path = external/json + url = https://github.com/nlohmann/json.git diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 5906461..a8ffdbb 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,21 +1,5 @@ cmake_minimum_required(VERSION 3.5) -project(Simulator-CVS_I10 VERSION 0.1 LANGUAGES CXX) - -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) - -include(FetchContent) - -FetchContent_Declare(magic_enum URL https://github.com/Neargye/magic_enum/releases/download/v0.9.6/magic_enum-v0.9.6.tar.gz DOWNLOAD_EXTRACT_TIMESTAMP TRUE) -FetchContent_MakeAvailable(magic_enum) -FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz DOWNLOAD_EXTRACT_TIMESTAMP TRUE) -FetchContent_MakeAvailable(json) - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets Svg WebSockets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Svg WebSockets) diff --git a/client/simulator_base.h b/client/simulator_base.h index 0dbe403..f070c80 100644 --- a/client/simulator_base.h +++ b/client/simulator_base.h @@ -9,7 +9,7 @@ #include "web_socket_wrapper.h" #include #include -#include +#include #include using json = nlohmann::json; diff --git a/client/web_socket_wrapper.cpp b/client/web_socket_wrapper.cpp index 6d412bc..5f2459a 100644 --- a/client/web_socket_wrapper.cpp +++ b/client/web_socket_wrapper.cpp @@ -1,6 +1,6 @@ #include "web_socket_wrapper.h" -#include "magic_enum.hpp" #include "spdlog/spdlog.h" +#include Web_socket_wrapper::Web_socket_wrapper(const QUrl &url, QObject *parent) : QObject(parent), m_web_socket(new QWebSocket("", QWebSocketProtocol::VersionLatest, this)), diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index d84d975..be3f20e 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -1,3 +1,6 @@ add_subdirectory(color) -add_subdirectory(spdlog) add_subdirectory(cpp-templates) +add_subdirectory(json) +add_subdirectory(magic_enum) +add_subdirectory(spdlog) +add_subdirectory(qwt) diff --git a/external/json b/external/json new file mode 160000 index 0000000..9cca280 --- /dev/null +++ b/external/json @@ -0,0 +1 @@ +Subproject commit 9cca280a4d0ccf0c08f47a99aa71d1b0e52f8d03 diff --git a/external/magic_enum b/external/magic_enum new file mode 160000 index 0000000..e046b69 --- /dev/null +++ b/external/magic_enum @@ -0,0 +1 @@ +Subproject commit e046b69a3736d314fad813e159b1c192eaef92cd diff --git a/server/CAN/CAN_interface.cpp b/server/CAN/CAN_interface.cpp index 8aac267..631c943 100644 --- a/server/CAN/CAN_interface.cpp +++ b/server/CAN/CAN_interface.cpp @@ -1,6 +1,6 @@ #include "CAN_interface.hpp" -#include "magic_enum.hpp" #include "spdlog/spdlog.h" +#include CAN_Interface::CAN_Interface(QString dev, QObject *parent) : QObject(parent) { diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 712fff6..66d28ee 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -9,11 +9,6 @@ find_package(Qt6 REQUIRED COMPONENTS Core WebSockets SerialBus) qt_standard_project_setup() qt_add_executable(server) -include(FetchContent) - -FetchContent_Declare(magic_enum URL https://github.com/Neargye/magic_enum/releases/download/v0.9.6/magic_enum-v0.9.6.tar.gz DOWNLOAD_EXTRACT_TIMESTAMP TRUE) -FetchContent_MakeAvailable(magic_enum) - file(GLOB_RECURSE SIM_SOURCES "simulators/*.[hc]pp") file(GLOB_RECURSE CAN_SOURCES "CAN/*.[hc]pp") diff --git a/server/message_parser.cpp b/server/message_parser.cpp index e39cf1c..3dfc110 100644 --- a/server/message_parser.cpp +++ b/server/message_parser.cpp @@ -1,5 +1,5 @@ #include "simulators.hpp" -#include +#include QString Simulators::message_parser(QString message) { diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt index db10a56..b83657c 100644 --- a/src/UI/CMakeLists.txt +++ b/src/UI/CMakeLists.txt @@ -1,10 +1,5 @@ add_library(UI) -include(FetchContent) - -FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz DOWNLOAD_EXTRACT_TIMESTAMP TRUE) -FetchContent_MakeAvailable(json) - find_package(Qt6 REQUIRED COMPONENTS Core SerialBus) set_target_properties(