mirror of
https://github.com/Relintai/sfw.git
synced 2024-11-08 07:52:09 +01:00
Fix windows build.
This commit is contained in:
parent
e0b9caafc0
commit
e392c13d3d
2
compile_windows.sh
Normal file → Executable file
2
compile_windows.sh
Normal file → Executable file
@ -139,7 +139,7 @@ ccache g++ -Wall \
|
|||||||
sfw/render_objects/camera_2d.o sfw/render_objects/mesh_instance_2d.o \
|
sfw/render_objects/camera_2d.o sfw/render_objects/mesh_instance_2d.o \
|
||||||
sfw/render_objects/text_2d.o \
|
sfw/render_objects/text_2d.o \
|
||||||
sfw/game_scene.o sfw/main.o \
|
sfw/game_scene.o sfw/main.o \
|
||||||
-lgdi32 -lShlwapi \
|
-lgdi32 -lShlwapi -lws2_32 \
|
||||||
-o game
|
-o game
|
||||||
|
|
||||||
#export args="-lm -ldl -lpthread -lX11 -w -Iengine/ $args"
|
#export args="-lm -ldl -lpthread -lX11 -w -Iengine/ $args"
|
@ -26,7 +26,18 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
WINSOCK_API_LINKAGE INT WSAAPI inet_pton(INT Family, PCSTR pszAddrString, PVOID pAddrBuf);
|
WINSOCK_API_LINKAGE INT WSAAPI inet_pton(INT Family, PCSTR pszAddrString, PVOID pAddrBuf);
|
||||||
WINSOCK_API_LINKAGE PCSTR WSAAPI inet_ntop(INT Family, PVOID pAddr, PSTR pStringBuf, size_t StringBufSize);
|
|
||||||
|
#ifdef __MINGW64_VERSION_MAJOR
|
||||||
|
#if __MINGW64_VERSION_MAJOR >= 7
|
||||||
|
WINSOCK_API_LINKAGE PCSTR WSAAPI inet_ntop(INT Family, const VOID * pAddr, PSTR pStringBuf, size_t StringBufSize);
|
||||||
|
#else
|
||||||
|
WINSOCK_API_LINKAGE PCSTR WSAAPI inet_ntop(INT Family, VOID * pAddr, PSTR pStringBuf, size_t StringBufSize);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
WINSOCK_API_LINKAGE PCSTR WSAAPI inet_ntop(INT Family, VOID * pAddr, PSTR pStringBuf, size_t StringBufSize);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// Windows...
|
// Windows...
|
||||||
@ -48,6 +59,10 @@ struct in6__addruint {
|
|||||||
#include <strings.h> // memset
|
#include <strings.h> // memset
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma comment(lib, "ws2_32")
|
||||||
|
#endif
|
||||||
|
|
||||||
// INADDR_ANY use (type)value casting.
|
// INADDR_ANY use (type)value casting.
|
||||||
static const in_addr_t kInaddrAny = INADDR_ANY;
|
static const in_addr_t kInaddrAny = INADDR_ANY;
|
||||||
static const in_addr_t kInaddrLoopback = INADDR_ANY;
|
static const in_addr_t kInaddrLoopback = INADDR_ANY;
|
||||||
|
@ -197,7 +197,8 @@ int Socket::accept(Socket *sock) {
|
|||||||
sock->_socket = connfd;
|
sock->_socket = connfd;
|
||||||
sock->_address.set_sock_addr_inet6(addr6);
|
sock->_address.set_sock_addr_inet6(addr6);
|
||||||
#ifndef __linux__
|
#ifndef __linux__
|
||||||
sock->set_non_block_and_close_on_exit();
|
sock->set_non_block();
|
||||||
|
sock->set_close_on_exit();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +292,7 @@ void Socket::set_keep_alive(bool on) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct sockaddr_in6 Socket::get_local_addr(int *r_err) {
|
struct sockaddr_in6 Socket::get_local_addr(int *r_err) {
|
||||||
struct sockaddr_in6 localaddr;
|
struct sockaddr_in6 localaddr = { 0 };
|
||||||
|
|
||||||
ERR_FAIL_COND_V(_socket == 0, localaddr);
|
ERR_FAIL_COND_V(_socket == 0, localaddr);
|
||||||
|
|
||||||
@ -308,7 +309,8 @@ struct sockaddr_in6 Socket::get_local_addr(int *r_err) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct sockaddr_in6 Socket::get_peer_addr(int *r_err) {
|
struct sockaddr_in6 Socket::get_peer_addr(int *r_err) {
|
||||||
struct sockaddr_in6 peeraddr;
|
struct sockaddr_in6 peeraddr = { 0 };
|
||||||
|
|
||||||
ERR_FAIL_COND_V(_socket == 0, peeraddr);
|
ERR_FAIL_COND_V(_socket == 0, peeraddr);
|
||||||
|
|
||||||
memset(&peeraddr, 0, sizeof(peeraddr));
|
memset(&peeraddr, 0, sizeof(peeraddr));
|
||||||
|
Loading…
Reference in New Issue
Block a user