diff --git a/CMakeLists.txt b/CMakeLists.txt index 09df994..18c1b45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ else () add_library(${PROJECT_NAME} STATIC ${OMATH_SOURCES} ${OMATH_HEADERS}) endif () + add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) target_compile_definitions(${PROJECT_NAME} PUBLIC OMATH_VERSION="${PROJECT_VERSION}") diff --git a/extlibs/CMakeLists.txt b/extlibs/CMakeLists.txt index fbf19d3..3ed280f 100644 --- a/extlibs/CMakeLists.txt +++ b/extlibs/CMakeLists.txt @@ -4,5 +4,6 @@ if (OMATH_BUILD_TESTS) endif () if (OMATH_BUILD_BENCHMARK) -add_subdirectory(benchmark) -endif() \ No newline at end of file + set(BENCHMARK_ENABLE_TESTING OFF) + add_subdirectory(benchmark) +endif () \ No newline at end of file diff --git a/include/omath/color.hpp b/include/omath/color.hpp index e710a54..b606231 100644 --- a/include/omath/color.hpp +++ b/include/omath/color.hpp @@ -174,13 +174,30 @@ struct std::formatter // NOLINT(*-dcl58-cpp) { return ctx.begin(); } + + template [[nodiscard]] - static auto format(const omath::Color& col, std::format_context& ctx) + static auto format(const omath::Color& col, FormatContext& ctx) { - return std::format_to(ctx.out(), "[r:{}, g:{}, b:{}, a:{}]", - static_cast(col.x * 255.f), - static_cast(col.y * 255.f), - static_cast(col.z * 255.f), - static_cast(col.w * 255.f)); + if constexpr (std::is_same_v) + return std::format_to(ctx.out(), "[r:{}, g:{}, b:{}, a:{}]", + static_cast(col.x * 255.f), + static_cast(col.y * 255.f), + static_cast(col.z * 255.f), + static_cast(col.w * 255.f)); + if constexpr (std::is_same_v) + return std::format_to(ctx.out(), L"[r:{}, g:{}, b:{}, a:{}]", + static_cast(col.x * 255.f), + static_cast(col.y * 255.f), + static_cast(col.z * 255.f), + static_cast(col.w * 255.f)); + + if constexpr (std::is_same_v) + return std::format_to(ctx.out(), u8"[r:{}, g:{}, b:{}, a:{}]", + static_cast(col.x * 255.f), + static_cast(col.y * 255.f), + static_cast(col.z * 255.f), + static_cast(col.w * 255.f)); + std::unreachable(); } }; \ No newline at end of file