mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-06-05 20:11:36 +00:00
Stop requiring amx folder for non-Pawn builds. Use correct Windows identifiers for preprocessor directives in server code.
This commit is contained in:
parent
fe50394f4d
commit
f4342f0bde
5 changed files with 13 additions and 10 deletions
|
@ -1,9 +1,10 @@
|
||||||
project(openmw-mp)
|
project(openmw-mp)
|
||||||
|
|
||||||
add_subdirectory(amx)
|
|
||||||
|
|
||||||
option(BUILD_WITH_PAWN "Enable Pawn language" OFF)
|
option(BUILD_WITH_PAWN "Enable Pawn language" OFF)
|
||||||
if(BUILD_WITH_PAWN)
|
if(BUILD_WITH_PAWN)
|
||||||
|
|
||||||
|
add_subdirectory(amx)
|
||||||
|
|
||||||
#set(Pawn_ROOT ${CMAKE_SOURCE_DIR}/external/pawn/)
|
#set(Pawn_ROOT ${CMAKE_SOURCE_DIR}/external/pawn/)
|
||||||
set(Pawn_INCLUDES ${Pawn_ROOT}/include)
|
set(Pawn_INCLUDES ${Pawn_ROOT}/include)
|
||||||
set(Pawn_LIBRARY ${Pawn_ROOT}/lib/libamx.a)
|
set(Pawn_LIBRARY ${Pawn_ROOT}/lib/libamx.a)
|
||||||
|
|
|
@ -30,7 +30,7 @@ void LangNative::LoadProgram(const char *filename)
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef _WIN32
|
||||||
lib = LoadLibrary(filename);
|
lib = LoadLibrary(filename);
|
||||||
#else
|
#else
|
||||||
lib = dlopen(filename, RTLD_LAZY);
|
lib = dlopen(filename, RTLD_LAZY);
|
||||||
|
@ -58,7 +58,7 @@ void LangNative::LoadProgram(const char *filename)
|
||||||
|
|
||||||
int LangNative::FreeProgram()
|
int LangNative::FreeProgram()
|
||||||
{
|
{
|
||||||
#ifdef __WIN32__
|
#ifdef _WIN32
|
||||||
FreeLibrary(lib);
|
FreeLibrary(lib);
|
||||||
#else
|
#else
|
||||||
dlclose(lib);
|
dlclose(lib);
|
||||||
|
|
|
@ -25,7 +25,7 @@ Script::Script(const char *path)
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef _WIN32
|
||||||
if (strstr(path, ".dll"))
|
if (strstr(path, ".dll"))
|
||||||
#else
|
#else
|
||||||
if (strstr(path, ".so"))
|
if (strstr(path, ".so"))
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#ifndef PLUGINSYSTEM3_SYSTEMINTERFACE_HPP
|
#ifndef PLUGINSYSTEM3_SYSTEMINTERFACE_HPP
|
||||||
#define PLUGINSYSTEM3_SYSTEMINTERFACE_HPP
|
#define PLUGINSYSTEM3_SYSTEMINTERFACE_HPP
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#else
|
#else
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
template<typename R = void*>
|
template<typename R = void*>
|
||||||
struct SystemInterface
|
struct SystemInterface
|
||||||
{
|
{
|
||||||
#ifdef __WIN32__
|
#ifdef _WIN32
|
||||||
typedef HMODULE lib_t;
|
typedef HMODULE lib_t;
|
||||||
#else
|
#else
|
||||||
typedef void* lib_t;
|
typedef void* lib_t;
|
||||||
|
@ -23,19 +23,21 @@ struct SystemInterface
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
R result;
|
R result;
|
||||||
#ifdef __WIN32__
|
#ifdef _WIN32
|
||||||
decltype(GetProcAddress(lib_t(), nullptr)) data;
|
decltype(GetProcAddress(lib_t(), nullptr)) data;
|
||||||
#else
|
#else
|
||||||
decltype(dlsym(lib_t(), nullptr)) data;
|
decltype(dlsym(lib_t(), nullptr)) data;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
static_assert(sizeof(result) == sizeof(data), "R should have the same size");
|
static_assert(sizeof(result) == sizeof(data), "R should have the same size");
|
||||||
|
#endif
|
||||||
|
|
||||||
SystemInterface() : data(nullptr) {}
|
SystemInterface() : data(nullptr) {}
|
||||||
explicit operator bool() { return data; }
|
explicit operator bool() { return data; }
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef _WIN32
|
||||||
SystemInterface(lib_t handle, const char* name) : data(GetProcAddress(handle, name)) {}
|
SystemInterface(lib_t handle, const char* name) : data(GetProcAddress(handle, name)) {}
|
||||||
#else
|
#else
|
||||||
SystemInterface(lib_t handle, const char* name) : data(dlsym(handle, name)) {}
|
SystemInterface(lib_t handle, const char* name) : data(dlsym(handle, name)) {}
|
||||||
|
|
|
@ -17,7 +17,7 @@ void printVersion(string version, int protocol)
|
||||||
{
|
{
|
||||||
cout << "TES3:MP dedicated server " << version;
|
cout << "TES3:MP dedicated server " << version;
|
||||||
cout << " (";
|
cout << " (";
|
||||||
#ifdef __WIN32__
|
#ifdef _WIN32
|
||||||
cout << "Windows";
|
cout << "Windows";
|
||||||
#elif __linux
|
#elif __linux
|
||||||
cout << "Linux";
|
cout << "Linux";
|
||||||
|
|
Loading…
Reference in a new issue