summarylogtreecommitdiffstats
path: root/fmt-v10.patch
blob: fd1dfc77be0dc43a55148d0e3cab88cee3cc0140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
diff --git a/3rdparty/fmt/fmt.cmake b/3rdparty/fmt/fmt.cmake
index 88cd8e2fc..24dae557c 100644
--- a/3rdparty/fmt/fmt.cmake
+++ b/3rdparty/fmt/fmt.cmake
@@ -2,16 +2,16 @@ include(ExternalProject)
 
 set(FMT_LIB_NAME fmt)
 
-if (MSVC OR CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
+if (MSVC)
     # MSVC has errors when building fmt >6, up till 9.1
     # SYCL / DPC++ needs fmt ver <=6 or >= 9.2: https://github.com/fmtlib/fmt/issues/3005
     set(FMT_VER "6.0.0")
     set(FMT_SHA256
         "f1907a58d5e86e6c382e51441d92ad9e23aea63827ba47fd647eacc0d3a16c78")
 else()
-    set(FMT_VER "9.0.0")
+    set(FMT_VER "10.2.1")
     set(FMT_SHA256
-        "9a1e0e9e843a356d65c7604e2c8bf9402b50fe294c355de0095ebd42fb9bd2c5")
+        "1250e4cc58bf06ee631567523f48848dc4596133e163f02615c97f78bab6c811")
 endif()
 
 ExternalProject_Add(
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b68b0bdbd..9b0d48b1e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,7 @@
 -   Fix log error message for `probability` argument validation in `PointCloud::SegmentPlane` (PR #6622)
 -   Fix macOS arm64 builds, add CI runner for macOS arm64 (PR #6695)
 -   Fix KDTreeFlann possibly using a dangling pointer instead of internal storage and simplified its members (PR #6734)
+-   Fix build with fmt v10.2.0 (#6783)
 
 ## 0.13
 
diff --git a/cpp/open3d/core/DLPack.h b/cpp/open3d/core/DLPack.h
index 9a0c3e57a..1cec10a71 100644
--- a/cpp/open3d/core/DLPack.h
+++ b/cpp/open3d/core/DLPack.h
@@ -188,4 +188,56 @@ typedef struct DLManagedTensor {
 #ifdef __cplusplus
 }  // DLPACK_EXTERN_C
 #endif
+
+#include <fmt/core.h>
+#include <fmt/format.h>
+
+namespace fmt {
+
+template <>
+struct formatter<DLDeviceType> {
+    template <typename FormatContext>
+    auto format(const DLDeviceType& c, FormatContext& ctx) const
+            -> decltype(ctx.out()) {
+        const char* text = nullptr;
+        switch (c) {
+            case kDLCPU:
+                text = "kDLCPU";
+                break;
+            case kDLGPU:
+                text = "kDLGPU";
+                break;
+            case kDLCPUPinned:
+                text = "kDLCPUPinned";
+                break;
+            case kDLOpenCL:
+                text = "kDLOpenCL";
+                break;
+            case kDLVulkan:
+                text = "kDLVulkan";
+                break;
+            case kDLMetal:
+                text = "kDLMetal";
+                break;
+            case kDLVPI:
+                text = "kDLVPI";
+                break;
+            case kDLROCM:
+                text = "kDLROCM";
+                break;
+            case kDLExtDev:
+                text = "kDLExtDev";
+                break;
+        }
+        return format_to(ctx.out(), text);
+    }
+
+    template <typename ParseContext>
+    constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
+        return ctx.begin();
+    }
+};
+
+}  // namespace fmt
+
 #endif  // DLPACK_DLPACK_H_
diff --git a/cpp/open3d/io/IJsonConvertibleIO.h b/cpp/open3d/io/IJsonConvertibleIO.h
index 8bc9f03b1..a366b4f5e 100644
--- a/cpp/open3d/io/IJsonConvertibleIO.h
+++ b/cpp/open3d/io/IJsonConvertibleIO.h
@@ -82,7 +82,7 @@ bool WriteIJsonConvertibleToJSONString(std::string &json_string,
                 [&str](const std::pair<ENUM_TYPE, std::string> &es_pair)  \
                         -> bool { return es_pair.second == str; });       \
         e = ((it != std::end(m)) ? it : std::begin(m))->first;            \
-        utility::LogDebug("{} -> {}", str, e);                            \
+        utility::LogDebug("{} -> {}", str, enum_to_string(e));            \
     }
 
 }  // namespace io
diff --git a/cpp/open3d/t/geometry/RaycastingScene.cpp b/cpp/open3d/t/geometry/RaycastingScene.cpp
index 14f9962c2..8906f6373 100644
--- a/cpp/open3d/t/geometry/RaycastingScene.cpp
+++ b/cpp/open3d/t/geometry/RaycastingScene.cpp
@@ -1173,4 +1173,44 @@ uint32_t RaycastingScene::INVALID_ID() { return RTC_INVALID_GEOMETRY_ID; }
 
 }  // namespace geometry
 }  // namespace t
