Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add UPnP support.
Feedback is in logs as suggested by skid_au. The checkbox is still there, but
mostly for people who would like to opt out (unfortunately, I can not be sure
how this feature may behave for some routers - there's a hell of a lot of bad
UPnP implementations.)

The Visual Studio stuff is a little messy, so I apologize if anything is a bit
off. I tested most configurations and it worked.

I also tested CMake on Debian Wheezy, Ubuntu Saucy, and Mac OS X Mountain Lion.
All seemed to be OK.
  • Loading branch information
jchv committed Jul 9, 2013
1 parent 379a15b commit 16cd26d
Show file tree
Hide file tree
Showing 53 changed files with 9,321 additions and 1,336 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Expand Up @@ -9,6 +9,7 @@ option(USE_X11 "Enables X11 Support" ON)
option(USE_WAYLAND "Enables Wayland Support" OFF)
option(USE_GLES "Enables GLES2 And EGL, disables OGL" OFF)
option(USE_GLES3 "Enables GLES3 and EGL" OFF)
option(USE_UPNP "Enables UPnP port mapping support" ON)
option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF)

option(FASTLOG "Enable all logs" OFF)
Expand Down Expand Up @@ -549,6 +550,13 @@ else()
include_directories(Externals/SFML/include)
endif()

if(USE_UPNP)
message("Using static MiniUPnP client from Externals")
add_subdirectory(Externals/miniupnpc)
include_directories(Externals/miniupnpc/src)
add_definitions(-DUSE_UPNP)
endif()

if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT ANDROID)
check_lib(SOIL SOIL SOIL/SOIL.h QUIET)
endif()
Expand Down
37 changes: 37 additions & 0 deletions Externals/miniupnpc/CMakeLists.txt
@@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 2.6)

project(miniupnpc C)
set(MINIUPNPC_VERSION 1.7)
set(MINIUPNPC_API_VERSION 9)

if(UNIX)
add_definitions(-DMINIUPNPC_SET_SOCKET_TIMEOUT)
add_definitions(-D_BSD_SOURCE -D_POSIX_C_SOURCE=1)
elseif(WIN32)
add_definitions(-D_WIN32_WINNT=0x0501)
find_library(WINSOCK2_LIBRARY NAMES ws2_32 WS2_32 Ws2_32)
find_library(IPHLPAPI_LIBRARY NAMES iphlpapi)
set(LDLIBS ${WINSOCK2_LIBRARY} ${IPHLPAPI_LIBRARY} ${LDLIBS})
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
add_definitions(-DMACOSX -D_DARWIN_C_SOURCE)
endif()

include_directories(include)

set(SRCS src/igd_desc_parse.c
src/miniupnpc.c
src/minixml.c
src/minisoap.c
src/miniwget.c
src/upnpc.c
src/upnpcommands.c
src/upnpreplyparse.c
src/upnperrors.c
src/connecthostport.c
src/portlistingparse.c
src/receivedata.c)

add_library(miniupnpc STATIC ${SRCS})

0 comments on commit 16cd26d

Please sign in to comment.