mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Hotswap: Replace #ifdef conditions with comparisons of values defined in CompilerDefs.h
(cherry picked from commit 43510a258c)
This commit is contained in:
@@ -64,7 +64,7 @@ ScriptReloadMgr* ScriptReloadMgr::instance()
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
#include <windows.h>
|
||||
#define HOTSWAP_PLATFORM_REQUIRES_CACHING
|
||||
#elif __APPLE__
|
||||
@@ -83,7 +83,7 @@ namespace fs = boost::filesystem;
|
||||
// Returns "" on Windows and "lib" on posix.
|
||||
static char const* GetSharedLibraryPrefix()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
return "";
|
||||
#else // Posix
|
||||
return "lib";
|
||||
@@ -93,16 +93,16 @@ static char const* GetSharedLibraryPrefix()
|
||||
// Returns "dll" on Windows, "dylib" on OS X, and "so" on posix.
|
||||
static char const* GetSharedLibraryExtension()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
return "dll";
|
||||
#elif __APPLE__
|
||||
#elif TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE
|
||||
return "dylib";
|
||||
#else // Posix
|
||||
return "so";
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
typedef HMODULE HandleType;
|
||||
#else // Posix
|
||||
typedef void* HandleType;
|
||||
@@ -131,7 +131,7 @@ public:
|
||||
void operator() (HandleType handle) const
|
||||
{
|
||||
// Unload the associated shared library.
|
||||
#ifdef _WIN32
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
bool success = (FreeLibrary(handle) != 0);
|
||||
#else // Posix
|
||||
bool success = (dlclose(handle) == 0);
|
||||
@@ -241,7 +241,7 @@ private:
|
||||
template<typename Fn>
|
||||
static bool GetFunctionFromSharedLibrary(HandleType handle, std::string const& name, Fn& fn)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
fn = reinterpret_cast<Fn>(GetProcAddress(handle, name.c_str()));
|
||||
#else // Posix
|
||||
fn = reinterpret_cast<Fn>(dlsym(handle, name.c_str()));
|
||||
@@ -260,7 +260,7 @@ Optional<std::shared_ptr<ScriptModule>>
|
||||
return path;
|
||||
}();
|
||||
|
||||
#ifdef _WIN32
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
HandleType handle = LoadLibrary(load_path.generic_string().c_str());
|
||||
#else // Posix
|
||||
HandleType handle = dlopen(load_path.generic_string().c_str(), RTLD_LAZY);
|
||||
@@ -404,7 +404,7 @@ static std::string CalculateScriptModuleProjectName(std::string const& module)
|
||||
/// could block the rebuild of new shared libraries.
|
||||
static bool IsDebuggerBlockingRebuild()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
|
||||
if (IsDebuggerPresent())
|
||||
return true;
|
||||
#endif
|
||||
@@ -1344,7 +1344,7 @@ private:
|
||||
|
||||
auto current_path = fs::current_path();
|
||||
|
||||
#ifndef _WIN32
|
||||
#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
|
||||
// The worldserver location is ${CMAKE_INSTALL_PREFIX}/bin
|
||||
// on all other platforms then windows
|
||||
current_path = current_path.parent_path();
|
||||
|
||||
Reference in New Issue
Block a user