Added CMake `ENABLE_LIBWINIO` option for Windows IOCP backend.

This option will let us enable the new Windows IOCP backend for
libprocess. It can only be used on Windows, and it is mutually
exclusive with `ENABLE_LIBEVENT`. For now, it is disabled by default,
but this is expected to change, followed be a removal of libevent
support for Windows.

Review: https://reviews.apache.org/r/67391/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6bf70a19
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6bf70a19
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6bf70a19

Branch: refs/heads/master
Commit: 6bf70a1956325c509d65e6bcdba094b1c6bdf795
Parents: 5fd78df
Author: Akash Gupta <akash-gu...@hotmail.com>
Authored: Wed Jun 27 14:30:17 2018 -0700
Committer: Andrew Schwartzmeyer <and...@schwartzmeyer.com>
Committed: Wed Jun 27 15:06:10 2018 -0700

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt          |  2 +-
 cmake/CompilationConfigure.cmake | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6bf70a19/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 5e46b41..b58996d 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -571,7 +571,7 @@ if (ENABLE_LIBEVENT)
       target_link_libraries(libevent INTERFACE ${LIBEVENT_LIB})
     endforeach ()
   endif ()
-else ()
+elseif (NOT ENABLE_LIBWINIO)
   # libev: Full-featured high-performance event loop.
   # https://github.com/enki/libev
   ###################################################

http://git-wip-us.apache.org/repos/asf/mesos/blob/6bf70a19/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index e2ee89a..61387d7 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -107,6 +107,11 @@ if (ENABLE_LIBEVENT)
 endif()
 
 option(
+  ENABLE_LIBWINIO
+  "Use Windows IOCP instead of libev as the core event loop implementation."
+  FALSE)
+
+option(
   ENABLE_SSL
   "Build libprocess with SSL support."
   FALSE)
@@ -226,12 +231,21 @@ if (WIN32 AND REBUNDLED)
     "the Internet, even though the `REBUNDLED` flag was set.")
 endif ()
 
-if (WIN32 AND (NOT ENABLE_LIBEVENT))
+if (WIN32 AND (NOT ENABLE_LIBEVENT AND NOT ENABLE_LIBWINIO))
   message(
     FATAL_ERROR
     "Windows builds of Mesos currently do not support libev, the default event 
"
     "loop used by Mesos.  To opt into using libevent, pass "
-    "`-DENABLE_LIBEVENT=1` as an argument when you run CMake.")
+    "`-DENABLE_LIBEVENT=1` as an argument when you run CMake."
+    "To opt into using the native Windows IOCP implementation instead, "
+    "pass `-DENABLE_LIBWINIO=1` as an argument.")
+endif ()
+
+if (ENABLE_LIBWINIO AND (NOT WIN32))
+  message(
+    FATAL_ERROR
+    "Libwinio, which is the Windows IOCP event loop, only works on Windows. "
+    "Please use libev or libevent instead on non-Windows platforms.")
 endif ()
 
 if (ENABLE_SSL AND (NOT ENABLE_LIBEVENT))

Reply via email to