mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
feat(Cmake/MYSQL): Correct support MariaDB for windows (#1674)
* Delete CMake option MARIADB * Delete definitions (-DMARIADB) * Replace macro MariaDB support 10.2+
This commit is contained in:
@@ -5,7 +5,6 @@ option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts"
|
|||||||
option(USE_COREPCH "Use precompiled headers when compiling servers" 1)
|
option(USE_COREPCH "Use precompiled headers when compiling servers" 1)
|
||||||
option(WITH_WARNINGS "Show all warnings during compile" 0)
|
option(WITH_WARNINGS "Show all warnings during compile" 0)
|
||||||
option(WITH_COREDEBUG "Include additional debug-code in core" 0)
|
option(WITH_COREDEBUG "Include additional debug-code in core" 0)
|
||||||
option(MARIADB "Compatibility with 10.2+ versions of MariaDB library" 0)
|
|
||||||
option(WITH_PERFTOOLS "Enable compilation with gperftools libraries included" 0)
|
option(WITH_PERFTOOLS "Enable compilation with gperftools libraries included" 0)
|
||||||
option(WITH_MESHEXTRACTOR "Build meshextractor (alpha)" 0)
|
option(WITH_MESHEXTRACTOR "Build meshextractor (alpha)" 0)
|
||||||
option(WITHOUT_GIT "Disable the GIT testing routines" 0)
|
option(WITHOUT_GIT "Disable the GIT testing routines" 0)
|
||||||
|
|||||||
@@ -12,6 +12,77 @@
|
|||||||
|
|
||||||
set( MYSQL_FOUND 0 )
|
set( MYSQL_FOUND 0 )
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# read environment variables and change \ to /
|
||||||
|
SET(PROGRAM_FILES_32 $ENV{ProgramFiles})
|
||||||
|
if (${PROGRAM_FILES_32})
|
||||||
|
STRING(REPLACE "\\\\" "/" PROGRAM_FILES_32 ${PROGRAM_FILES_32})
|
||||||
|
endif(${PROGRAM_FILES_32})
|
||||||
|
|
||||||
|
SET(PROGRAM_FILES_64 $ENV{ProgramW6432})
|
||||||
|
if (${PROGRAM_FILES_64})
|
||||||
|
STRING(REPLACE "\\\\" "/" PROGRAM_FILES_64 ${PROGRAM_FILES_64})
|
||||||
|
endif(${PROGRAM_FILES_64})
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
|
# Find MariaDB for Windows
|
||||||
|
if (WIN32)
|
||||||
|
# Set know versions MariaDB
|
||||||
|
set(_MARIADB_KNOWN_VERSIONS "MariaDB 10.4" "MariaDB 10.3" "MariaDB 10.2" "MariaDB 10.1")
|
||||||
|
|
||||||
|
# Set default oprions
|
||||||
|
set(MARIADB_FOUND_LIB 0)
|
||||||
|
set(MARIADB_FOUND_INCLUDE 0)
|
||||||
|
set(MARIADB_FOUND_EXECUTABLE 0)
|
||||||
|
set(MARIADB_FOUND 0)
|
||||||
|
|
||||||
|
macro(FindLibMariaDB MariaDBVersion)
|
||||||
|
# Find include
|
||||||
|
find_path(MYSQL_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
mysql.h
|
||||||
|
PATHS
|
||||||
|
${MYSQL_ADD_INCLUDE_PATH}
|
||||||
|
"${PROGRAM_FILES_64}/${MariaDBVersion}/include/mysql"
|
||||||
|
"${PROGRAM_FILES_32}/${MariaDBVersion}/include/mysql"
|
||||||
|
DOC
|
||||||
|
"Specify the directory containing mysql.h."
|
||||||
|
)
|
||||||
|
|
||||||
|
if(MYSQL_INCLUDE_DIR)
|
||||||
|
set(MARIADB_FOUND_INCLUDE 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(MYSQL_LIBRARY
|
||||||
|
NAMES
|
||||||
|
libmariadb
|
||||||
|
PATHS
|
||||||
|
${MYSQL_ADD_LIBRARIES_PATH}
|
||||||
|
"${PROGRAM_FILES_64}/${MariaDBVersion}/lib"
|
||||||
|
"${PROGRAM_FILES_64}/${MariaDBVersion}/lib/opt"
|
||||||
|
"${PROGRAM_FILES_32}/${MariaDBVersion}/lib"
|
||||||
|
"${PROGRAM_FILES_32}/${MariaDBVersion}/lib/opt"
|
||||||
|
"$ENV{ProgramFiles}/${MariaDBVersion}/lib/opt"
|
||||||
|
"$ENV{SystemDrive}/${MariaDBVersion}/lib/opt"
|
||||||
|
DOC
|
||||||
|
"Specify the location of the mysql library here."
|
||||||
|
)
|
||||||
|
|
||||||
|
if(MYSQL_LIBRARY)
|
||||||
|
set(MARIADB_FOUND_LIB 1)
|
||||||
|
endif()
|
||||||
|
if (MYSQL_LIBRARY AND MYSQL_INCLUDE_DIR)
|
||||||
|
set(MARIADB_FOUND 1)
|
||||||
|
endif()
|
||||||
|
endmacro(FindLibMariaDB)
|
||||||
|
|
||||||
|
foreach(version ${_MARIADB_KNOWN_VERSIONS})
|
||||||
|
if (NOT MARIADB_FOUND)
|
||||||
|
FindLibMariaDB(${version})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
if( UNIX )
|
if( UNIX )
|
||||||
set(MYSQL_CONFIG_PREFER_PATH "$ENV{MYSQL_HOME}/bin" CACHE FILEPATH
|
set(MYSQL_CONFIG_PREFER_PATH "$ENV{MYSQL_HOME}/bin" CACHE FILEPATH
|
||||||
"preferred path to MySQL (mysql_config)"
|
"preferred path to MySQL (mysql_config)"
|
||||||
|
|||||||
@@ -65,13 +65,6 @@ else()
|
|||||||
message("* Use coreside debug : No (default)")
|
message("* Use coreside debug : No (default)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( MARIADB )
|
|
||||||
message("* Enable MariaDB 10.2+ support : Yes")
|
|
||||||
add_definitions(-DMARIADB)
|
|
||||||
else()
|
|
||||||
message("* Enable MariaDB 10.2+ support : No (default)")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ( UNIX )
|
if ( UNIX )
|
||||||
if( WITH_PERFTOOLS )
|
if( WITH_PERFTOOLS )
|
||||||
message("* Use unix gperftools : Yes")
|
message("* Use unix gperftools : Yes")
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ bool MySQLConnection::_HandleMySQLErrno(uint32 errNo)
|
|||||||
case CR_SERVER_GONE_ERROR:
|
case CR_SERVER_GONE_ERROR:
|
||||||
case CR_SERVER_LOST:
|
case CR_SERVER_LOST:
|
||||||
case CR_SERVER_LOST_EXTENDED:
|
case CR_SERVER_LOST_EXTENDED:
|
||||||
#if !defined MARIADB
|
#if !(MARIADB_VERSION_ID >= 100200)
|
||||||
case CR_INVALID_CONN_HANDLE:
|
case CR_INVALID_CONN_HANDLE:
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user