From 17171bc9dcb415895442bde8ca761e59e97e08ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 6 Dec 2021 00:21:14 +0800 Subject: [PATCH] Use system headers when building with system miniupnpc Fixes https://github.com/hrydgard/ppsspp/pull/15185 --- CMakeLists.txt | 3 ++- Core/Util/PortManager.h | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ddf13f572c..5ad5d14dad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2050,6 +2050,7 @@ if(USE_MINIUPNPC) find_package(MINIUPNPC REQUIRED) target_include_directories(${CoreLibName} PRIVATE ${MINIUPNP_INCLUDE_DIR}) target_link_libraries(${CoreLibName} ${MINIUPNP_LIBRARY}) + add_definitions(-DWITH_UPNP -DUSE_SYSTEM_MINIUPNPC) else() set (MINIUPNPC_VERSION 2.1) # used by miniupnpcstrings.h.cmake set (MINIUPNPC_API_VERSION 17) @@ -2068,7 +2069,7 @@ if(USE_MINIUPNPC) add_definitions (-D_DARWIN_C_SOURCE) endif() if(WIN32) - add_definitions(-DWIN32 -DMINIUPNP_EXPORTS ) + add_definitions(-DWIN32 -DMINIUPNP_EXPORTS) else() add_definitions(-fPIC) endif() diff --git a/Core/Util/PortManager.h b/Core/Util/PortManager.h index a4c7df6c27..67f99a8fc5 100644 --- a/Core/Util/PortManager.h +++ b/Core/Util/PortManager.h @@ -21,14 +21,18 @@ #pragma once - +#ifdef USE_SYSTEM_MINIUPNPC +#include +#include +#include +#else #ifndef MINIUPNP_STATICLIB #define MINIUPNP_STATICLIB #endif - #include "ext/miniupnp/miniupnpc/miniwget.h" #include "ext/miniupnp/miniupnpc/miniupnpc.h" #include "ext/miniupnp/miniupnpc/upnpcommands.h" +#endif #include #include