get it working on fmtlib 10.1.1

This commit is contained in:
mat 2023-12-29 20:59:06 -03:00
parent 6f66e47bed
commit 953e9504a0
2 changed files with 5 additions and 5 deletions
CMakeLists.txt
loader/include/Geode/loader

View file

@ -81,8 +81,7 @@ if (PROJECT_IS_TOP_LEVEL AND NOT GEODE_BUILDING_DOCS)
set(MAT_JSON_AS_INTERFACE ON)
endif()
CPMAddPackage("gh:geode-sdk/json#a47f570")
# be careful before updating this! see Log.hpp
CPMAddPackage("gh:fmtlib/fmt#10.0.0")
CPMAddPackage("gh:fmtlib/fmt#10.1.1")
CPMAddPackage("gh:gulrak/filesystem#3e5b930")
target_compile_definitions(${PROJECT_NAME} INTERFACE MAT_JSON_DYNAMIC=1)

View file

@ -23,8 +23,7 @@ namespace geode {
namespace geode::log::impl {
// What is this all for? well, fmtlib disallows writing custom formatters for non-void pointer types.
// So instead, we just wrap everything and pass it a string instead.
// WARNING: This code breaks in fmtlib 10.1.1! I have no idea why, so be careful before updating it.
template <class T>
GEODE_INLINE GEODE_HIDDEN decltype(auto) wrapCocosObj(T&& value) {
if constexpr (std::is_pointer_v<std::decay_t<T>> && requires(T ptr) { geode::format_as(ptr); }) {
@ -76,7 +75,9 @@ namespace geode {
template <typename... Args>
inline void logImpl(Severity severity, Mod* mod, impl::FmtStr<Args...> str, Args&&... args) {
vlogImpl(severity, mod, str, fmt::make_format_args(impl::wrapCocosObj(args)...));
[&]<typename... Ts>(Ts&&... args) {
vlogImpl(severity, mod, str, fmt::make_format_args(args...));
}(impl::wrapCocosObj(args)...);
}
template <typename... Args>