Skip to content

Commit f4bc5f2

Browse files
authored
Fmt spdlog update (#147)
This PR addresses the clang compilation issue by updating `fmt` and `spdlog` to the latest version and implementing the necessary changes.
1 parent f5cf25e commit f4bc5f2

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

cmake/fmt.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set(FMT_INSTALL YES)
1717
FetchContent_Declare(
1818
fmt
1919
GIT_REPOSITORY https://github.com/fmtlib/fmt
20-
GIT_TAG 10.1.1
20+
GIT_TAG 11.2.0
2121
)
2222
FetchContent_MakeAvailable(fmt)
2323
target_link_libraries(${SVS_LIB} INTERFACE fmt::fmt)

cmake/spdlog.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ set(SPDLOG_FMT_EXTERNAL YES CACHE BOOL "" FORCE)
3232
FetchContent_Declare(
3333
spdlog
3434
GIT_REPOSITORY https://github.com/gabime/spdlog
35-
GIT_TAG v1.13.0
35+
GIT_TAG v1.15.3
3636
)
3737
FetchContent_MakeAvailable(spdlog)
3838
target_link_libraries(${SVS_LIB} INTERFACE spdlog::spdlog)

include/svs/lib/threads/types.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,16 @@ DynamicPartition(const R&, size_t) -> DynamicPartition<typename R::const_iterato
430430
} // namespace threads
431431
} // namespace svs
432432

433-
///// Formatting
434-
template <typename T>
435-
struct fmt::formatter<svs::threads::UnitRange<T>> : svs::format_empty {
436-
auto format(const svs::threads::UnitRange<T>& x, auto& ctx) const {
437-
return fmt::format_to(
438-
ctx.out(), "UnitRange<{}>({}, {})", svs::datatype_v<T>, x.start(), x.stop()
439-
);
440-
}
441-
};
433+
// Clang-18+ fails to compile the following code.
434+
// The related fmt issue can be found here: https://github.com/gabime/spdlog/issues/3333
435+
// Comment out the code until the issue is resolved in an upcoming fmt update
436+
// Related test: tests/svs/lib/threads/types.cpp::printing
437+
// Formatting
438+
//template <typename T>
439+
//struct fmt::formatter<svs::threads::UnitRange<T>> : svs::format_empty {
440+
//auto format(const svs::threads::UnitRange<T>& x, auto& ctx) const {
441+
//return fmt::format_to(
442+
//ctx.out(), "UnitRange<{}>({}, {})", svs::datatype_v<T>, x.start(), x.stop()
443+
//);
444+
//}
445+
//};

include/svs/third-party/fmt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "fmt/core.h"
2121
#include "fmt/format.h"
2222
#include "fmt/std.h"
23+
#include "fmt/ranges.h"
2324

2425
// stl
2526
#include <string_view>

tests/svs/lib/threads/types.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ CATCH_TEST_CASE("Thread Helper Types", "[core][threads]") {
200200
CATCH_REQUIRE(*(r.end() - 1) == 99);
201201
}
202202

203-
CATCH_SECTION("Printing") {
204-
auto range = svs::threads::UnitRange<size_t>(100, 200);
205-
auto repr = fmt::format("{}", range);
206-
CATCH_REQUIRE(repr == "UnitRange<uint64>(100, 200)");
207-
}
203+
//CATCH_SECTION("Printing") {
204+
//auto range = svs::threads::UnitRange<size_t>(100, 200);
205+
//auto repr = fmt::format("{}", range);
206+
//CATCH_REQUIRE(repr == "UnitRange<uint64>(100, 200)");
207+
//}
208208

209209
CATCH_SECTION("Indexing") {
210210
auto range = svs::threads::UnitRange(100, 200);

0 commit comments

Comments
 (0)