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-tests", description = "Disable generation of test projects" }
|
||||||
newoption { trigger = "without-pch", description = "Disable generation and usage of precompiled headers" }
|
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-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-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-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" }
|
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" }
|
defines { "CONFIG2_LOBBY=0" }
|
||||||
end
|
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
|
-- 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)
|
-- being used as a DLL (which is currently not the case in 0ad)
|
||||||
defines { "LIB_STATIC_LINK" }
|
defines { "LIB_STATIC_LINK" }
|
||||||
@ -574,8 +579,10 @@ function setup_all_libs ()
|
|||||||
"spidermonkey",
|
"spidermonkey",
|
||||||
"enet",
|
"enet",
|
||||||
"boost", -- dragged in via server->simulation.h->random
|
"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, {})
|
setup_static_lib_project("network", source_dirs, extern_libs, {})
|
||||||
|
|
||||||
|
|
||||||
@ -848,7 +855,6 @@ used_extern_libs = {
|
|||||||
"libcurl",
|
"libcurl",
|
||||||
|
|
||||||
"valgrind",
|
"valgrind",
|
||||||
"miniupnpc",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if not os.is("windows") and not _OPTIONS["android"] and not os.is("macosx") then
|
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")
|
table.insert(used_extern_libs, "gloox")
|
||||||
end
|
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.
|
-- Bundles static libs together with main.cpp and builds game executable.
|
||||||
function setup_main_exe ()
|
function setup_main_exe ()
|
||||||
|
|
||||||
|
@ -116,4 +116,9 @@
|
|||||||
# define CONFIG2_LOBBY 1
|
# define CONFIG2_LOBBY 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// allow use of miniupnpc
|
||||||
|
#ifndef CONFIG2_MINIUPNPC
|
||||||
|
# define CONFIG2_MINIUPNPC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // #ifndef INCLUDED_CONFIG2
|
#endif // #ifndef INCLUDED_CONFIG2
|
||||||
|
@ -31,11 +31,13 @@
|
|||||||
#include "simulation2/Simulation2.h"
|
#include "simulation2/Simulation2.h"
|
||||||
#include "ps/ConfigDB.h"
|
#include "ps/ConfigDB.h"
|
||||||
|
|
||||||
|
#if CONFIG2_MINIUPNPC
|
||||||
// Next four files are for UPnP port forwarding.
|
// Next four files are for UPnP port forwarding.
|
||||||
#include <miniupnpc/miniwget.h>
|
#include <miniupnpc/miniwget.h>
|
||||||
#include <miniupnpc/miniupnpc.h>
|
#include <miniupnpc/miniupnpc.h>
|
||||||
#include <miniupnpc/upnpcommands.h>
|
#include <miniupnpc/upnpcommands.h>
|
||||||
#include <miniupnpc/upnperrors.h>
|
#include <miniupnpc/upnperrors.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEFAULT_SERVER_NAME L"Unnamed Server"
|
#define DEFAULT_SERVER_NAME L"Unnamed Server"
|
||||||
#define DEFAULT_WELCOME_MESSAGE L"Welcome"
|
#define DEFAULT_WELCOME_MESSAGE L"Welcome"
|
||||||
@ -189,13 +191,16 @@ bool CNetServerWorker::SetupConnection()
|
|||||||
int ret = pthread_create(&m_WorkerThread, NULL, &RunThread, this);
|
int ret = pthread_create(&m_WorkerThread, NULL, &RunThread, this);
|
||||||
ENSURE(ret == 0);
|
ENSURE(ret == 0);
|
||||||
|
|
||||||
|
#if CONFIG2_MINIUPNPC
|
||||||
// Launch the UPnP thread
|
// Launch the UPnP thread
|
||||||
ret = pthread_create(&m_UPnPThread, NULL, &SetupUPnP, NULL);
|
ret = pthread_create(&m_UPnPThread, NULL, &SetupUPnP, NULL);
|
||||||
ENSURE(ret == 0);
|
ENSURE(ret == 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG2_MINIUPNPC
|
||||||
void* CNetServerWorker::SetupUPnP(void*)
|
void* CNetServerWorker::SetupUPnP(void*)
|
||||||
{
|
{
|
||||||
// Values we want to set.
|
// Values we want to set.
|
||||||
@ -293,6 +298,7 @@ void* CNetServerWorker::SetupUPnP(void*)
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif // CONFIG2_MINIUPNPC
|
||||||
|
|
||||||
bool CNetServerWorker::SendMessage(ENetPeer* peer, const CNetMessage* message)
|
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.
|
* This file is part of 0 A.D.
|
||||||
*
|
*
|
||||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||||
@ -21,6 +21,7 @@
|
|||||||
#include "NetFileTransfer.h"
|
#include "NetFileTransfer.h"
|
||||||
#include "NetHost.h"
|
#include "NetHost.h"
|
||||||
|
|
||||||
|
#include "lib/config2.h"
|
||||||
#include "ps/ThreadUtil.h"
|
#include "ps/ThreadUtil.h"
|
||||||
#include "scriptinterface/ScriptVal.h"
|
#include "scriptinterface/ScriptVal.h"
|
||||||
|
|
||||||
@ -299,11 +300,13 @@ private:
|
|||||||
private:
|
private:
|
||||||
// Thread-related stuff:
|
// Thread-related stuff:
|
||||||
|
|
||||||
|
#if CONFIG2_MINIUPNPC
|
||||||
/**
|
/**
|
||||||
* Try to find a UPnP root on the network and setup port forwarding.
|
* Try to find a UPnP root on the network and setup port forwarding.
|
||||||
*/
|
*/
|
||||||
static void* SetupUPnP(void*);
|
static void* SetupUPnP(void*);
|
||||||
pthread_t m_UPnPThread;
|
pthread_t m_UPnPThread;
|
||||||
|
#endif
|
||||||
|
|
||||||
static void* RunThread(void* data);
|
static void* RunThread(void* data);
|
||||||
void Run();
|
void Run();
|
||||||
|
Loading…
Reference in New Issue
Block a user