aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmytro Ivanov <[email protected]>2024-09-27 14:07:17 +0200
committerDmytro Ivanov <[email protected]>2024-10-02 15:46:07 +0200
commitac5e18320323310f816fe8df0f46ebd7effcecd9 (patch)
tree227d589b96adb2bb66f1d6488f5388d074e820c6
parent5.5.8 (diff)
downloadzen-ac5e18320323310f816fe8df0f46ebd7effcecd9.tar.xz
zen-ac5e18320323310f816fe8df0f46ebd7effcecd9.zip
add cmake build config to be able to use cliondi/add_cmake_dev
-rw-r--r--.gitignore4
-rw-r--r--CMakeLists.txt124
-rw-r--r--CMakePresets.json13
-rw-r--r--src/zencore/logging.cpp1
-rw-r--r--src/zenserver/projectstore/httpprojectstore.cpp4
-rw-r--r--src/zenstore/cache/structuredcachestore.cpp2
-rw-r--r--src/zenutil/include/zenutil/logging/fullformatter.h2
-rw-r--r--src/zenutil/include/zenutil/logging/rotatingfilesink.h1
-rw-r--r--vcpkg.json26
9 files changed, 173 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index d41ddc59f..0b0e6e8d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -220,4 +220,6 @@ CMake*
.cache/
# Ue tool chain temp directory
-.tmp-ue-toolchain/ \ No newline at end of file
+.tmp-ue-toolchain/
+
+.idea/ \ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000000000..6346f3773
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,124 @@
+cmake_minimum_required(VERSION 3.29)
+set(VCPKG_TARGET_TRIPLET x64-windows-static)
+set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+set(CMAKE_CXX_STANDARD 20)
+
+project(zen CXX)
+
+add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
+add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
+
+add_compile_definitions(
+ _CRT_SECURE_NO_WARNINGS
+ UNICODE
+ _UNICODE
+ NOMINMAX
+ NOGDI
+ _CONSOLE
+ _WIN32_WINNT=0x0A00
+ ZEN_WITH_TESTS=0
+)
+
+find_package(asio CONFIG REQUIRED)
+find_package(blake3 CONFIG REQUIRED)
+find_package(cpr CONFIG REQUIRED)
+find_package(curl CONFIG REQUIRED)
+find_package(cxxopts CONFIG REQUIRED)
+find_package(doctest CONFIG REQUIRED)
+find_package(fmt CONFIG REQUIRED)
+find_package(gsl-lite CONFIG REQUIRED)
+find_package(unofficial-http-parser CONFIG REQUIRED)
+find_package(json11 CONFIG REQUIRED)
+find_package(lua CONFIG REQUIRED)
+find_package(lz4 CONFIG REQUIRED)
+find_package(ryml CONFIG REQUIRED)
+find_package(c4core CONFIG REQUIRED)
+find_package(tsl-robin-map CONFIG REQUIRED)
+find_package(sol2 CONFIG REQUIRED)
+find_package(spdlog CONFIG REQUIRED)
+find_package(xxhash CONFIG REQUIRED)
+find_package(mimalloc CONFIG REQUIRED)
+find_package(sentry CONFIG REQUIRED)
+
+set(RB ${CMAKE_SOURCE_DIR})
+set(R ${CMAKE_SOURCE_DIR}/src)
+
+set(VERSION "0.0.0")
+set(VERSION_MAJOR 0)
+set(VERSION_MINOR 0)
+set(VERSION_ALTER 0)
+set(VERSION_BUILD 0)
+set(GIT_BRANCH "di")
+set(GIT_COMMIT "hello")
+set(ZEN_SCHEMA_VERSION 5)
+
+configure_file(${R}/zencore/include/zencore/config.h.in ${R}/zencore/include/zencore/config.h)
+
+file(GLOB_RECURSE SRC
+ ${R}/zencore/**.cpp
+ ${R}/zenhttp/**.cpp
+ ${R}/zennet/**.cpp
+ ${R}/zenserver/**.cpp
+ ${R}/zenstore/**.cpp
+ ${R}/zenutil/**.cpp
+ ${R}/zenvfs/**.cpp
+)
+
+add_executable(zenserver ${SRC})
+
+target_include_directories(zenserver PRIVATE
+ ${R}/transports/transport-sdk/include
+ ${R}/zenbase
+ ${R}/zenbase/include
+ ${R}/zencore
+ ${R}/zencore/include
+ ${R}/zenhttp
+ ${R}/zenhttp/include
+ ${R}/zennet
+ ${R}/zennet/include
+ ${R}/zenstore
+ ${R}/zenstore/include
+ ${R}/zenutil
+ ${R}/zenutil/include
+ ${R}/zenvfs
+ ${R}/zenvfs/include
+ ${R}/zenserver
+ ${R}/zenserver/include
+ ${R}/zen
+ ${R}/zen/include
+ ${RB}/thirdparty/utfcpp/source
+ ${RB}/thirdparty/Oodle/include
+ ${RB}/thirdparty/trace
+)
+
+target_link_directories(zenserver PRIVATE ${RB}/thirdparty/Oodle/lib/Win64)
+
+target_link_libraries(zenserver PRIVATE
+ asio::asio
+ BLAKE3::blake3
+ cpr::cpr
+ CURL::libcurl_static
+ cxxopts::cxxopts
+ doctest::doctest
+ fmt::fmt
+ unofficial::http_parser::http_parser
+ ${JSON11_LIBRARIES}
+ lua
+ lz4::lz4
+ ryml::ryml
+ c4core::c4core
+ xxHash::xxhash
+ mimalloc-static
+ sentry::sentry
+
+ Advapi32
+ Dbghelp
+ Shell32
+ User32
+ crypt32
+ bcrypt
+ ws2_32
+ projectedfslib
+
+ oo2core_win64
+)
diff --git a/CMakePresets.json b/CMakePresets.json
new file mode 100644
index 000000000..0df64bf21
--- /dev/null
+++ b/CMakePresets.json
@@ -0,0 +1,13 @@
+{
+ "version": 2,
+ "configurePresets": [
+ {
+ "name": "vcpkg",
+ "generator": "Ninja",
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "CMAKE_TOOLCHAIN_FILE": "D:/P4/_vcpkg/scripts/buildsystems/vcpkg.cmake"
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/src/zencore/logging.cpp b/src/zencore/logging.cpp
index 1a0a91b3d..3ea291102 100644
--- a/src/zencore/logging.cpp
+++ b/src/zencore/logging.cpp
@@ -14,6 +14,7 @@ ZEN_THIRD_PARTY_INCLUDES_START
ZEN_THIRD_PARTY_INCLUDES_END
#if ZEN_PLATFORM_WINDOWS
+#include <windows.h>
# pragma section(".zlog$a", read)
# pragma section(".zlog$f", read)
# pragma section(".zlog$m", read)
diff --git a/src/zenserver/projectstore/httpprojectstore.cpp b/src/zenserver/projectstore/httpprojectstore.cpp
index cffd2569f..a72aa627d 100644
--- a/src/zenserver/projectstore/httpprojectstore.cpp
+++ b/src/zenserver/projectstore/httpprojectstore.cpp
@@ -1482,14 +1482,14 @@ HttpProjectService::HandleOpLogEntriesRequest(HttpRouterRequest& Req)
ProjectStore::Oplog::Paging EntryPaging;
if (std::string_view Param = Params.GetValue("start"); !Param.empty())
{
- if (auto Value = ParseInt<int32>(Param))
+ if (auto Value = ParseInt<int32_t>(Param))
{
EntryPaging.Start = *Value;
}
}
if (std::string_view Param = Params.GetValue("count"); !Param.empty())
{
- if (auto Value = ParseInt<int32>(Param))
+ if (auto Value = ParseInt<int32_t>(Param))
{
EntryPaging.Count = *Value;
}
diff --git a/src/zenstore/cache/structuredcachestore.cpp b/src/zenstore/cache/structuredcachestore.cpp
index ac8b70c1c..cd40cb7fa 100644
--- a/src/zenstore/cache/structuredcachestore.cpp
+++ b/src/zenstore/cache/structuredcachestore.cpp
@@ -85,7 +85,7 @@ ValidateIoBuffer(ZenContentType ContentType, IoBuffer Buffer)
uint64_t RawSize = 0;
if (!CompressedBuffer::ValidateCompressedHeader(MemoryBuffer, /* out */ HeaderRawHash, /* out */ RawSize))
{
- ZEN_SCOPED_ERROR("compressed buffer header validation failed");
+ ZEN_ERROR("compressed buffer header validation failed");
return false;
}
diff --git a/src/zenutil/include/zenutil/logging/fullformatter.h b/src/zenutil/include/zenutil/logging/fullformatter.h
index d4a04d3e5..3f5924e04 100644
--- a/src/zenutil/include/zenutil/logging/fullformatter.h
+++ b/src/zenutil/include/zenutil/logging/fullformatter.h
@@ -8,7 +8,9 @@
ZEN_THIRD_PARTY_INCLUDES_START
#include <spdlog/formatter.h>
+#include <spdlog/details/fmt_helper.h>
#include <spdlog/pattern_formatter.h>
+#include <spdlog/pattern_formatter-inl.h>
ZEN_THIRD_PARTY_INCLUDES_END
namespace zen::logging {
diff --git a/src/zenutil/include/zenutil/logging/rotatingfilesink.h b/src/zenutil/include/zenutil/logging/rotatingfilesink.h
index ca4649ba8..56804cf34 100644
--- a/src/zenutil/include/zenutil/logging/rotatingfilesink.h
+++ b/src/zenutil/include/zenutil/logging/rotatingfilesink.h
@@ -7,6 +7,7 @@
ZEN_THIRD_PARTY_INCLUDES_START
#include <spdlog/details/log_msg.h>
#include <spdlog/sinks/base_sink.h>
+#include <spdlog/pattern_formatter.h>
ZEN_THIRD_PARTY_INCLUDES_END
#include <filesystem>
diff --git a/vcpkg.json b/vcpkg.json
new file mode 100644
index 000000000..8e9bb9f0d
--- /dev/null
+++ b/vcpkg.json
@@ -0,0 +1,26 @@
+{
+ "dependencies":
+ [
+ "asio",
+ "blake3",
+ "cpr",
+ "curl",
+ "cxxopts",
+ "doctest",
+ "fmt",
+ "gsl-lite",
+ "http-parser",
+ "json11",
+ "lua",
+ "lz4",
+ "ryml",
+ "c4core",
+ "robin-map",
+ "sol2",
+ "spdlog",
+ "xxhash",
+ "zlib",
+ "mimalloc",
+ "sentry-native"
+ ]
+} \ No newline at end of file