From 8969351cba0e4a7ed91715121391f9786c2e6345 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Fri, 23 Feb 2024 21:29:08 +0000 Subject: [PATCH] core: Add libc++ compatibility (#73) src/renderer/AsyncResourceGatherer.cpp:98:22: error: no viable overloaded '+=' 98 | progress += 1.0 / (preloads + 1.0); | ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~ src/renderer/widgets/IWidget.cpp:41:44: error: no member named 'current_zone' in namespace 'std::chrono' 41 | const auto current_zone = std::chrono::current_zone(); | ~~~~~~~~~~~~~^ --- src/renderer/AsyncResourceGatherer.cpp | 4 ++++ src/renderer/widgets/IWidget.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/renderer/AsyncResourceGatherer.cpp b/src/renderer/AsyncResourceGatherer.cpp index f4dccdb..81bf029 100644 --- a/src/renderer/AsyncResourceGatherer.cpp +++ b/src/renderer/AsyncResourceGatherer.cpp @@ -95,7 +95,11 @@ void CAsyncResourceGatherer::gather() { progress = 0; for (auto& c : CWIDGETS) { if (c.type == "background") { +#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 180100 + progress = progress + 1.0 / (preloads + 1.0); +#else progress += 1.0 / (preloads + 1.0); +#endif std::string path = std::any_cast(c.values.at("path")); diff --git a/src/renderer/widgets/IWidget.cpp b/src/renderer/widgets/IWidget.cpp index 053d021..92a6161 100644 --- a/src/renderer/widgets/IWidget.cpp +++ b/src/renderer/widgets/IWidget.cpp @@ -4,6 +4,16 @@ #include #include +#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 190100 +#pragma comment(lib, "date-tz") +#include +namespace std { + namespace chrono { + using date::current_zone; + } +} +#endif + Vector2D IWidget::posFromHVAlign(const Vector2D& viewport, const Vector2D& size, const Vector2D& offset, const std::string& halign, const std::string& valign) { Vector2D pos = offset; if (halign == "center")