Update
Some checks failed
cserver CMake / tidy (push) Has been cancelled
cserver CMake / format (push) Has been cancelled
cserver CMake / build (Release, clang-18, clang++-18, ubuntu-24.04) (push) Has been cancelled
cserver CMake / build (Release, gcc-14, g++-14, ubuntu-24.04) (push) Has been cancelled

This commit is contained in:
sha512sum 2024-08-30 09:07:59 +00:00
parent 42a15457ec
commit 79ac12a4d7
4 changed files with 11 additions and 2 deletions

2
.gitignore vendored
View file

@ -18,3 +18,5 @@ cmake/CPM.cmake
cpm-package-lock.cmake
include/openssl
include/tls.h
libcserver_shared.so
libcserver_static.a

View file

@ -7,6 +7,7 @@ set(CXX_EXTENSIONS NO)
set(Boost_USE_MULTITHREADED ON)
set(BOOST_NOT_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED "url;program_options")
set(BOOST_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED "asio;pfr")
set(UTEMPL_MODULE OFF)
set(TRY_BOOST_VERSION "1.85.0")
set(BOOST_INCLUDE_LIBRARIES
"${BOOST_NOT_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED};${BOOST_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED}"
@ -14,6 +15,7 @@ set(BOOST_INCLUDE_LIBRARIES
option(CPM_USE_LOCAL_PACKAGES "Use local packages" ON)
option(CSERVER_USE_LIBRESSL "Use LibreSSL" OFF)
option(UTEMPL_USE_LOCAL_PACKAGE "Use utempl local package" OFF)
file(
DOWNLOAD
@ -69,11 +71,16 @@ CPMAddPackage(
endif()
set(TMP ${CPM_USE_LOCAL_PACKAGES})
set(CPM_USE_LOCAL_PACKAGES ${UTEMPL_USE_LOCAL_PACKAGE})
CPMAddPackage(
NAME utempl
URL "https://github.com/linuxnyasha/utempl/archive/refs/heads/main.zip"
EXCLUDE_FROM_ALL ON
OPTIONS "ENABLE_TESTS OFF" "ENABLE_EXAMPLES OFF"
)
set(CPM_USE_LOCAL_PACKAGES ${TMP})

View file

@ -5,7 +5,7 @@
struct SomeStruct {
static_assert(utempl::OpenStruct<SomeStruct>());
utempl::FieldAttribute<std::string, cserver::cli::Name<"field,f">> field;
utempl::FieldAttribute<std::string, utempl::TypeList<cserver::cli::Name<"field,f">>> field;
static_assert(utempl::CloseStruct<SomeStruct>());
};

View file

@ -78,7 +78,7 @@ struct Manager {
if(this->variableMap.count(name.begin())) {
return this->variableMap[name.begin()].template as<typename decltype(fieldConfig)::Type>();
};
throw std::runtime_error(fmt::format("Not found cli option {}", name));
throw std::runtime_error(fmt::format("Not found cli option {}", name.begin()));
}()...};
} | utempl::kSeq<utempl::kTupleSize<decltype(fieldConfigs)>>;
};