- added support for libminiupnpc 1.7
This commit is contained in:
parent
f78ba5e5e6
commit
7a57668a91
|
@ -49,6 +49,25 @@ if (MINIUPNP_FOUND)
|
|||
|
||||
message(STATUS "Detecting version of miniupnpc in path: ${MINIUPNP_INCLUDE_DIR}")
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||
check_cxx_source_runs("
|
||||
#include <miniwget.h>
|
||||
#include <miniupnpc.h>
|
||||
#include <upnpcommands.h>
|
||||
#include <stdio.h>
|
||||
int main()
|
||||
{
|
||||
static struct UPNPUrls urls;
|
||||
static struct IGDdatas data;
|
||||
|
||||
GetUPNPUrls (&urls, &data, \"myurl\",0);
|
||||
|
||||
return 0;
|
||||
}"
|
||||
MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||
|
||||
IF (NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||
check_cxx_source_runs("
|
||||
|
@ -69,9 +88,10 @@ if (MINIUPNP_FOUND)
|
|||
|
||||
return 0;
|
||||
}"
|
||||
MINIUPNPC_VERSION_1_6_OR_HIGHER)
|
||||
MINIUPNPC_VERSION_PRE1_7)
|
||||
ENDIF()
|
||||
|
||||
IF (NOT MINIUPNPC_VERSION_1_6_OR_HIGHER)
|
||||
IF (NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||
check_cxx_source_runs("
|
||||
|
@ -96,6 +116,7 @@ if (MINIUPNP_FOUND)
|
|||
|
||||
ENDIF()
|
||||
|
||||
IF (NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||
check_cxx_source_runs("
|
||||
|
@ -113,8 +134,9 @@ if (MINIUPNP_FOUND)
|
|||
return 0;
|
||||
}"
|
||||
MINIUPNPC_VERSION_1_5_OR_HIGHER)
|
||||
ENDIF()
|
||||
|
||||
IF (NOT MINIUPNPC_VERSION_1_5_OR_HIGHER)
|
||||
IF (NOT MINIUPNPC_VERSION_1_5_OR_HIGHER AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7 AND NOT MINIUPNPC_VERSION_1_7_OR_HIGHER)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${MINIUPNP_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||
check_cxx_source_runs("
|
||||
|
@ -141,8 +163,12 @@ if (MINIUPNP_FOUND)
|
|||
IF(MINIUPNPC_VERSION_PRE1_6)
|
||||
message(STATUS "Found miniupnpc version is pre v1.6")
|
||||
ENDIF()
|
||||
IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6)
|
||||
message(STATUS "Found miniupnpc version is v1.6 or higher")
|
||||
IF(MINIUPNPC_VERSION_PRE1_7)
|
||||
message(STATUS "Found miniupnpc version is pre v1.7")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7)
|
||||
message(STATUS "Found miniupnpc version is v1.7 or higher")
|
||||
ENDIF()
|
||||
|
||||
else ()
|
||||
|
|
|
@ -297,7 +297,12 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
|
|||
ADD_DEFINITIONS(-DMINIUPNPC_VERSION_PRE1_6)
|
||||
message(STATUS "Adding macro for miniupnpc version: pre v1.6")
|
||||
ENDIF()
|
||||
IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6)
|
||||
IF(MINIUPNPC_VERSION_PRE1_7)
|
||||
ADD_DEFINITIONS(-DMINIUPNPC_VERSION_PRE1_7)
|
||||
message(STATUS "Adding macro for miniupnpc version: pre v1.7")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT MINIUPNPC_VERSION_PRE1_5 AND NOT MINIUPNPC_VERSION_PRE1_6 AND NOT MINIUPNPC_VERSION_PRE1_7)
|
||||
message(STATUS "**No macros required for miniupnpc version")
|
||||
ENDIF()
|
||||
|
||||
|
|
|
@ -2478,13 +2478,22 @@ int UPNP_Tools::upnp_init(void *param) {
|
|||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("UPnP device found: %s %s\n", dev->descURL, dev->st);
|
||||
|
||||
//printf("UPnP device found: [%s] [%s] lanaddr [%s]\n", dev->descURL, dev->st,lanaddr);
|
||||
#ifndef MINIUPNPC_VERSION_PRE1_7
|
||||
descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, (sizeof(lanaddr) / sizeof(lanaddr[0])),0);
|
||||
#else
|
||||
descXML = (char *)miniwget_getaddr(dev->descURL, &descXMLsize, lanaddr, (sizeof(lanaddr) / sizeof(lanaddr[0])));
|
||||
#endif
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"LAN address: %s\n", lanaddr);
|
||||
|
||||
if (descXML) {
|
||||
parserootdesc (descXML, descXMLsize, &data);
|
||||
free (descXML); descXML = 0;
|
||||
|
||||
#ifndef MINIUPNPC_VERSION_PRE1_7
|
||||
GetUPNPUrls (&urls, &data, dev->descURL,0);
|
||||
#else
|
||||
GetUPNPUrls (&urls, &data, dev->descURL);
|
||||
#endif
|
||||
}
|
||||
snprintf(buf, 255,"UPnP device found: %s %s LAN address %s", dev->descURL, dev->st, lanaddr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue