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
|
See PR pending https://github.com/libsidplayfp/sidplayfp/pull/135.patch
add --with-system-fmt option (disabled by default)
move bundled fmt into fmt_contrib to avoid conflicts
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,23 +26,29 @@ src/stilview
#=========================================================
#fmt
+if USE_SYSTEM_FMT
+AM_CPPFLAGS += $(FMT_CFLAGS)
+fmt_SOURCES =
+else
+AM_CPPFLAGS += -I $(top_srcdir)/libs/fmt_internal
fmt_SOURCES = \
-libs/fmt/args.h \
-libs/fmt/base.h \
-libs/fmt/chrono.h \
-libs/fmt/color.h \
-libs/fmt/compile.h \
-libs/fmt/core.h \
-libs/fmt/format-inl.h \
-libs/fmt/format.cc \
-libs/fmt/format.h \
-libs/fmt/os.cc \
-libs/fmt/os.h \
-libs/fmt/ostream.h \
-libs/fmt/printf.h \
-libs/fmt/ranges.h \
-libs/fmt/std.h \
-libs/fmt/xchar.h
+libs/fmt_internal/fmt/args.h \
+libs/fmt_internal/fmt/base.h \
+libs/fmt_internal/fmt/chrono.h \
+libs/fmt_internal/fmt/color.h \
+libs/fmt_internal/fmt/compile.h \
+libs/fmt_internal/fmt/core.h \
+libs/fmt_internal/fmt/format-inl.h \
+libs/fmt_internal/fmt/format.cc \
+libs/fmt_internal/fmt/format.h \
+libs/fmt_internal/fmt/os.cc \
+libs/fmt_internal/fmt/os.h \
+libs/fmt_internal/fmt/ostream.h \
+libs/fmt_internal/fmt/printf.h \
+libs/fmt_internal/fmt/ranges.h \
+libs/fmt_internal/fmt/std.h \
+libs/fmt_internal/fmt/xchar.h
+endif
#=========================================================
# sidplayfp
@@ -95,7 +101,8 @@ $(PTHREAD_CFLAGS)
src_sidplayfp_LDADD = \
$(SIDPLAYFP_LIBS) \
$(W32_LIBS) \
-$(PTHREAD_LIBS)
+$(PTHREAD_LIBS) \
+$(FMT_LIBS)
#=========================================================
# stilview
@@ -107,7 +114,8 @@ src/codeConvert.h \
src/stilview.cpp
src_stilview_LDADD = \
-$(STILVIEW_LIBS)
+$(STILVIEW_LIBS) \
+$(FMT_LIBS)
#=========================================================
# docs
--- a/configure.ac
+++ b/configure.ac
@@ -94,6 +94,20 @@ AS_IF([test "x$enable_debug" = "xno"],
[AC_MSG_RESULT([yes])],
)
+AC_ARG_WITH([system-fmt], AS_HELP_STRING([--with-system-fmt], [use system fmt library instead of bundled version]),
+ [with_system_fmt=$withval],
+ [with_system_fmt=no]
+)
+
+AS_IF([test "x$with_system_fmt" = "xyes"], [
+ PKG_CHECK_MODULES([FMT], [fmt >= 11.0.0])
+ AC_DEFINE([USE_SYSTEM_FMT], [1], [Use system fmt])
+], [
+ AC_MSG_NOTICE([Using bundled fmt library])
+])
+
+AM_CONDITIONAL([USE_SYSTEM_FMT], [test "x$with_system_fmt" = "xyes"])
+
AC_SUBST([debug_flags])
AC_CONFIG_FILES([
--- a/src/IniConfig.cpp
+++ b/src/IniConfig.cpp
@@ -25,7 +25,7 @@
#include "IniConfig.h"
-#include "fmt/format.h"
+#include <fmt/format.h>
#include <string>
--- a/src/args.cpp
+++ b/src/args.cpp
@@ -23,7 +23,8 @@
#include "dataParser.h"
#include "utils.h"
-#include "fmt/format.h"
+
+#include <fmt/format.h>
#include <iostream>
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -22,9 +22,10 @@
#include "player.h"
#include "codeConvert.h"
-#include "fmt/format.h"
+
+#include <fmt/format.h>
#if defined(_WIN32) && defined(UNICODE)
-# include "fmt/xchar.h"
+# include <fmt/xchar.h>
#endif
#include <cctype>
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -21,9 +21,10 @@
#include "player.h"
-#include "fmt/format.h"
#include "filesystem/filesystem.hpp"
+#include <fmt/format.h>
+
#include <cstdlib>
#include <cmath>
#include <cstring>
--- a/src/siddefines.h
+++ b/src/siddefines.h
@@ -22,7 +22,7 @@
#ifndef SIDDEFINES_H
#define SIDDEFINES_H
-#include "fmt/color.h"
+#include <fmt/color.h>
using color_t = fmt::terminal_color;
--- a/src/stilview.cpp
+++ b/src/stilview.cpp
@@ -23,7 +23,7 @@
// STILView - command line version
//
-#include "fmt/format.h"
+#include <fmt/format.h>
#include <fstream>
#include <iostream>
|