1
0
Fork 0

Add triagens force header for windows, as we did before.

This commit is contained in:
Wilfried Goesgens 2016-02-24 16:08:59 +01:00
parent 3833d9e462
commit aa6e229a3d
2 changed files with 17 additions and 0 deletions

View File

@ -20,6 +20,9 @@ endif ()
project(libev VERSION 4.22)
if (MSVC)
set (FLAGS "${FLAGS} /FI\"${PROJECT_SOURCE_DIR}/ev_triagens_win32.h\"")
foreach (flag_var
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
@ -110,6 +113,8 @@ add_library(ev STATIC
${LIBEV_DIR}/event.c
)
set_target_properties(ev PROPERTIES COMPILE_FLAGS "${FLAGS}")
set(LIBEV_VERSION
${libev_VERSION}
CACHE INTERNAL

12
3rdParty/libev/ev_triagens_win32.h vendored Normal file
View File

@ -0,0 +1,12 @@
// libev officially recommends to use _open_osfhandle to wrap a SOCKET
// handle into a file descriptor. However, one should never use
// _open_osfhandle for SOCKET handles. Therefore, we do the following
// hack: We simply cast a SOCKET handle to an int before we hand it over
// to libev. This means that we have to redefine the following three
// macros for our version of libev. We close the handle ourselves outside
// of libev. Please note that we only use libev for sockets and not for
// file descriptors of regular files!
#define EV_FD_TO_WIN32_HANDLE(fd) ((SOCKET) fd)
#define EV_WIN32_HANDLE_TO_FD(handle) ((int) handle)
#define EV_WIN32_CLOSE_FD(fd)