-}  // namespace open3d
\ No newline at end of file
+}  // namespace open3d
+
+namespace fmt {
+template <>
+struct formatter<RTCError> {
+    template <typename FormatContext>
+    auto format(const RTCError& c, FormatContext& ctx) {
+        const char* name = nullptr;
+        switch (c) {
+            case RTC_ERROR_NONE:
+                name = "RTC_ERROR_NONE";
+                break;
+            case RTC_ERROR_UNKNOWN:
+                name = "RTC_ERROR_UNKNOWN";
+                break;
+            case RTC_ERROR_INVALID_ARGUMENT:
+                name = "RTC_ERROR_INVALID_ARGUMENT";
+                break;
+            case RTC_ERROR_INVALID_OPERATION:
+                name = "RTC_ERROR_INVALID_OPERATION";
+                break;
+            case RTC_ERROR_OUT_OF_MEMORY:
+                name = "RTC_ERROR_OUT_OF_MEMORY";
+                break;
+            case RTC_ERROR_UNSUPPORTED_CPU:
+                name = "RTC_ERROR_UNSUPPORTED_CPU";
+                break;
+            case RTC_ERROR_CANCELLED:
+                name = "RTC_ERROR_CANCELLED";
+                break;
+        }
+        // return formatter<string_view>::format(name, ctx);
+        return format_to(ctx.out(), name);
+    }
+
+    template <typename ParseContext>
+    constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
+        return ctx.begin();
+    }
+};
+}  // namespace fmt
diff --git a/cpp/open3d/t/io/sensor/realsense/RSBagReader.cpp b/cpp/open3d/t/io/sensor/realsense/RSBagReader.cpp
index 356fdbed6..990b948ee 100644
--- a/cpp/open3d/t/io/sensor/realsense/RSBagReader.cpp
+++ b/cpp/open3d/t/io/sensor/realsense/RSBagReader.cpp
@@ -7,6 +7,7 @@
 
 #include "open3d/t/io/sensor/realsense/RSBagReader.h"
 
+#include <fmt/std.h>
 #include <json/json.h>
 
 #include <chrono>
diff --git a/cpp/open3d/visualization/webrtc_server/PeerConnectionManager.h b/cpp/open3d/visualization/webrtc_server/PeerConnectionManager.h
index ceb0fc9df..8ef27e79a 100644
--- a/cpp/open3d/visualization/webrtc_server/PeerConnectionManager.h
+++ b/cpp/open3d/visualization/webrtc_server/PeerConnectionManager.h
@@ -456,3 +456,45 @@ protected:
 }  // namespace webrtc_server
 }  // namespace visualization
 }  // namespace open3d
+
+namespace fmt {
+
+template <>
+struct formatter<webrtc::PeerConnectionInterface::SignalingState> {
+    template <typename FormatContext>
+    auto format(const webrtc::PeerConnectionInterface::SignalingState& state,
+                FormatContext& ctx) const -> decltype(ctx.out()) {
+        using namespace webrtc;
+        const char* text = nullptr;
+        switch (state) {
+            case PeerConnectionInterface::SignalingState::kStable:
+                text = "kStable";
+                break;
+            case PeerConnectionInterface::SignalingState::kHaveLocalOffer:
+                text = "kHaveLocalOffer";
+                break;
+            case PeerConnectionInterface::SignalingState::kHaveLocalPrAnswer:
+                text = "kHaveLocalPrAnswer";
+                break;
+            case PeerConnectionInterface::SignalingState::kHaveRemoteOffer:
+                text = "kHaveRemoteOffer";
+                break;
+            case PeerConnectionInterface::SignalingState::kHaveRemotePrAnswer:
+                text = "kHaveRemotePrAnswer";
+                break;
+            case PeerConnectionInterface::SignalingState::kClosed:
+                text = "kClosed";
+                break;
+            default:
+                text = "unknown";
+        }
+        return format_to(ctx.out(), "{}", text);
+    }
+
+    template <typename ParseContext>
+    constexpr auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
+        return ctx.begin();
+    }
+};
+
+}  // namespace fmt
diff --git a/examples/cpp/OnlineSLAMUtil.h b/examples/cpp/OnlineSLAMUtil.h
index 585f18a8f..ecb2d0b52 100644
--- a/examples/cpp/OnlineSLAMUtil.h
+++ b/examples/cpp/OnlineSLAMUtil.h
@@ -5,6 +5,8 @@
 // SPDX-License-Identifier: MIT
 // ----------------------------------------------------------------------------
 
+#include <fmt/std.h>
+
 #include <atomic>
 #include <sstream>
 #include <thread>