Commit 23bfacf1 authored by Sergei Golubchik's avatar Sergei Golubchik

Revert "Improve LibFMT detection"

This reverts commit 9feaa6be.

No, we do NOT support fmt 6.x, it formats values differently.
And we MUST use FMT_HEADER_ONLY
parent 2d21917e
...@@ -618,4 +618,3 @@ tests/mariadb-client-test ...@@ -618,4 +618,3 @@ tests/mariadb-client-test
versioninfo_dll.rc versioninfo_dll.rc
versioninfo_exe.rc versioninfo_exe.rc
win/packaging/ca/symlinks.cc win/packaging/ca/symlinks.cc
/_Deparsed_XSubs.pm
INCLUDE (CheckCXXSourceCompiles)
INCLUDE (ExternalProject)
SET(WITH_LIBFMT "auto" CACHE STRING SET(WITH_LIBFMT "auto" CACHE STRING
"Which libfmt to use (possible values are 'bundled', 'system', or 'auto')") "Which libfmt to use (possible values are 'bundled', 'system', or 'auto')")
...@@ -10,7 +12,6 @@ MACRO(BUNDLE_LIBFMT) ...@@ -10,7 +12,6 @@ MACRO(BUNDLE_LIBFMT)
SET(fmt_byproducts BUILD_BYPRODUCTS ${LIBFMT_INCLUDE_DIR}/fmt/format-inl.h) SET(fmt_byproducts BUILD_BYPRODUCTS ${LIBFMT_INCLUDE_DIR}/fmt/format-inl.h)
ENDIF() ENDIF()
INCLUDE (ExternalProject)
ExternalProject_Add( ExternalProject_Add(
libfmt libfmt
PREFIX "${dir}" PREFIX "${dir}"
...@@ -25,42 +26,17 @@ ENDMACRO() ...@@ -25,42 +26,17 @@ ENDMACRO()
MACRO (CHECK_LIBFMT) MACRO (CHECK_LIBFMT)
IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto") IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto")
FIND_PACKAGE(fmt)
IF(fmt_FOUND)
set(HAVE_SYSTEM_LIBFMT ${fmt_FOUND})
ENDIF()
FIND_LIBRARY(FMT_LIB_FOUND fmt)
IF(FMT_LIB_FOUND)
set(FMT_LIBRARIES fmt CACHE STRING "LibFormat libraries" FORCE)
ADD_DEFINITIONS(-DLINK_SYSTEM_LIBFMT)
ELSE(FMT_LIB_FOUND)
set(FMT_HEADER_ONLY "#define FMT_HEADER_ONLY 1")
set(FMT_LIBRARIES "" CACHE STRING "LibFormat libraries" FORCE)
ENDIF(FMT_LIB_FOUND)
INCLUDE (CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES( CHECK_CXX_SOURCE_COMPILES(
"#define FMT_STATIC_THOUSANDS_SEPARATOR ',' "#define FMT_STATIC_THOUSANDS_SEPARATOR ','
${FMT_HEADER_ONLY} #define FMT_HEADER_ONLY 1
#include <fmt/format-inl.h> #include <fmt/format-inl.h>
#include <iostream> #include <iostream>
#include <string>
#if FMT_VERSION < 70000
using namespace ::fmt::internal;
#else
using namespace ::fmt::detail;
#endif
int main() { int main() {
fmt::format_args::format_arg arg= fmt::format_args::format_arg arg=
fmt::detail::make_arg<fmt::format_context>(42); fmt::detail::make_arg<fmt::format_context>(42);
std::cout << fmt::vformat(\"The answer is {}.\", std::cout << fmt::vformat(\"The answer is {}.\",
fmt::format_args(&arg, 1)); fmt::format_args(&arg, 1));
return 0;
}" HAVE_SYSTEM_LIBFMT) }" HAVE_SYSTEM_LIBFMT)
IF (HAVE_SYSTEM_LIBFMT)
ADD_DEFINITIONS(-DHAVE_SYSTEM_LIBFMT)
ENDIF()
ENDIF() ENDIF()
IF(NOT HAVE_SYSTEM_LIBFMT OR WITH_LIBFMT STREQUAL "bundled") IF(NOT HAVE_SYSTEM_LIBFMT OR WITH_LIBFMT STREQUAL "bundled")
IF (WITH_LIBFMT STREQUAL "system") IF (WITH_LIBFMT STREQUAL "system")
......
...@@ -208,7 +208,6 @@ MAYBE_DISABLE_IPO(sql) ...@@ -208,7 +208,6 @@ MAYBE_DISABLE_IPO(sql)
DTRACE_INSTRUMENT(sql) DTRACE_INSTRUMENT(sql)
TARGET_LINK_LIBRARIES(sql PUBLIC TARGET_LINK_LIBRARIES(sql PUBLIC
mysys mysys_ssl dbug strings vio pcre2-8 mysys mysys_ssl dbug strings vio pcre2-8
${FMT_LIBRARIES}
tpool tpool
${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
${SSL_LIBRARIES} ${SSL_LIBRARIES}
...@@ -278,7 +277,7 @@ IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX) ...@@ -278,7 +277,7 @@ IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
ENDIF() ENDIF()
ADD_LIBRARY(sql_builtins STATIC ${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc) ADD_LIBRARY(sql_builtins STATIC ${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc)
TARGET_LINK_LIBRARIES(sql_builtins PUBLIC ${MYSQLD_STATIC_PLUGIN_LIBS}) TARGET_LINK_LIBRARIES(sql_builtins ${MYSQLD_STATIC_PLUGIN_LIBS})
MYSQL_ADD_EXECUTABLE(mariadbd ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server) MYSQL_ADD_EXECUTABLE(mariadbd ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server)
......
...@@ -57,18 +57,8 @@ C_MODE_END ...@@ -57,18 +57,8 @@ C_MODE_END
/* fmtlib include (https://fmt.dev/). */ /* fmtlib include (https://fmt.dev/). */
#define FMT_STATIC_THOUSANDS_SEPARATOR ',' #define FMT_STATIC_THOUSANDS_SEPARATOR ','
#if !defined(HAVE_SYSTEM_LIBFMT) && !defined(LINK_SYSTEM_LIBFMT)
#define FMT_HEADER_ONLY 1 #define FMT_HEADER_ONLY 1
#endif #include "fmt/format-inl.h"
#include <fmt/format-inl.h>
#if FMT_VERSION < 70000
using namespace ::fmt::internal;
#else
using namespace ::fmt::detail;
#endif
size_t username_char_length= USERNAME_CHAR_LENGTH; size_t username_char_length= USERNAME_CHAR_LENGTH;
...@@ -1403,14 +1393,14 @@ String *Item_func_sformat::val_str(String *res) ...@@ -1403,14 +1393,14 @@ String *Item_func_sformat::val_str(String *res)
switch (args[carg]->result_type()) switch (args[carg]->result_type())
{ {
case INT_RESULT: case INT_RESULT:
vargs[carg-1]= make_arg<ctx>(args[carg]->val_int()); vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_int());
break; break;
case DECIMAL_RESULT: // TODO case DECIMAL_RESULT: // TODO
case REAL_RESULT: case REAL_RESULT:
if (args[carg]->field_type() == MYSQL_TYPE_FLOAT) if (args[carg]->field_type() == MYSQL_TYPE_FLOAT)
vargs[carg-1]= make_arg<ctx>((float)args[carg]->val_real()); vargs[carg-1]= fmt::detail::make_arg<ctx>((float)args[carg]->val_real());
else else
vargs[carg-1]= make_arg<ctx>(args[carg]->val_real()); vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_real());
break; break;
case STRING_RESULT: case STRING_RESULT:
if (!(parg= args[carg]->val_str(&val_arg[carg-1]))) if (!(parg= args[carg]->val_str(&val_arg[carg-1])))
...@@ -1418,7 +1408,7 @@ String *Item_func_sformat::val_str(String *res) ...@@ -1418,7 +1408,7 @@ String *Item_func_sformat::val_str(String *res)
delete [] vargs; delete [] vargs;
return NULL; return NULL;
} }
vargs[carg-1]= make_arg<ctx>(*parg); vargs[carg-1]= fmt::detail::make_arg<ctx>(*parg);
break; break;
case TIME_RESULT: // TODO case TIME_RESULT: // TODO
case ROW_RESULT: // TODO case ROW_RESULT: // TODO
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment