Add support for MINGW compiler
This commit is contained in:
parent
aa7255c2e5
commit
328d44fbb6
2 changed files with 15 additions and 4 deletions
|
@ -30,9 +30,15 @@ set_target_properties(UDPConnection PROPERTIES VERSION ${UDPConnection_VERSION})
|
|||
target_compile_features(UDPConnection PUBLIC cxx_std_17)
|
||||
target_link_libraries(UDPConnection PUBLIC pthread)
|
||||
if(WIN32)
|
||||
if(MINGW)
|
||||
target_compile_definitions(UDPConnection PUBLIC UDPC_PLATFORM_MINGW)
|
||||
target_link_libraries(UDPConnection PUBLIC ws2_32)
|
||||
target_link_libraries(UDPConnection PUBLIC iphlpapi)
|
||||
else()
|
||||
target_link_libraries(UDPConnection PUBLIC Ws2_32)
|
||||
target_link_libraries(UDPConnection PUBLIC Iphlpapi)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_include_directories(UDPConnection PUBLIC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/RingBuffer/src")
|
||||
|
|
|
@ -20,8 +20,13 @@
|
|||
// OS-based networking macros
|
||||
#if UDPC_PLATFORM == UDPC_PLATFORM_WINDOWS
|
||||
#include <winsock2.h>
|
||||
# ifdef UDPC_PLATFORM_MINGW
|
||||
# include <ws2ipdef.h>
|
||||
# include <in6addr.h>
|
||||
# else
|
||||
# include <Ws2ipdef.h>
|
||||
# include <In6addr.h>
|
||||
# endif
|
||||
|
||||
#define UDPC_CLEANUPSOCKET(x) closesocket(x)
|
||||
#define UDPC_SOCKETTYPE SOCKET
|
||||
|
|
Loading…
Reference in a new issue