aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluffypony <ric@spagni.net>2014-09-10 20:01:30 +0200
committerfluffypony <ric@spagni.net>2014-09-10 20:01:30 +0200
commit8d8b47e69f6bd1cfbd8f94c8ffc30b0ad3f19fc0 (patch)
tree063662186142e644d1b48afd213a8e800792da1d
parentminiupnpc includes fixed (diff)
downloadmonero-8d8b47e69f6bd1cfbd8f94c8ffc30b0ad3f19fc0.tar.xz
more dynamic miniupnp fixes
-rw-r--r--CMakeLists.txt8
-rwxr-xr-xexternal/CMakeLists.txt7
-rw-r--r--src/p2p/net_node.inl11
3 files changed, 19 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9614d7028..3b07a96eb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,14 @@ if (UNIX AND NOT APPLE)
find_package(Threads)
endif()
+if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
+ add_definitions("-DUPNP_DYNAMIC")
+ set(UPNP_LIBRARIES "miniupnpc")
+else()
+ add_definitions("-DUPNP_STATIC")
+ set(UPNP_LIBRARIES "upnpc-static")
+endif()
+
if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt
index 481fbe9db..bf3dd6017 100755
--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -3,16 +3,15 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif()
if(MINIUPNP_FOUND AND MINIUPNPC_VERSION_1_7_OR_HIGHER)
- message(STATUS "Using shared miniupnpc")
+ message(STATUS "Using shared miniupnpc found at ${MINIUPNP_INCLUDE_DIR}")
include_directories(${MINIUPNP_INCLUDE_DIR})
- set(UPNP_LIBRARIES "miniupnpc")
else()
message(STATUS "Using static miniupnpc from external")
- add_subdirectory(miniupnpc)
set(UPNPC_BUILD_STATIC ON CACHE BOOL "Build static library")
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "Build shared library")
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Build test executables")
+ add_subdirectory(miniupnpc)
set_property(TARGET upnpc-static PROPERTY FOLDER "external")
if(MSVC)
@@ -20,6 +19,4 @@ else()
elseif(NOT MSVC)
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value")
endif()
-
- set(UPNP_LIBRARIES "upnpc-static")
endif()
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index c2b397419..626e227bc 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -42,8 +42,15 @@
#include "net/local_ip.h"
#include "crypto/crypto.h"
#include "storages/levin_abstract_invoke2.h"
-#include "miniupnpc.h"
-#include "upnpcommands.h"
+
+// We have to look for miniupnpc headers in different places, dependent on if its compiled or external
+#ifdef UPNP_STATIC
+ #include <miniupnpc/miniupnpc.h>
+ #include <miniupnpc/upnpcommands.h>
+#else
+ #include "miniupnpc.h"
+ #include "upnpcommands.h"
+#endif
#define NET_MAKE_IP(b1,b2,b3,b4) ((LPARAM)(((DWORD)(b1)<<24)+((DWORD)(b2)<<16)+((DWORD)(b3)<<8)+((DWORD)(b4))))