Get miniupnpc working

This commit is contained in:
NepDisk 2026-02-19 13:06:16 -05:00
parent 76314d2f8c
commit 649523e4c8
4 changed files with 18 additions and 5 deletions

View file

@ -95,6 +95,7 @@ option(SRB2_CONFIG_NOVERIFYIWADS "Compile with IWAD verification turned off." OF
set(SRB2_CONFIG_ASSET_DIRECTORY "" CACHE PATH "Path to directory that contains all asset files for the installer. If set, assets will be part of installation and cpack.")
option(SRB2_CONFIG_LTO "Enable link time optimizations, improves performance at the cost of longer link times." ON)
option(SRB2_CONFIG_TIDY "Enable clang tiny, checks compiled code for issues at the cost of longer compile times." OFF)
option(SRB2_CONFIG_UPNP "Enable UPnP support for networking." ON)
if(SRB2_CONFIG_ENABLE_TESTS)
# https://github.com/catchorg/Catch2
@ -185,7 +186,6 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
add_subdirectory(src)
add_subdirectory(assets)
## config.h generation
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
include(GitUtilities)

View file

@ -306,6 +306,11 @@ target_link_libraries(BLANKART PRIVATE Opus::opus)
target_link_libraries(BLANKART PRIVATE Ogg::ogg)
endif()
if(SRB2_CONFIG_UPNP)
target_compile_definitions(BLANKART PRIVATE -DHAVE_MINIUPNPC)
target_link_libraries(BLANKART PRIVATE miniupnpc)
endif()
target_link_libraries(BLANKART PRIVATE xxHash::xxhash)
target_compile_definitions(BLANKART PRIVATE -DUSE_STUN)

View file

@ -118,10 +118,10 @@ typedef union
} mysockaddr_t;
#ifdef HAVE_MINIUPNPC
#include "miniwget.h"
#include "miniupnpc.h"
#include "upnpcommands.h"
static UINT8 UPNP_support = TRUE;
#include "miniupnpc/miniwget.h"
#include "miniupnpc/miniupnpc.h"
#include "miniupnpc/upnpcommands.h"
static UINT8 UPNP_support = true;
#endif // HAVE_MINIUPNC
#include "i_system.h"

View file

@ -28,3 +28,11 @@ add_subdirectory(tracy)
add_subdirectory(tcbrindle_span)
add_subdirectory(fmt)
add_subdirectory(xxhash)
if(SRB2_CONFIG_UPNP)
set(UPNPC_BUILD_STATIC ${NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES})
set(UPNPC_BUILD_SHARED ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES})
set(UPNPC_BUILD_TESTS FALSE)
set(UPNPC_BUILD_SAMPLE FALSE)
add_subdirectory("miniupnp/miniupnpc" EXCLUDE_FROM_ALL)
endif()