From 107d3cce09b04893cb5ef692395af364079b3bac Mon Sep 17 00:00:00 2001 From: tt2468 Date: Tue, 27 Apr 2021 09:46:00 -0700 Subject: [PATCH] deps: Add nlohmann json I decided to go with nlohmann::json because it supports both JSON and msgpack. I'm likely going to have to write some conversion utils to convert between obs_data_t and json, but the advantages of what nlohmann::json brings to the table are just too attractive. --- .gitmodules | 3 +++ CMakeLists.txt | 8 +++++++- deps/json | 1 + src/WebSocketServer.h | 4 ++++ src/requesthandler/rpc/Request.h | 4 +++- src/requesthandler/rpc/RequestResult.h | 4 +++- 6 files changed, 21 insertions(+), 3 deletions(-) create mode 160000 deps/json diff --git a/.gitmodules b/.gitmodules index 3e9749f0..ecd47ac0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "deps/asio"] path = deps/asio url = https://github.com/chriskohlhoff/asio.git +[submodule "deps/json"] + path = deps/json + url = https://github.com/nlohmann/json.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 83768d46..503fc8a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,11 @@ find_package(LibObs REQUIRED) find_package(Qt5 REQUIRED COMPONENTS Core Widgets Concurrent) +# Find nlohmann +set(JSON_BuildTests OFF CACHE INTERNAL "") +add_subdirectory(deps/json) + + # Configure files configure_file( src/plugin-macros.h.in @@ -99,7 +104,8 @@ target_link_libraries(obs-websocket libobs Qt5::Core Qt5::Widgets - Qt5::Concurrent) + Qt5::Concurrent + nlohmann_json::nlohmann_json) # Windows-specific build settings and tasks diff --git a/deps/json b/deps/json new file mode 160000 index 00000000..a34e011e --- /dev/null +++ b/deps/json @@ -0,0 +1 @@ +Subproject commit a34e011e24beece3b69397a03fdc650546f052c3 diff --git a/src/WebSocketServer.h b/src/WebSocketServer.h index 3a4ce6d5..0438b029 100644 --- a/src/WebSocketServer.h +++ b/src/WebSocketServer.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include "requesthandler/RequestHandler.h" @@ -10,4 +11,7 @@ class WebSocketServer : public QObject public: ; + + private: + ; }; \ No newline at end of file diff --git a/src/requesthandler/rpc/Request.h b/src/requesthandler/rpc/Request.h index 7b9637ef..9e79fd71 100644 --- a/src/requesthandler/rpc/Request.h +++ b/src/requesthandler/rpc/Request.h @@ -1 +1,3 @@ -#pragma once \ No newline at end of file +#pragma once + +#include \ No newline at end of file diff --git a/src/requesthandler/rpc/RequestResult.h b/src/requesthandler/rpc/RequestResult.h index 7b9637ef..9e79fd71 100644 --- a/src/requesthandler/rpc/RequestResult.h +++ b/src/requesthandler/rpc/RequestResult.h @@ -1 +1,3 @@ -#pragma once \ No newline at end of file +#pragma once + +#include \ No newline at end of file