Skip to content

Commit 8825648

Browse files
committed
Use the fmt inside spdlog if using spdlog
1 parent 59bf098 commit 8825648

File tree

5 files changed

+28
-16
lines changed

5 files changed

+28
-16
lines changed

CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,17 @@ if(KOMPUTE_OPT_USE_SPDLOG)
183183
else()
184184
find_package(spdlog REQUIRED)
185185
endif()
186-
endif()
187-
188-
# fmt
189-
if(KOMPUTE_OPT_USE_BUILT_IN_FMT)
190-
set(FMT_INSTALL ${KOMPUTE_OPT_INSTALL})
191-
FetchContent_Declare(fmt GIT_REPOSITORY https://github.com/fmtlib/fmt.git
192-
GIT_TAG 11.0.0
193-
GIT_SHALLOW 1) # Source: https://github.com/fmtlib/fmt/releases
194-
FetchContent_MakeAvailable(fmt)
195186
else()
196-
find_package(fmt REQUIRED)
187+
# fmt
188+
if(KOMPUTE_OPT_USE_BUILT_IN_FMT)
189+
set(FMT_INSTALL ${KOMPUTE_OPT_INSTALL})
190+
FetchContent_Declare(fmt GIT_REPOSITORY https://github.com/fmtlib/fmt.git
191+
GIT_TAG 11.0.0
192+
GIT_SHALLOW 1) # Source: https://github.com/fmtlib/fmt/releases
193+
FetchContent_MakeAvailable(fmt)
194+
else()
195+
find_package(fmt REQUIRED)
196+
endif()
197197
endif()
198198

199199
# GoogleTest

src/CMakeLists.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,11 @@ if(KOMPUTE_OPT_ANDROID_BUILD)
6767
target_link_libraries(kompute PUBLIC vulkanAndroid
6868
android
6969
kp_logger
70-
kp_shader
71-
fmt::fmt)
70+
kp_shader)
7271
else()
7372
target_link_libraries(kompute PUBLIC Vulkan::Vulkan
7473
kp_logger
75-
kp_shader
76-
fmt::fmt)
74+
kp_shader)
7775
endif()
7876

7977
if(KOMPUTE_OPT_BUILD_PYTHON)
@@ -94,7 +92,7 @@ add_subdirectory(shaders)
9492
add_subdirectory(include)
9593

9694
if(KOMPUTE_OPT_INSTALL)
97-
if (KOMPUTE_OPT_USE_BUILT_IN_FMT)
95+
if (NOT KOMPUTE_OPT_USE_SPDLOG AND KOMPUTE_OPT_USE_BUILT_IN_FMT)
9896
# We can't export fmt::fmt because it's alias target, so we unwrap the alias and install it.
9997
get_target_property(fmt_aliased_target fmt::fmt ALIASED_TARGET)
10098
install(TARGETS ${fmt_aliased_target}

src/Manager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@
22

33
#include "kompute/Manager.hpp"
44
#include "kompute/logger/Logger.hpp"
5+
#if KOMPUTE_OPT_USE_SPDLOG
6+
#include <spdlog/fmt/fmt.h>
7+
#include <spdlog/fmt/ranges.h>
8+
#else
59
#include <fmt/core.h>
610
#include <fmt/ranges.h>
11+
#endif
712
#include <iterator>
813
#include <set>
914
#include <sstream>

src/Memory.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
#include "kompute/Memory.hpp"
44
#include "kompute/Image.hpp"
55
#include "kompute/Tensor.hpp"
6+
#if KOMPUTE_OPT_USE_SPDLOG
7+
#include <spdlog/fmt/fmt.h>
8+
#else
69
#include <fmt/core.h>
10+
#endif
711

812
namespace kp {
913

src/include/kompute/Algorithm.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33

44
#include "kompute/Core.hpp"
55

6-
#include "fmt/format.h"
6+
#if KOMPUTE_OPT_USE_SPDLOG
7+
#include <spdlog/fmt/fmt.h>
8+
#else
9+
#include <fmt/format.h>
10+
#endif
11+
712
#include "kompute/Tensor.hpp"
813
#include "logger/Logger.hpp"
914

0 commit comments

Comments
 (0)