aboutsummaryrefslogtreecommitdiff
path: root/zenhttp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-04-19 10:43:28 +0200
committerStefan Boberg <[email protected]>2023-04-19 10:52:48 +0200
commit9fb9d6ce5aaedd4ecf4f7bdc9c33a94b1e6597b2 (patch)
tree924c8ede64e087a5bdfeeb87862bc08e325f4ddc /zenhttp
parentadded missing #pragma once (diff)
downloadzen-9fb9d6ce5aaedd4ecf4f7bdc9c33a94b1e6597b2.tar.xz
zen-9fb9d6ce5aaedd4ecf4f7bdc9c33a94b1e6597b2.zip
tweaks for enabling unity builds
mostly changes to make sure anonymous namespaces don't clash and a change to avoid windows headers from leaking into other compilation units unity builds are not yet enabled by default, but can be enabled by uncommenting this line in the root `xmake.lua` ``` --add_rules("c++.unity_build") ```
Diffstat (limited to 'zenhttp')
-rw-r--r--zenhttp/httpserver.cpp6
-rw-r--r--zenhttp/httpsys.cpp6
-rw-r--r--zenhttp/xmake.lua1
-rw-r--r--zenhttp/zenhttp.cpp1
4 files changed, 12 insertions, 2 deletions
diff --git a/zenhttp/httpserver.cpp b/zenhttp/httpserver.cpp
index 952857f2c..3576d9b3d 100644
--- a/zenhttp/httpserver.cpp
+++ b/zenhttp/httpserver.cpp
@@ -4,7 +4,6 @@
#include "httpasio.h"
#include "httpnull.h"
-#include "httpsys.h"
#include <zencore/compactbinary.h>
#include <zencore/compactbinarybuilder.h>
@@ -705,6 +704,9 @@ enum class HttpServerClass
kHttpNull
};
+// Implemented in httpsys.cpp
+Ref<HttpServer> CreateHttpSysServer(int Concurrency, int BackgroundWorkerThreads);
+
Ref<HttpServer>
CreateHttpServer(std::string_view ServerClass)
{
@@ -741,7 +743,7 @@ CreateHttpServer(std::string_view ServerClass)
#if ZEN_WITH_HTTPSYS
case HttpServerClass::kHttpSys:
ZEN_INFO("using http.sys server implementation");
- return new HttpSysServer(std::thread::hardware_concurrency(), /* background worker threads */ 16);
+ return CreateHttpSysServer(std::thread::hardware_concurrency(), /* background worker threads */ 16);
#endif
case HttpServerClass::kHttpNull:
diff --git a/zenhttp/httpsys.cpp b/zenhttp/httpsys.cpp
index 4b566905e..16ec135cd 100644
--- a/zenhttp/httpsys.cpp
+++ b/zenhttp/httpsys.cpp
@@ -1662,5 +1662,11 @@ HttpSysServer::RegisterService(HttpService& Service)
RegisterService(Service.BaseUri(), Service);
}
+Ref<HttpServer>
+CreateHttpSysServer(int Concurrency, int BackgroundWorkerThreads)
+{
+ return Ref<HttpServer>(new HttpSysServer(Concurrency, BackgroundWorkerThreads));
+}
+
} // namespace zen
#endif
diff --git a/zenhttp/xmake.lua b/zenhttp/xmake.lua
index 528b72d52..b0dbdbc79 100644
--- a/zenhttp/xmake.lua
+++ b/zenhttp/xmake.lua
@@ -4,6 +4,7 @@ target('zenhttp')
set_kind("static")
add_headerfiles("**.h")
add_files("**.cpp")
+ add_files("httpsys.cpp", {unity_ignored=true})
add_includedirs("include", {public=true})
add_deps("zencore")
add_packages(
diff --git a/zenhttp/zenhttp.cpp b/zenhttp/zenhttp.cpp
index 0194abdcb..1adca30e8 100644
--- a/zenhttp/zenhttp.cpp
+++ b/zenhttp/zenhttp.cpp
@@ -2,6 +2,7 @@
#include <zenhttp/zenhttp.h>
+#include <zenhttp/httpclient.h>
#include <zenhttp/httpserver.h>
#include <zenhttp/httpshared.h>