diff --git a/CMakeLists.txt b/CMakeLists.txt index 214decf..661288f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ find_package(Boost 1.84.0 REQUIRED COMPONENTS url program_options) find_package(utempl REQUIRED) find_package(llhttp REQUIRED) find_package(OpenSSL REQUIRED) +find_package(nameof REQUIRED) + cmake_policy(SET CMP0079 NEW) @@ -19,7 +21,7 @@ target_include_directories( cserver INTERFACE $ $) -target_link_libraries(cserver INTERFACE utempl::utempl ${Boost_LIBRARIES} llhttp ${OPENSSL_LIBRARIES} ) +target_link_libraries(cserver INTERFACE utempl::utempl nameof::nameof ${Boost_LIBRARIES} llhttp ${OPENSSL_LIBRARIES} ) target_compile_features(cserver INTERFACE cxx_std_23) diff --git a/include/cserver/components/cli/manager.hpp b/include/cserver/components/cli/manager.hpp index f9df5f5..7a96db5 100644 --- a/include/cserver/components/cli/manager.hpp +++ b/include/cserver/components/cli/manager.hpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include namespace cserver::cli { @@ -44,7 +44,7 @@ struct Manager { ([&]{ using Current = decltype(Configs)::Type; boost::program_options::options_description desc(fmt::format("{} options", - boost::typeindex::type_id().pretty_name())); + NAMEOF_TYPE(Current))); utempl::Unpack(utempl::PackConstexprWrapper(), [&](auto... vs) { auto&& add = desc.add_options(); ([&]{ diff --git a/tests/all_meta.cpp b/tests/all_meta.cpp index e239a21..562c236 100644 --- a/tests/all_meta.cpp +++ b/tests/all_meta.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include COMPONENT_REQUIRES(Some, requires(T t){{t.f()} -> std::same_as;}); @@ -42,8 +42,8 @@ TEST(Meta, AllDependencies) { .GetContextFor>() .FindAllComponents()); - EXPECT_EQ(boost::typeindex::type_id().pretty_name(), - boost::typeindex::type_id().pretty_name()); + EXPECT_EQ(NAMEOF_TYPE(R), + NAMEOF_TYPE(Need)); using DependenciesNeed = const cserver::DependencyGraph< cserver::DependencyGraphElement< @@ -56,6 +56,6 @@ TEST(Meta, AllDependencies) { "some", {utempl::ConstexprString{"other"}, utempl::ConstexprString{"other2"}}>>; - EXPECT_EQ(boost::typeindex::type_id().pretty_name(), - boost::typeindex::type_id().pretty_name()); + EXPECT_EQ(NAMEOF_TYPE(decltype(dependencies)), + NAMEOF_TYPE(DependenciesNeed)); }; diff --git a/tests/dependencies.cpp b/tests/dependencies.cpp index 34cbf1f..723b977 100644 --- a/tests/dependencies.cpp +++ b/tests/dependencies.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include struct SomeComponent { static constexpr utempl::ConstexprString kName = "some"; @@ -30,6 +30,6 @@ TEST(Dependencies, Get) { cserver::DependencyGraphElement< "other", {utempl::ConstexprString{"some"}}>>; - EXPECT_EQ(boost::typeindex::type_id().pretty_name(), - boost::typeindex::type_id().pretty_name()); + EXPECT_EQ(NAMEOF_TYPE(decltype(dependencies)), + NAMEOF_TYPE(Need)); }; diff --git a/tests/meta.cpp b/tests/meta.cpp index 7b6a2fb..160c313 100644 --- a/tests/meta.cpp +++ b/tests/meta.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include COMPONENT_REQUIRES(Some, requires(T t){{t.f()} -> std::same_as;}); @@ -43,8 +43,8 @@ TEST(Meta, OneDependency) { "other2", {}>>; - EXPECT_EQ(boost::typeindex::type_id().pretty_name(), - boost::typeindex::type_id().pretty_name()); + EXPECT_EQ(NAMEOF_TYPE(decltype(dependencies)), + NAMEOF_TYPE(Need)); }; struct SomeStruct2 {