-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from FredyH/mariadb-connector
Mariadb connector
- Loading branch information
Showing
115 changed files
with
8,420 additions
and
10,682 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,8 @@ | |
/premake5 | ||
/premake5.exe | ||
/out | ||
.vscode | ||
.vscode | ||
*.zip | ||
cmake-build-debug | ||
.idea | ||
.vs |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(mysqloo) | ||
add_subdirectory(GmodLUA) | ||
|
||
file(GLOB_RECURSE MYSQLOO_SRC "src/*.h" "src/*.cpp") | ||
set(SOURCE_FILES ${MYSQLOO_SRC} src/Main.cpp) | ||
set(CMAKE_BUILD_TYPE RelWithDebInfo) | ||
set (CMAKE_CXX_STANDARD 14) | ||
|
||
add_library(mysqloo SHARED ${SOURCE_FILES}) | ||
target_link_libraries(mysqloo gmod-module-base) | ||
|
||
target_include_directories(mysqloo PRIVATE MySQL/include) | ||
|
||
if (CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
if (WIN32) | ||
find_library(MARIADB_CLIENT_LIB mariadbclient HINTS "${PROJECT_SOURCE_DIR}/MySQL/lib64/windows") | ||
else () | ||
find_library(MARIADB_CLIENT_LIB mariadbclient HINTS "${PROJECT_SOURCE_DIR}/MySQL/lib64/linux") | ||
find_library(CRYPTO_LIB crypto HINTS "${PROJECT_SOURCE_DIR}/MySQL/lib64/linux") | ||
find_library(SSL_LIB ssl HINTS "${PROJECT_SOURCE_DIR}/MySQL/lib64/linux") | ||
endif () | ||
elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) | ||
if (WIN32) | ||
find_library(MARIADB_CLIENT_LIB mariadbclient HINTS "${PROJECT_SOURCE_DIR}/MySQL/lib/windows") | ||
else () | ||
find_library(MARIADB_CLIENT_LIB mariadbclient HINTS "${PROJECT_SOURCE_DIR}/MySQL/lib/linux") | ||
find_library(CRYPTO_LIB crypto HINTS "${PROJECT_SOURCE_DIR}/MySQL/lib/linux") | ||
find_library(SSL_LIB ssl HINTS "${PROJECT_SOURCE_DIR}/MySQL/lib/linux") | ||
endif () | ||
endif () | ||
|
||
if (WIN32) | ||
target_link_libraries(mysqloo ${MARIADB_CLIENT_LIB} crypt32 ws2_32 shlwapi bcrypt secur32) | ||
else () | ||
find_package(Threads REQUIRED) | ||
target_link_libraries(mysqloo ${MARIADB_CLIENT_LIB} ${SSL_LIB} ${CRYPTO_LIB} Threads::Threads ${CMAKE_DL_LIBS}) | ||
endif () | ||
|
||
set_gmod_suffix_prefix(mysqloo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "x64-RelDebug", | ||
"generator": "Ninja", | ||
"configurationType": "RelWithDebInfo", | ||
"inheritEnvironments": [ "msvc_x64_x64" ], | ||
"buildRoot": "${projectDir}\\out\\build\\${name}", | ||
"installRoot": "${projectDir}\\out\\install\\${name}", | ||
"cmakeCommandArgs": "", | ||
"buildCommandArgs": "", | ||
"ctestCommandArgs": "" | ||
}, | ||
{ | ||
"name": "x86-RelDebug", | ||
"generator": "Ninja", | ||
"configurationType": "RelWithDebInfo", | ||
"buildRoot": "${projectDir}\\out\\build\\${name}", | ||
"installRoot": "${projectDir}\\out\\install\\${name}", | ||
"cmakeCommandArgs": "", | ||
"buildCommandArgs": "", | ||
"ctestCommandArgs": "", | ||
"inheritEnvironments": [ "msvc_x86" ], | ||
"variables": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
set(SOURCES | ||
GarrysMod/Lua/Interface.h | ||
GarrysMod/Lua/LuaBase.h | ||
GarrysMod/Lua/SourceCompat.h | ||
GarrysMod/Lua/Types.h | ||
GarrysMod/Lua/UserData.h) | ||
|
||
add_library(gmod-module-base INTERFACE) | ||
target_include_directories(gmod-module-base INTERFACE ./) | ||
|
||
function(set_gmod_suffix_prefix library) | ||
SET_TARGET_PROPERTIES(${library} PROPERTIES PREFIX "gmsv_") | ||
|
||
if(APPLE) | ||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") | ||
SET_TARGET_PROPERTIES(${library} PROPERTIES SUFFIX "_osx.dll") | ||
else() | ||
SET_TARGET_PROPERTIES(${library} PROPERTIES SUFFIX "_osx64.dll") | ||
endif() | ||
elseif(UNIX) | ||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") | ||
SET_TARGET_PROPERTIES(${library} PROPERTIES SUFFIX "_linux.dll") | ||
else() | ||
SET_TARGET_PROPERTIES(${library} PROPERTIES SUFFIX "_linux64.dll") | ||
endif() | ||
elseif(WIN32) | ||
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") | ||
SET_TARGET_PROPERTIES(${library} PROPERTIES SUFFIX "_win32.dll") | ||
else() | ||
SET_TARGET_PROPERTIES(${library} PROPERTIES SUFFIX "_win64.dll") | ||
endif() | ||
endif() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#ifndef GARRYSMOD_LUA_INTERFACE_H | ||
#define GARRYSMOD_LUA_INTERFACE_H | ||
|
||
#include "LuaBase.h" | ||
|
||
struct lua_State { | ||
#if defined( _WIN32 ) && !defined( _M_X64 ) | ||
// Win32 | ||
unsigned char _ignore_this_common_lua_header_[48 + 22]; | ||
#elif defined( _WIN32 ) && defined( _M_X64 ) | ||
// Win64 | ||
unsigned char _ignore_this_common_lua_header_[92 + 22]; | ||
#elif defined( __linux__ ) && !defined( __x86_64__ ) | ||
// Linux32 | ||
unsigned char _ignore_this_common_lua_header_[48 + 22]; | ||
#elif defined( __linux__ ) && defined( __x86_64__ ) | ||
// Linux64 | ||
unsigned char _ignore_this_common_lua_header_[92 + 22]; | ||
#elif defined ( __APPLE__ ) && !defined( __x86_64__ ) | ||
// macOS32 | ||
unsigned char _ignore_this_common_lua_header_[48 + 22]; | ||
#elif defined ( __APPLE__ ) && defined( __x86_64__ ) | ||
// macOS64 | ||
unsigned char _ignore_this_common_lua_header_[92 + 22]; | ||
#else | ||
#error agh | ||
#endif | ||
|
||
GarrysMod::Lua::ILuaBase *luabase; | ||
}; | ||
|
||
#ifndef GMOD | ||
#ifdef _WIN32 | ||
#define DLL_EXPORT extern "C" __declspec( dllexport ) | ||
#else | ||
#define DLL_EXPORT extern "C" __attribute__((visibility("default"))) | ||
#endif | ||
|
||
#ifdef GMOD_ALLOW_DEPRECATED | ||
// Stop using this and use LUA_FUNCTION! | ||
#define LUA ( state->luabase ) | ||
|
||
#define GMOD_MODULE_OPEN() DLL_EXPORT int gmod13_open( lua_State* state ) | ||
#define GMOD_MODULE_CLOSE() DLL_EXPORT int gmod13_close( lua_State* state ) | ||
#else | ||
#define GMOD_MODULE_OPEN() \ | ||
int gmod13_open__Imp( GarrysMod::Lua::ILuaBase* LUA ); \ | ||
DLL_EXPORT int gmod13_open( lua_State* L ) \ | ||
{ \ | ||
return gmod13_open__Imp( L->luabase ); \ | ||
} \ | ||
int gmod13_open__Imp( GarrysMod::Lua::ILuaBase* LUA ) | ||
|
||
#define GMOD_MODULE_CLOSE() \ | ||
int gmod13_close__Imp( GarrysMod::Lua::ILuaBase* LUA ); \ | ||
DLL_EXPORT int gmod13_close( lua_State* L ) \ | ||
{ \ | ||
return gmod13_close__Imp( L->luabase ); \ | ||
} \ | ||
int gmod13_close__Imp( GarrysMod::Lua::ILuaBase* LUA ) | ||
|
||
#define LUA_FUNCTION(FUNC) \ | ||
static int FUNC##__Imp( GarrysMod::Lua::ILuaBase* LUA ); \ | ||
static int FUNC( lua_State* L ) \ | ||
{ \ | ||
GarrysMod::Lua::ILuaBase* LUA = L->luabase; \ | ||
LUA->SetState(L); \ | ||
return FUNC##__Imp( LUA ); \ | ||
} \ | ||
static int FUNC##__Imp( GarrysMod::Lua::ILuaBase* LUA ) | ||
#endif | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.