From aa068d97a1ea1d7728a18bda074e0d4407e849b1 Mon Sep 17 00:00:00 2001 From: Foe Date: Thu, 28 Nov 2024 22:34:10 +0100 Subject: [PATCH] Add SQLite support for Windows (#576) * Find SQLite library on Windows * Add SQLite option for cmake GUI * Add sqlite documentation to mangosd.conf --- CMakeLists.txt | 10 +++++++--- cmake/options.cmake | 2 ++ src/mangosd/mangosd.conf.dist.in | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b71e9c181ba..7dca629277f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,9 +231,13 @@ endif() # Win32 delivered packages if(WIN32 AND (BUILD_GAME_SERVER OR BUILD_LOGIN_SERVER OR BUILD_EXTRACTORS)) - set(MYSQL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/dep/lib/include/mysql") - set(MYSQL_LIBRARY "${CMAKE_SOURCE_DIR}/dep/lib/${DEP_ARCH}_release/libmysql.lib") - set(MYSQL_DEBUG_LIBRARY "${CMAKE_SOURCE_DIR}/dep/lib/${DEP_ARCH}_debug/libmysql.lib") + if(SQLITE) + find_package(SQLite3 REQUIRED) + else() + set(MYSQL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/dep/lib/include/mysql") + set(MYSQL_LIBRARY "${CMAKE_SOURCE_DIR}/dep/lib/${DEP_ARCH}_release/libmysql.lib") + set(MYSQL_DEBUG_LIBRARY "${CMAKE_SOURCE_DIR}/dep/lib/${DEP_ARCH}_debug/libmysql.lib") + endif() set(OPENSSL_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/dep/lib/include") set(OPENSSL_LIBRARIES "${CMAKE_SOURCE_DIR}/dep/lib/${DEP_ARCH}_release/libcrypto.lib" diff --git a/cmake/options.cmake b/cmake/options.cmake index 989f2e820e6..ddb0db9ab0a 100644 --- a/cmake/options.cmake +++ b/cmake/options.cmake @@ -1,6 +1,7 @@ option(DEBUG "Include additional debug-code in core" OFF) option(WARNINGS "Show all warnings during compile" OFF) option(POSTGRESQL "Use PostgreSQL" OFF) +option(SQLITE "Use SQLite" OFF) option(PCH "Use precompiled headers" ON) option(BUILD_GAME_SERVER "Build game server" ON) option(BUILD_LOGIN_SERVER "Build login server" ON) @@ -31,6 +32,7 @@ message(STATUS DEBUG Include additional debug-code in core WARNINGS Show all warnings during compile POSTGRESQL Use PostgreSQL instead of mysql + SQLITE Use SQLite instead of mysql BUILD_GAME_SERVER Build game server (core server) BUILD_LOGIN_SERVER Build login server (auth server) BUILD_EXTRACTORS Build map/dbc/vmap/mmap extractor diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 3caafddbdd6..4c0985c8857 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -47,6 +47,8 @@ ConfVersion=2024020101 # ---PGSQL--- # hostname;port;username;password;database # .;/path/to/unix_socket/DIRECTORY or . for default path;username;password;database - use Unix sockets at Unix/Linux +# ---SQLITE--- +# /path/to/sqlite.db # # LoginDatabaseConnections # WorldDatabaseConnections