mirror of
https://github.com/moparisthebest/minetest
synced 2024-12-23 08:08:47 -05:00
Link against shlwapi.lib and unify linker input sources for Windows
This commit is contained in:
parent
d2fc98e4a6
commit
c758fd73ff
@ -195,8 +195,10 @@ if(WIN32)
|
|||||||
# Surpress some useless warnings
|
# Surpress some useless warnings
|
||||||
add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 )
|
add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 )
|
||||||
else() # Probably MinGW = GCC
|
else() # Probably MinGW = GCC
|
||||||
set(PLATFORM_LIBS ws2_32.lib)
|
set(PLATFORM_LIBS "")
|
||||||
endif()
|
endif()
|
||||||
|
set(PLATFORM_LIBS ws2_32.lib shlwapi.lib ${PLATFORM_LIBS})
|
||||||
|
|
||||||
# Zlib stuff
|
# Zlib stuff
|
||||||
set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5"
|
set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5"
|
||||||
CACHE PATH "Zlib include directory")
|
CACHE PATH "Zlib include directory")
|
||||||
|
@ -44,9 +44,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma comment(lib, "ws2_32.lib")
|
|
||||||
#endif
|
|
||||||
typedef SOCKET socket_t;
|
typedef SOCKET socket_t;
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
#else
|
#else
|
||||||
@ -154,7 +151,7 @@ void Address::Resolve(const char *name)
|
|||||||
|
|
||||||
struct addrinfo *resolved, hints;
|
struct addrinfo *resolved, hints;
|
||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
|
|
||||||
// Setup hints
|
// Setup hints
|
||||||
hints.ai_socktype = 0;
|
hints.ai_socktype = 0;
|
||||||
hints.ai_protocol = 0;
|
hints.ai_protocol = 0;
|
||||||
@ -168,7 +165,7 @@ void Address::Resolve(const char *name)
|
|||||||
{
|
{
|
||||||
hints.ai_family = AF_INET;
|
hints.ai_family = AF_INET;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do getaddrinfo()
|
// Do getaddrinfo()
|
||||||
int e = getaddrinfo(name, NULL, &hints, &resolved);
|
int e = getaddrinfo(name, NULL, &hints, &resolved);
|
||||||
if(e != 0)
|
if(e != 0)
|
||||||
@ -514,7 +511,7 @@ int UDPSocket::Receive(Address & sender, void *data, int size)
|
|||||||
dstream << (int) m_handle << " <- ";
|
dstream << (int) m_handle << " <- ";
|
||||||
sender.print(&dstream);
|
sender.print(&dstream);
|
||||||
dstream << ", size=" << received;
|
dstream << ", size=" << received;
|
||||||
|
|
||||||
// Print packet contents
|
// Print packet contents
|
||||||
dstream << ", data=";
|
dstream << ", data=";
|
||||||
for(int i = 0; i < received && i < 20; i++) {
|
for(int i = 0; i < received && i < 20; i++) {
|
||||||
@ -525,7 +522,7 @@ int UDPSocket::Receive(Address & sender, void *data, int size)
|
|||||||
}
|
}
|
||||||
if(received > 20)
|
if(received > 20)
|
||||||
dstream << "...";
|
dstream << "...";
|
||||||
|
|
||||||
dstream << std::endl;
|
dstream << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,7 +583,7 @@ bool UDPSocket::WaitData(int timeout_ms)
|
|||||||
// No data
|
// No data
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// There is data
|
// There is data
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user