Skip to content

Commit 23bfacf

Browse files
committed
Revert "Improve LibFMT detection"
This reverts commit 9feaa6b. No, we do NOT support fmt 6.x, it formats values differently. And we MUST use FMT_HEADER_ONLY
1 parent 2d21917 commit 23bfacf

File tree

4 files changed

+9
-45
lines changed

4 files changed

+9
-45
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,4 +618,3 @@ tests/mariadb-client-test
618618
versioninfo_dll.rc
619619
versioninfo_exe.rc
620620
win/packaging/ca/symlinks.cc
621-
/_Deparsed_XSubs.pm

cmake/libfmt.cmake

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
INCLUDE (CheckCXXSourceCompiles)
2+
INCLUDE (ExternalProject)
13

24
SET(WITH_LIBFMT "auto" CACHE STRING
35
"Which libfmt to use (possible values are 'bundled', 'system', or 'auto')")
@@ -10,7 +12,6 @@ MACRO(BUNDLE_LIBFMT)
1012
SET(fmt_byproducts BUILD_BYPRODUCTS ${LIBFMT_INCLUDE_DIR}/fmt/format-inl.h)
1113
ENDIF()
1214

13-
INCLUDE (ExternalProject)
1415
ExternalProject_Add(
1516
libfmt
1617
PREFIX "${dir}"
@@ -25,42 +26,17 @@ ENDMACRO()
2526

2627
MACRO (CHECK_LIBFMT)
2728
IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto")
28-
FIND_PACKAGE(fmt)
29-
IF(fmt_FOUND)
30-
set(HAVE_SYSTEM_LIBFMT ${fmt_FOUND})
31-
ENDIF()
32-
33-
FIND_LIBRARY(FMT_LIB_FOUND fmt)
34-
IF(FMT_LIB_FOUND)
35-
set(FMT_LIBRARIES fmt CACHE STRING "LibFormat libraries" FORCE)
36-
ADD_DEFINITIONS(-DLINK_SYSTEM_LIBFMT)
37-
ELSE(FMT_LIB_FOUND)
38-
set(FMT_HEADER_ONLY "#define FMT_HEADER_ONLY 1")
39-
set(FMT_LIBRARIES "" CACHE STRING "LibFormat libraries" FORCE)
40-
ENDIF(FMT_LIB_FOUND)
41-
42-
INCLUDE (CheckCXXSourceCompiles)
4329
CHECK_CXX_SOURCE_COMPILES(
4430
"#define FMT_STATIC_THOUSANDS_SEPARATOR ','
45-
${FMT_HEADER_ONLY}
31+
#define FMT_HEADER_ONLY 1
4632
#include <fmt/format-inl.h>
4733
#include <iostream>
48-
#include <string>
49-
#if FMT_VERSION < 70000
50-
using namespace ::fmt::internal;
51-
#else
52-
using namespace ::fmt::detail;
53-
#endif
5434
int main() {
5535
fmt::format_args::format_arg arg=
5636
fmt::detail::make_arg<fmt::format_context>(42);
5737
std::cout << fmt::vformat(\"The answer is {}.\",
5838
fmt::format_args(&arg, 1));
59-
return 0;
6039
}" HAVE_SYSTEM_LIBFMT)
61-
IF (HAVE_SYSTEM_LIBFMT)
62-
ADD_DEFINITIONS(-DHAVE_SYSTEM_LIBFMT)
63-
ENDIF()
6440
ENDIF()
6541
IF(NOT HAVE_SYSTEM_LIBFMT OR WITH_LIBFMT STREQUAL "bundled")
6642
IF (WITH_LIBFMT STREQUAL "system")

sql/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ MAYBE_DISABLE_IPO(sql)
208208
DTRACE_INSTRUMENT(sql)
209209
TARGET_LINK_LIBRARIES(sql PUBLIC
210210
mysys mysys_ssl dbug strings vio pcre2-8
211-
${FMT_LIBRARIES}
212211
tpool
213212
${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
214213
${SSL_LIBRARIES}
@@ -278,7 +277,7 @@ IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
278277
ENDIF()
279278

280279
ADD_LIBRARY(sql_builtins STATIC ${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc)
281-
TARGET_LINK_LIBRARIES(sql_builtins PUBLIC ${MYSQLD_STATIC_PLUGIN_LIBS})
280+
TARGET_LINK_LIBRARIES(sql_builtins ${MYSQLD_STATIC_PLUGIN_LIBS})
282281

283282
MYSQL_ADD_EXECUTABLE(mariadbd ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server)
284283

sql/item_strfunc.cc

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,8 @@ C_MODE_END
5757

5858
/* fmtlib include (https://fmt.dev/). */
5959
#define FMT_STATIC_THOUSANDS_SEPARATOR ','
60-
#if !defined(HAVE_SYSTEM_LIBFMT) && !defined(LINK_SYSTEM_LIBFMT)
6160
#define FMT_HEADER_ONLY 1
62-
#endif
63-
64-
#include <fmt/format-inl.h>
65-
66-
#if FMT_VERSION < 70000
67-
using namespace ::fmt::internal;
68-
#else
69-
using namespace ::fmt::detail;
70-
#endif
71-
61+
#include "fmt/format-inl.h"
7262

7363
size_t username_char_length= USERNAME_CHAR_LENGTH;
7464

@@ -1403,22 +1393,22 @@ String *Item_func_sformat::val_str(String *res)
14031393
switch (args[carg]->result_type())
14041394
{
14051395
case INT_RESULT:
1406-
vargs[carg-1]= make_arg<ctx>(args[carg]->val_int());
1396+
vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_int());
14071397
break;
14081398
case DECIMAL_RESULT: // TODO
14091399
case REAL_RESULT:
14101400
if (args[carg]->field_type() == MYSQL_TYPE_FLOAT)
1411-
vargs[carg-1]= make_arg<ctx>((float)args[carg]->val_real());
1401+
vargs[carg-1]= fmt::detail::make_arg<ctx>((float)args[carg]->val_real());
14121402
else
1413-
vargs[carg-1]= make_arg<ctx>(args[carg]->val_real());
1403+
vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_real());
14141404
break;
14151405
case STRING_RESULT:
14161406
if (!(parg= args[carg]->val_str(&val_arg[carg-1])))
14171407
{
14181408
delete [] vargs;
14191409
return NULL;
14201410
}
1421-
vargs[carg-1]= make_arg<ctx>(*parg);
1411+
vargs[carg-1]= fmt::detail::make_arg<ctx>(*parg);
14221412
break;
14231413
case TIME_RESULT: // TODO
14241414
case ROW_RESULT: // TODO

0 commit comments

Comments
 (0)