diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake
index e8944bf3294..0fa27e6493c 100644
--- a/cmake/compiler/clang/settings.cmake
+++ b/cmake/compiler/clang/settings.cmake
@@ -140,11 +140,12 @@ endif()
# -Wno-narrowing needed to suppress a warning in g3d
# -Wno-deprecated-register is needed to suppress 185 gsoap warnings on Unix systems.
-# -Wno-deprecated-copy needed to suppress a warning in g3d
+# -Wno-undefined-inline needed for a compile time optimization hack with fmt
target_compile_options(trinity-compile-option-interface
INTERFACE
-Wno-narrowing
- -Wno-deprecated-register)
+ -Wno-deprecated-register
+ -Wno-undefined-inline)
if(BUILD_SHARED_LIBS)
# -fPIC is needed to allow static linking in shared libs.
diff --git a/src/common/Utilities/StringFormat.cpp b/src/common/Utilities/StringFormat.cpp
new file mode 100644
index 00000000000..9550294fd64
--- /dev/null
+++ b/src/common/Utilities/StringFormat.cpp
@@ -0,0 +1,47 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "StringFormat.h"
+#include "Define.h"
+#include
+
+// explicit template instantiations
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter;
+template struct TC_COMMON_API fmt::formatter>;
+
+template TC_COMMON_API fmt::appender fmt::formatter::format(int const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(unsigned const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(long long const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(unsigned long long const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(bool const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(char const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(float const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(double const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(long double const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(char const* const&, format_context&) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(void const* const&, format_context &) const;
+template TC_COMMON_API fmt::appender fmt::formatter::format(string_view const&, format_context &) const;
diff --git a/src/common/Utilities/StringFormat.h b/src/common/Utilities/StringFormat.h
index d34528a04df..fd31ddc28d5 100644
--- a/src/common/Utilities/StringFormat.h
+++ b/src/common/Utilities/StringFormat.h
@@ -18,7 +18,8 @@
#ifndef TRINITYCORE_STRING_FORMAT_H
#define TRINITYCORE_STRING_FORMAT_H
-#include "fmt/core.h"
+#include "Optional.h"
+#include
namespace Trinity
{
@@ -108,4 +109,17 @@ namespace Trinity
}
}
+template
+struct fmt::formatter, Char> : formatter
+{
+ template
+ auto format(Optional const& value, FormatContext& ctx) const -> decltype(ctx.out())
+ {
+ if (value.has_value())
+ return formatter::format(*value, ctx);
+
+ return formatter().format("(nullopt)", ctx);
+ }
+};
+
#endif