mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Core/Build: Fixed dynamic mode build
Core can now be built in dynamic mode, enabling the hotswap system to be used. Hotswap works fine on Windows. Didnt work for me on Debian, the rebuild and reload process happens but the old version of the module remains for some reason. Cant figure it out right now
This commit is contained in:
@@ -40,12 +40,14 @@
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/program_options.hpp>
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/crypto.h>
|
||||
|
||||
using boost::asio::ip::tcp;
|
||||
using namespace boost::program_options;
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
#ifndef _TRINITY_BNET_CONFIG
|
||||
# define _TRINITY_BNET_CONFIG "bnetserver.conf"
|
||||
@@ -72,7 +74,7 @@ bool StartDB();
|
||||
void StopDB();
|
||||
void SignalHandler(const boost::system::error_code& error, int signalNumber);
|
||||
void KeepDatabaseAliveHandler(const boost::system::error_code& error);
|
||||
variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile);
|
||||
variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile);
|
||||
|
||||
boost::asio::io_service _ioService;
|
||||
boost::asio::deadline_timer _dbPingTimer(_ioService);
|
||||
@@ -80,14 +82,16 @@ uint32 _dbPingInterval;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::string configFile = _TRINITY_BNET_CONFIG;
|
||||
auto configFile = fs::absolute(_TRINITY_BNET_CONFIG);
|
||||
auto vm = GetConsoleArguments(argc, argv, configFile);
|
||||
// exit if help is enabled
|
||||
if (vm.count("help"))
|
||||
return 0;
|
||||
|
||||
std::string configError;
|
||||
if (!sConfigMgr->LoadInitial(configFile, configError))
|
||||
if (!sConfigMgr->LoadInitial(configFile.generic_string(),
|
||||
std::vector<std::string>(argv, argv + argc),
|
||||
configError))
|
||||
{
|
||||
printf("Error in config file: %s\n", configError.c_str());
|
||||
return 1;
|
||||
@@ -95,7 +99,7 @@ int main(int argc, char** argv)
|
||||
|
||||
TC_LOG_INFO("server.bnetserver", "%s (bnetserver)", GitRevision::GetFullVersion());
|
||||
TC_LOG_INFO("server.bnetserver", "<Ctrl-C> to stop.\n");
|
||||
TC_LOG_INFO("server.bnetserver", "Using configuration file %s.", configFile.c_str());
|
||||
TC_LOG_INFO("server.bnetserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
|
||||
TC_LOG_INFO("server.bnetserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
|
||||
TC_LOG_INFO("server.bnetserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
|
||||
|
||||
@@ -217,12 +221,13 @@ void KeepDatabaseAliveHandler(const boost::system::error_code& error)
|
||||
}
|
||||
}
|
||||
|
||||
variables_map GetConsoleArguments(int argc, char** argv, std::string& configFile)
|
||||
variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile)
|
||||
{
|
||||
options_description all("Allowed options");
|
||||
all.add_options()
|
||||
("help,h", "print usage message")
|
||||
("config,c", value<std::string>(&configFile)->default_value(_TRINITY_BNET_CONFIG), "use <arg> as configuration file")
|
||||
("config,c", value<fs::path>(&configFile)->default_value(fs::absolute(_TRINITY_BNET_CONFIG)),
|
||||
"use <arg> as configuration file")
|
||||
;
|
||||
variables_map variablesMap;
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user