CMake: Added libevent version, configured Windows to use as default.

Mesos will need to use libevent to build the process library on Windows.

This commit will add a default version of libevent, which we will
eventually retrieve from the 3rdparty GitHub repository, which for now
is our "official" distribution channel for out-of-band third-party
dependencies (especially on Windows, which has no package manager).

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


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

Branch: refs/heads/master
Commit: e9c64fbe0a145c746402b1eee0c9116376bba016
Parents: a2af52a
Author: Alex Clemmer <[email protected]>
Authored: Sun Sep 27 15:41:24 2015 -0700
Committer: Joris Van Remoortere <[email protected]>
Committed: Sun Sep 27 16:13:13 2015 -0700

----------------------------------------------------------------------
 3rdparty/cmake/Versions.cmake |  2 ++
 CMakeLists.txt                | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/e9c64fbe/3rdparty/cmake/Versions.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
index b3b94f2..18f1168 100644
--- a/3rdparty/cmake/Versions.cmake
+++ b/3rdparty/cmake/Versions.cmake
@@ -4,5 +4,7 @@ set(GLOG_VERSION        "0.3.3")
 set(GMOCK_VERSION       "1.7.0")
 set(HTTP_PARSER_VERSION "1c3624a")
 set(LIBEV_VERSION       "4.15")
+# TODO(hausdorff): (MESOS-3529) transition this back to a non-beta version.
+set(LIBEVENT_VERSION    "2.1.5-beta")
 set(PICOJSON_VERSION    "1.3.0")
 set(PROTOBUF_VERSION    "2.5.0")

http://git-wip-us.apache.org/repos/asf/mesos/blob/e9c64fbe/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index de02c2c..a5559b5 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,8 +31,42 @@ option(
   "Build dependencies from tar.gz files in 3rdparty folder instead of 
downloading"
   TRUE
   )
+option(
+  ENABLE_LIBEVENT
+  "Use libevent instead of default libev as the core event loop implementation"
+  FALSE
+  )
 set(CMAKE_VERBOSE_MAKEFILE ${VERBOSE})
 
+# TODO(hausdorff): add the code to allow libevent on Unix builds.
+if ((NOT WIN32) AND ENABLE_LIBEVENT)
+  message(
+    FATAL_ERROR
+    "The Mesos CMake-based build system currently only supports libevent on "
+    "Windows builds."
+    )
+endif ((NOT WIN32) AND ENABLE_LIBEVENT)
+
+if (REBUNDLED AND ENABLE_LIBEVENT)
+  message(
+    WARNING
+    "Both `ENABLE_LIBEVENT` and `REBUNDLED` (set to TRUE by default) flags "
+    "have been set. But, libevent does not come rebundled in Mesos, so it must 
"
+    "be downloaded."
+    )
+endif (REBUNDLED AND ENABLE_LIBEVENT)
+
+if (WIN32 AND (NOT ENABLE_LIBEVENT))
+  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. NOTE: although "
+    "the plan is to eventually transition to libevent, it is still in "
+    "experimental support, and the code path is much less well-exercised."
+    )
+endif (WIN32 AND (NOT ENABLE_LIBEVENT))
+
 # CMAKE MODULE SETUP.
 #####################
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)

Reply via email to