forked from 0ad/0ad
Add compile time flag to disable use of miniupnpc.
This was SVN commit r14384.
This commit is contained in:
parent
7f5c2c4b83
commit
42bc5165ab
@ -11,6 +11,7 @@ newoption { trigger = "without-nvtt", description = "Disable use of NVTT" }
|
||||
newoption { trigger = "without-tests", description = "Disable generation of test projects" }
|
||||
newoption { trigger = "without-pch", description = "Disable generation and usage of precompiled headers" }
|
||||
newoption { trigger = "without-lobby", description = "Disable the use of gloox and the multiplayer lobby" }
|
||||
newoption { trigger = "without-miniupnpc", description = "Disable use of miniupnpc for port forwarding" }
|
||||
newoption { trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" }
|
||||
newoption { trigger = "with-system-enet", description = "Search standard paths for libenet, instead of using bundled copy" }
|
||||
newoption { trigger = "with-system-miniupnpc", description = "Search standard paths for libminiupnpc, instead of using bundled copy" }
|
||||
@ -183,6 +184,10 @@ function project_set_build_flags()
|
||||
defines { "CONFIG2_LOBBY=0" }
|
||||
end
|
||||
|
||||
if _OPTIONS["without-miniupnpc"] then
|
||||
defines { "CONFIG2_MINIUPNPC=0" }
|
||||
end
|
||||
|
||||
-- required for the lowlevel library. must be set from all projects that use it, otherwise it assumes it is
|
||||
-- being used as a DLL (which is currently not the case in 0ad)
|
||||
defines { "LIB_STATIC_LINK" }
|
||||
@ -574,8 +579,10 @@ function setup_all_libs ()
|
||||
"spidermonkey",
|
||||
"enet",
|
||||
"boost", -- dragged in via server->simulation.h->random
|
||||
"miniupnpc"
|
||||
}
|
||||
if not _OPTIONS["without-miniupnpc"] then
|
||||
table.insert(extern_libs, "miniupnpc")
|
||||
end
|
||||
setup_static_lib_project("network", source_dirs, extern_libs, {})
|
||||
|
||||
|
||||
@ -848,7 +855,6 @@ used_extern_libs = {
|
||||
"libcurl",
|
||||
|
||||
"valgrind",
|
||||
"miniupnpc",
|
||||
}
|
||||
|
||||
if not os.is("windows") and not _OPTIONS["android"] and not os.is("macosx") then
|
||||
@ -870,6 +876,10 @@ if not _OPTIONS["without-lobby"] then
|
||||
table.insert(used_extern_libs, "gloox")
|
||||
end
|
||||
|
||||
if not _OPTIONS["without-miniupnpc"] then
|
||||
table.insert(used_extern_libs, "miniupnpc")
|
||||
end
|
||||
|
||||
-- Bundles static libs together with main.cpp and builds game executable.
|
||||
function setup_main_exe ()
|
||||
|
||||
|
@ -116,4 +116,9 @@
|
||||
# define CONFIG2_LOBBY 1
|
||||
#endif
|
||||
|
||||
// allow use of miniupnpc
|
||||
#ifndef CONFIG2_MINIUPNPC
|
||||
# define CONFIG2_MINIUPNPC 1
|
||||
#endif
|
||||
|
||||
#endif // #ifndef INCLUDED_CONFIG2
|
||||
|
@ -31,11 +31,13 @@
|
||||
#include "simulation2/Simulation2.h"
|
||||
#include "ps/ConfigDB.h"
|
||||
|
||||
#if CONFIG2_MINIUPNPC
|
||||
// Next four files are for UPnP port forwarding.
|
||||
#include <miniupnpc/miniwget.h>
|
||||
#include <miniupnpc/miniupnpc.h>
|
||||
#include <miniupnpc/upnpcommands.h>
|
||||
#include <miniupnpc/upnperrors.h>
|
||||
#endif
|
||||
|
||||
#define DEFAULT_SERVER_NAME L"Unnamed Server"
|
||||
#define DEFAULT_WELCOME_MESSAGE L"Welcome"
|
||||
@ -189,13 +191,16 @@ bool CNetServerWorker::SetupConnection()
|
||||
int ret = pthread_create(&m_WorkerThread, NULL, &RunThread, this);
|
||||
ENSURE(ret == 0);
|
||||
|
||||
#if CONFIG2_MINIUPNPC
|
||||
// Launch the UPnP thread
|
||||
ret = pthread_create(&m_UPnPThread, NULL, &SetupUPnP, NULL);
|
||||
ENSURE(ret == 0);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if CONFIG2_MINIUPNPC
|
||||
void* CNetServerWorker::SetupUPnP(void*)
|
||||
{
|
||||
// Values we want to set.
|
||||
@ -293,6 +298,7 @@ void* CNetServerWorker::SetupUPnP(void*)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif // CONFIG2_MINIUPNPC
|
||||
|
||||
bool CNetServerWorker::SendMessage(ENetPeer* peer, const CNetMessage* message)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2011 Wildfire Games.
|
||||
/* Copyright (C) 2013 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -21,6 +21,7 @@
|
||||
#include "NetFileTransfer.h"
|
||||
#include "NetHost.h"
|
||||
|
||||
#include "lib/config2.h"
|
||||
#include "ps/ThreadUtil.h"
|
||||
#include "scriptinterface/ScriptVal.h"
|
||||
|
||||
@ -299,11 +300,13 @@ private:
|
||||
private:
|
||||
// Thread-related stuff:
|
||||
|
||||
#if CONFIG2_MINIUPNPC
|
||||
/**
|
||||
* Try to find a UPnP root on the network and setup port forwarding.
|
||||
*/
|
||||
static void* SetupUPnP(void*);
|
||||
pthread_t m_UPnPThread;
|
||||
#endif
|
||||
|
||||
static void* RunThread(void* data);
|
||||
void Run();
|
||||
|
Loading…
Reference in New Issue
Block a user