summaryrefslogtreecommitdiffstats
path: root/GUI
diff options
context:
space:
mode:
Diffstat (limited to 'GUI')
-rw-r--r--GUI/GUI/GUI/BrowserSource.cpp12
-rw-r--r--GUI/GUI/GUI/BrowserSource.h73
-rw-r--r--GUI/GUI/GUI/GUI.vcxproj8
-rw-r--r--GUI/Libraries/fetch.ps18
4 files changed, 97 insertions, 4 deletions
diff --git a/GUI/GUI/GUI/BrowserSource.cpp b/GUI/GUI/GUI/BrowserSource.cpp
new file mode 100644
index 0000000..9df4f81
--- /dev/null
+++ b/GUI/GUI/GUI/BrowserSource.cpp
@@ -0,0 +1,12 @@
+#include "BrowserSource.h"
+
+#include "oatpp/network/Server.hpp"
+
+BrowserSource::BrowserSource(uint16_t port)
+ : port_(port)
+{
+ AppComponent components;
+ OATPP_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, router);
+ router->addController(std::make_shared<AppController>());
+
+}
diff --git a/GUI/GUI/GUI/BrowserSource.h b/GUI/GUI/GUI/BrowserSource.h
new file mode 100644
index 0000000..efc6142
--- /dev/null
+++ b/GUI/GUI/GUI/BrowserSource.h
@@ -0,0 +1,73 @@
+#pragma once
+
+#include "oatpp/core/macro/codegen.hpp"
+#include "oatpp/core/macro/component.hpp"
+#include "oatpp/core/Types.hpp"
+#include "oatpp/network/tcp/server/ConnectionProvider.hpp"
+#include "oatpp/parser/json/mapping/ObjectMapper.hpp"
+#include "oatpp/web/server/api/ApiController.hpp"
+#include "oatpp/web/server/HttpConnectionHandler.hpp"
+#include "oatpp/web/protocol/http/incoming/Request.hpp"
+
+#include <stdint.h>
+
+#include OATPP_CODEGEN_BEGIN(DTO)
+
+class AppDto : public oatpp::DTO {
+
+ DTO_INIT(AppDto, DTO)
+
+ DTO_FIELD(Int32, statusCode);
+ DTO_FIELD(String, message);
+
+};
+
+#include OATPP_CODEGEN_END(DTO)
+
+#include OATPP_CODEGEN_BEGIN(ApiController)
+
+class AppController : public oatpp::web::server::api::ApiController {
+public:
+ AppController(OATPP_COMPONENT(std::shared_ptr<ObjectMapper>, objectMapper))
+ : oatpp::web::server::api::ApiController(objectMapper)
+ {}
+public:
+
+ ENDPOINT("GET", "/", root) {
+ auto dto = AppDto::createShared();
+ dto->statusCode = 200;
+ dto->message = "Hello World!";
+ return createDtoResponse(Status::CODE_200, dto);
+ }
+};
+
+#include OATPP_CODEGEN_END(ApiController)
+
+class AppComponent {
+public:
+ // TODO(yum) parameterize port
+ OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ServerConnectionProvider>, serverConnectionProvider)([] {
+ return oatpp::network::tcp::server::ConnectionProvider::createShared({ "0.0.0.0", 8000, oatpp::network::Address::IP_4 });
+ }());
+
+ OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, httpRouter)([] {
+ return oatpp::web::server::HttpRouter::createShared();
+ }());
+
+ OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::network::ConnectionHandler>, serverConnectionHandler)([] {
+ OATPP_COMPONENT(std::shared_ptr<oatpp::web::server::HttpRouter>, router); // get Router component
+ return oatpp::web::server::HttpConnectionHandler::createShared(router);
+ }());
+
+ OATPP_CREATE_COMPONENT(std::shared_ptr<oatpp::data::mapping::ObjectMapper>, apiObjectMapper)([] {
+ return oatpp::parser::json::mapping::ObjectMapper::createShared();
+ }());
+};
+
+class BrowserSource {
+public:
+ BrowserSource(uint16_t port);
+
+private:
+ const uint16_t port_;
+};
diff --git a/GUI/GUI/GUI/GUI.vcxproj b/GUI/GUI/GUI/GUI.vcxproj
index 0243d73..8db7fbf 100644
--- a/GUI/GUI/GUI/GUI.vcxproj
+++ b/GUI/GUI/GUI/GUI.vcxproj
@@ -75,8 +75,8 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(ProjectDir)/whisper/</LibraryPath>
- <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)/whisper</IncludePath>
+ <LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(ProjectDir)/whisper;$(ProjectDir)/oatpp</LibraryPath>
+ <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
@@ -141,11 +141,12 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;shell32.lib;shlwapi.lib;ole32.lib;oleaut32.lib;uuid.lib;advapi32.lib;version.lib;comctl32.lib;rpcrt4.lib;ws2_32.lib;wininet.lib;winmm.lib;Whisper.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;shell32.lib;shlwapi.lib;ole32.lib;oleaut32.lib;uuid.lib;advapi32.lib;version.lib;comctl32.lib;rpcrt4.lib;ws2_32.lib;wininet.lib;winmm.lib;Whisper.lib;oatpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="App.cpp" />
+ <ClCompile Include="BrowserSource.cpp" />
<ClCompile Include="Config.cpp" />
<ClCompile Include="Frame.cpp" />
<ClCompile Include="Logging.cpp" />
@@ -155,6 +156,7 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="App.h" />
+ <ClInclude Include="BrowserSource.h" />
<ClInclude Include="Config.h" />
<ClInclude Include="Frame.h" />
<ClInclude Include="Logging.h" />
diff --git a/GUI/Libraries/fetch.ps1 b/GUI/Libraries/fetch.ps1
index 218d48b..550dfa5 100644
--- a/GUI/Libraries/fetch.ps1
+++ b/GUI/Libraries/fetch.ps1
@@ -86,8 +86,14 @@ if (-Not (Test-Path oatpp)) {
pushd $OATPP_DIR > $null
mkdir build
pushd build > $null
- cmake.exe .. -DCMAKE_BUILD_TYPE=Release -DOATPP_BUILD_TESTS=OFF
+ cmake.exe .. `
+ -DCMAKE_BUILD_TYPE=Release `
+ -DBUILD_SHARED_LIBS=OFF `
+ -DOATPP_MSVC_LINK_STATIC_RUNTIME=ON `
+ -DOATPP_BUILD_TESTS=OFF
cmake.exe --build . -j $NPROC --config Release
+ cp src/Release/oatpp.lib ../../../../GUI/GUI/oatpp/
+ cp -Recurse ../src/oatpp/* ../../../../GUI/GUI/oatpp/
popd > $null
popd > $null
}