MariaDB: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
Line 1: Line 1:
__EDIT_ME__
==Installation==
Open the ''server_config.json'' file and add '''mariadb''' to the plugins.
 
[[File:mariadb_installation.JPG]]
===Windows===
Make sure to have the file ''libmariadb.dll'' in the same directory as ''HorizonServer.exe''.
You can find that file in the Server folder delivered with the game.
 
===Linux===
Install the following package on the target system.
<syntaxhighlight lang="bash">
apt-get install libmariadbclient-dev
</syntaxhighlight>


==Compiling from source==
==Compiling from source==
Minimum requirements
Minimum requirements
* CMake 3.1 (https://cmake.org)
* CMake 3.1 (https://cmake.org)
* Boost 1.69 (https://boost.org)
* Boost 1.69 (https://boost.org)
* MariaDB C/C++ Connector (https://mariadb.com/downloads/#connectors)
* Visual Studio 2017 (Windows) or GCC 7 (Linux)
* Visual Studio 2017 (Windows) or GCC 7 (Linux)


===Windows===
===Windows===
Download the MariaDB C/C++ Connector from https://mariadb.com/downloads/#connectors
<syntaxhighlight lang="batch">
<syntaxhighlight lang="batch">
git clone https://github.com/BlueMountainsIO/PluginMariaDB.git
git clone https://github.com/BlueMountainsIO/PluginMariaDB.git
Line 18: Line 29:
Open the generated mariadb.sln file and select "Release" as build target.
Open the generated mariadb.sln file and select "Release" as build target.
Right click on the solution and hit rebuild.
Right click on the solution and hit rebuild.
[[File:BuildMariaDBPluginWindows.png]]
[[File:BuildMariaDBPluginWindows.png]]


Line 24: Line 36:
===Ubuntu===
===Ubuntu===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
apt-get install libmariadb-dev
apt-get install libmariadbclient-dev
git clone https://github.com/BlueMountainsIO/PluginMariaDB.git
git clone https://github.com/BlueMountainsIO/PluginMariaDB.git
cd PluginMariaDB
cd PluginMariaDB
cmake -DBOOST_ROOT=/usr/include/boost_1_70_0 .
cmake -DMARIADBCAPI_INCLUDE_DIR=/usr/include/mysql -DMARIADBCAPI_LIBRARY=/usr/lib/x86_64-linux-gnu/libmariadbclient.so -DBOOST_ROOT=/usr/include/boost_1_70_0 -DBUILD_STATIC=OFF .
make
make
</syntaxhighlight>
</syntaxhighlight>
Line 33: Line 45:
For static builds you can do:
For static builds you can do:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cmake -DBOOST_ROOT=/usr/include/boost_1_70_0 -DBUILD_STATIC=ON .
cmake -DMARIADBCAPI_INCLUDE_DIR=/usr/include/mysql -DMARIADBCAPI_LIBRARY_STATIC=/usr/lib/x86_64-linux-gnu/libmariadbclient_r.a -DBOOST_ROOT=/usr/include/boost_1_70_0 -DBUILD_STATIC=ON .
</syntaxhighlight>
</syntaxhighlight>
The reason why we use ''libmariadbclient-dev'' over ''libmariadb-dev'' is because the latter does have a wrong hardcoded path for the mysql.sock file.

Revision as of 21:50, 17 May 2019

Installation

Open the server_config.json file and add mariadb to the plugins.

Windows

Make sure to have the file libmariadb.dll in the same directory as HorizonServer.exe. You can find that file in the Server folder delivered with the game.

Linux

Install the following package on the target system.

apt-get install libmariadbclient-dev

Compiling from source

Minimum requirements

Windows

Download the MariaDB C/C++ Connector from https://mariadb.com/downloads/#connectors

git clone https://github.com/BlueMountainsIO/PluginMariaDB.git
cd PluginMariaDB
cmake -DMARIADBCAPI_INCLUDE_DIR="C:\Program Files\MariaDB\MariaDB Connector C 64-bit\include" -DBOOST_ROOT="D:\Lib\boost_1_70_0" .

Open the generated mariadb.sln file and select "Release" as build target. Right click on the solution and hit rebuild.

The .dll will be under PluginMariaDB\src\Release.

Ubuntu

apt-get install libmariadbclient-dev
git clone https://github.com/BlueMountainsIO/PluginMariaDB.git
cd PluginMariaDB
cmake -DMARIADBCAPI_INCLUDE_DIR=/usr/include/mysql -DMARIADBCAPI_LIBRARY=/usr/lib/x86_64-linux-gnu/libmariadbclient.so -DBOOST_ROOT=/usr/include/boost_1_70_0 -DBUILD_STATIC=OFF .
make

For static builds you can do:

cmake -DMARIADBCAPI_INCLUDE_DIR=/usr/include/mysql -DMARIADBCAPI_LIBRARY_STATIC=/usr/lib/x86_64-linux-gnu/libmariadbclient_r.a -DBOOST_ROOT=/usr/include/boost_1_70_0 -DBUILD_STATIC=ON .

The reason why we use libmariadbclient-dev over libmariadb-dev is because the latter does have a wrong hardcoded path for the mysql.sock file.