Stop requiring amx folder for non-Pawn builds. Use correct Windows identifiers for preprocessor directives in server code.

pull/33/head
David Cernat 9 years ago
parent fe50394f4d
commit f4342f0bde

@ -1,9 +1,10 @@
project(openmw-mp)
add_subdirectory(amx)
option(BUILD_WITH_PAWN "Enable Pawn language" OFF)
if(BUILD_WITH_PAWN)
add_subdirectory(amx)
#set(Pawn_ROOT ${CMAKE_SOURCE_DIR}/external/pawn/)
set(Pawn_INCLUDES ${Pawn_ROOT}/include)
set(Pawn_LIBRARY ${Pawn_ROOT}/lib/libamx.a)

@ -30,7 +30,7 @@ void LangNative::LoadProgram(const char *filename)
fclose(file);
#ifdef __WIN32__
#ifdef _WIN32
lib = LoadLibrary(filename);
#else
lib = dlopen(filename, RTLD_LAZY);
@ -58,7 +58,7 @@ void LangNative::LoadProgram(const char *filename)
int LangNative::FreeProgram()
{
#ifdef __WIN32__
#ifdef _WIN32
FreeLibrary(lib);
#else
dlclose(lib);

@ -25,7 +25,7 @@ Script::Script(const char *path)
fclose(file);
#ifdef __WIN32__
#ifdef _WIN32
if (strstr(path, ".dll"))
#else
if (strstr(path, ".so"))

@ -5,7 +5,7 @@
#ifndef PLUGINSYSTEM3_SYSTEMINTERFACE_HPP
#define PLUGINSYSTEM3_SYSTEMINTERFACE_HPP
#ifdef __WIN32__
#ifdef _WIN32
#include <winsock2.h>
#else
#include <dlfcn.h>
@ -14,7 +14,7 @@
template<typename R = void*>
struct SystemInterface
{
#ifdef __WIN32__
#ifdef _WIN32
typedef HMODULE lib_t;
#else
typedef void* lib_t;
@ -23,19 +23,21 @@ struct SystemInterface
union
{
R result;
#ifdef __WIN32__
#ifdef _WIN32
decltype(GetProcAddress(lib_t(), nullptr)) data;
#else
decltype(dlsym(lib_t(), nullptr)) data;
#endif
};
#ifndef _WIN32
static_assert(sizeof(result) == sizeof(data), "R should have the same size");
#endif
SystemInterface() : data(nullptr) {}
explicit operator bool() { return data; }
#ifdef __WIN32__
#ifdef _WIN32
SystemInterface(lib_t handle, const char* name) : data(GetProcAddress(handle, name)) {}
#else
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 << " (";
#ifdef __WIN32__
#ifdef _WIN32
cout << "Windows";
#elif __linux
cout << "Linux";

Loading…
Cancel
Save