mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 10:33:52 +01:00
Problem: no windows UWP support
* add define for windows/UWP * prevent issue with COM references * gettickcount not available on uwp * add compiler definitions * add convenitnece cmake file * brute force uwp compilation * fix compiler version * cosmetics
This commit is contained in:
parent
e224cc9061
commit
1d58a00992
@ -181,6 +181,10 @@ include (CheckCXXSymbolExists)
|
||||
|
||||
check_include_files (ifaddrs.h ZMQ_HAVE_IFADDRS)
|
||||
check_include_files (windows.h ZMQ_HAVE_WINDOWS)
|
||||
if( ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore" AND ${CMAKE_SYSTEM_VERSION} STREQUAL "10.0")
|
||||
SET(ZMQ_HAVE_WINDOWS_UWP ON)
|
||||
ADD_DEFINITIONS(-D_WIN32_WINNT=_WIN32_WINNT_WIN10)
|
||||
endif()
|
||||
check_include_files (sys/uio.h ZMQ_HAVE_UIO)
|
||||
check_include_files (sys/eventfd.h ZMQ_HAVE_EVENTFD)
|
||||
if (ZMQ_HAVE_EVENTFD)
|
||||
|
6
INSTALL
6
INSTALL
@ -41,6 +41,12 @@ Windows Builds
|
||||
|
||||
For Windows building, see the libzmq\builds\msvc\readme.txt file.
|
||||
|
||||
The library can also be built for the Windows 10 UWP platform through CMake :
|
||||
cmake -H. -B<build dir> -G"Visual Studio 14 2015 Win64" \
|
||||
-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 \
|
||||
-DENABLE_CURVE=OFF -DZMQ_BUILD_TESTS=OFF
|
||||
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
|
@ -94,5 +94,6 @@
|
||||
#endif
|
||||
|
||||
#cmakedefine ZMQ_HAVE_WINDOWS
|
||||
#cmakedefine ZMQ_HAVE_WINDOWS_UWP
|
||||
|
||||
#endif
|
||||
|
@ -84,6 +84,10 @@ static zmq::mutex_t compatible_get_tick_count64_mutex;
|
||||
|
||||
ULONGLONG compatible_get_tick_count64()
|
||||
{
|
||||
#ifdef ZMQ_HAVE_WINDOWS_UWP
|
||||
const ULONGLONG result = ::GetTickCount64();
|
||||
return result;
|
||||
#else
|
||||
zmq::scoped_lock_t locker(compatible_get_tick_count64_mutex);
|
||||
|
||||
static DWORD s_wrap = 0;
|
||||
@ -97,19 +101,24 @@ ULONGLONG compatible_get_tick_count64()
|
||||
const ULONGLONG result = (static_cast<ULONGLONG>(s_wrap) << 32) + static_cast<ULONGLONG>(current_tick);
|
||||
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
f_compatible_get_tick_count64 init_compatible_get_tick_count64()
|
||||
{
|
||||
f_compatible_get_tick_count64 func = NULL;
|
||||
#if !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
|
||||
HMODULE module = ::LoadLibraryA("Kernel32.dll");
|
||||
if (module != NULL)
|
||||
func = reinterpret_cast<f_compatible_get_tick_count64>(::GetProcAddress(module, "GetTickCount64"));
|
||||
|
||||
#endif
|
||||
if (func == NULL)
|
||||
func = compatible_get_tick_count64;
|
||||
|
||||
#if !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
::FreeLibrary(module);
|
||||
#endif
|
||||
|
||||
return func;
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
||||
}
|
||||
|
||||
#elif defined ZMQ_HAVE_WINDOWS
|
||||
# if !defined _WIN32_WCE
|
||||
# if !defined _WIN32_WCE && !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
// Windows CE does not manage security attributes
|
||||
SECURITY_DESCRIPTOR sd;
|
||||
SECURITY_ATTRIBUTES sa;
|
||||
@ -434,7 +434,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
||||
int event_signaler_port = 5905;
|
||||
|
||||
if (signaler_port == event_signaler_port) {
|
||||
# if !defined _WIN32_WCE
|
||||
# if !defined _WIN32_WCE && !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
sync = CreateEventW (&sa, FALSE, TRUE, L"Global\\zmq-signaler-port-sync");
|
||||
# else
|
||||
sync = CreateEventW (NULL, FALSE, TRUE, L"Global\\zmq-signaler-port-sync");
|
||||
@ -454,7 +454,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
||||
swprintf (mutex_name, MAX_PATH, L"Global\\zmq-signaler-port-%d", signaler_port);
|
||||
# endif
|
||||
|
||||
# if !defined _WIN32_WCE
|
||||
# if !defined _WIN32_WCE && !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
sync = CreateMutexW (&sa, FALSE, mutex_name);
|
||||
# else
|
||||
sync = CreateMutexW (NULL, FALSE, mutex_name);
|
||||
@ -575,7 +575,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
||||
}
|
||||
|
||||
if (*r_ != INVALID_SOCKET) {
|
||||
# if !defined _WIN32_WCE
|
||||
# if !defined _WIN32_WCE && !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
// On Windows, preventing sockets to be inherited by child processes.
|
||||
BOOL brc = SetHandleInformation ((HANDLE) *r_, HANDLE_FLAG_INHERIT, 0);
|
||||
win_assert (brc);
|
||||
|
@ -240,12 +240,16 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_, bool is_
|
||||
#include <netioapi.h>
|
||||
|
||||
int zmq::tcp_address_t::get_interface_name(unsigned long index, char ** dest) const {
|
||||
char * buffer = (char*)malloc(IF_MAX_STRING_SIZE);
|
||||
#ifdef ZMQ_HAVE_WINDOWS_UWP
|
||||
char * buffer = (char*)malloc(1024);
|
||||
#else
|
||||
char * buffer = (char*)malloc(IF_MAX_STRING_SIZE);
|
||||
#endif
|
||||
alloc_assert(buffer);
|
||||
|
||||
char * if_name_result = NULL;
|
||||
|
||||
#ifndef ZMQ_HAVE_WINDOWS_TARGET_XP
|
||||
#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP && !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
if_name_result = if_indextoname(index, buffer);
|
||||
#endif
|
||||
|
||||
@ -613,7 +617,7 @@ int zmq::tcp_address_t::resolve (const char *name_, bool local_, bool ipv6_, boo
|
||||
std::string if_str = addr_str.substr(pos + 1);
|
||||
addr_str = addr_str.substr(0, pos);
|
||||
if (isalpha (if_str.at (0)))
|
||||
#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP
|
||||
#if !defined ZMQ_HAVE_WINDOWS_TARGET_XP && !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
zone_id = if_nametoindex(if_str.c_str());
|
||||
#else
|
||||
// The function 'if_nametoindex' is not supported on Windows XP.
|
||||
|
@ -189,7 +189,7 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
|
||||
errno = wsa_error_to_errno (WSAGetLastError ());
|
||||
return -1;
|
||||
}
|
||||
#if !defined _WIN32_WCE
|
||||
#if !defined _WIN32_WCE && !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
// On Windows, preventing sockets to be inherited by child processes.
|
||||
BOOL brc = SetHandleInformation ((HANDLE) s, HANDLE_FLAG_INHERIT, 0);
|
||||
win_assert (brc);
|
||||
@ -288,7 +288,7 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
|
||||
last_error == WSAENOBUFS);
|
||||
return retired_fd;
|
||||
}
|
||||
#if !defined _WIN32_WCE
|
||||
#if !defined _WIN32_WCE && !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
// On Windows, preventing sockets to be inherited by child processes.
|
||||
BOOL brc = SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, 0);
|
||||
win_assert (brc);
|
||||
|
@ -39,10 +39,14 @@
|
||||
|
||||
// Set target version to Windows Server 2008, Windows Vista or higher.
|
||||
// Windows XP (0x0501) is supported but without client & server socket types.
|
||||
#ifndef _WIN32_WINNT
|
||||
#if !defined _WIN32_WINNT && !defined ZMQ_HAVE_WINDOWS_UWP
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#endif
|
||||
|
||||
#if defined ZMQ_HAVE_WINDOWS_UWP
|
||||
#define _WIN32_WINNT _WIN32_WINNT_WIN10
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
// Require Windows XP or higher with MinGW for getaddrinfo().
|
||||
#if(_WIN32_WINNT >= 0x0600)
|
||||
|
Loading…
Reference in New Issue
Block a user