You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2017/04/26 21:05:24 UTC

[2/5] mesos git commit: CMake: Cleaned up 3rdparty dependencies.

CMake: Cleaned up 3rdparty dependencies.

This commit removes duplicate code from `3rdparty/CMakeLists.txt`,
and consolidates platform-specific versions into `Versions.cmake`.

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


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

Branch: refs/heads/master
Commit: 4d2fbd784f9e0bb5f430644b9b2e83a80f27fd58
Parents: f5cec0d
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Tue Apr 25 18:27:07 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Wed Apr 26 14:04:08 2017 -0700

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt                     | 129 +++++++++--------------
 3rdparty/cmake/Mesos3rdpartyConfigure.cmake |  10 +-
 3rdparty/cmake/Versions.cmake               |  26 ++++-
 cmake/CompilationConfigure.cmake            |  27 +++--
 4 files changed, 90 insertions(+), 102 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4d2fbd78/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index c6bcbcb..a1f0713 100755
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -16,56 +16,46 @@
 
 include(ExternalProject)
 
-# DEPENDENCIES FOR THE PROCESS LIBRARY AND STOUT.
-#
-# Downloads, configures, and compiles the third-party libraries for the process
-# library (located in `3rdparty/`).
-###############################################################################
-
 # Define sources of third-party dependencies.
 #############################################
-set(UPSTREAM_URL ${3RDPARTY_DEPENDENCIES})
-set(REBUNDLED_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 if (REBUNDLED)
-  set(BOOST_URL       ${REBUNDLED_DIR}/boost-${BOOST_VERSION}.tar.gz)
-  set(ELFIO_URL       ${REBUNDLED_DIR}/elfio-${ELFIO_VERSION}.tar.gz)
-  set(GLOG_URL        ${REBUNDLED_DIR}/glog-${GLOG_VERSION}.tar.gz)
-  set(PICOJSON_URL    ${REBUNDLED_DIR}/picojson-${PICOJSON_VERSION}.tar.gz)
-  set(NVML_URL        ${REBUNDLED_DIR}/nvml-${NVML_VERSION}.tar.gz)
-  set(HTTP_PARSER_URL ${REBUNDLED_DIR}/http-parser-${HTTP_PARSER_VERSION}.tar.gz)
-  set(LIBEV_URL       ${REBUNDLED_DIR}/libev-${LIBEV_VERSION}.tar.gz)
+  set(FETCH_URL ${CMAKE_CURRENT_SOURCE_DIR})
 else (REBUNDLED)
-  set(BOOST_URL       ${UPSTREAM_URL}/boost-${BOOST_VERSION}.tar.gz)
-  set(ELFIO_URL       ${UPSTREAM_URL}/elfio-${ELFIO_VERSION}.tar.gz)
-  set(GLOG_URL        ${UPSTREAM_URL}/glog-${GLOG_VERSION}.tar.gz)
-  set(PICOJSON_URL    ${UPSTREAM_URL}/picojson-${PICOJSON_VERSION}.tar.gz)
-  set(NVML_URL        ${UPSTREAM_URL}/nvml-${NVML_VERSION}.tar.gz)
-  set(HTTP_PARSER_URL ${UPSTREAM_URL}/http-parser-${HTTP_PARSER_VERSION}.tar.gz)
-  set(LIBEV_URL       ${UPSTREAM_URL}/libev-${LIBEV_VERSION}.tar.gz)
+  set(FETCH_URL ${3RDPARTY_DEPENDENCIES})
 endif (REBUNDLED)
 
+
+# DEPENDENCIES FOR THE PROCESS LIBRARY AND STOUT.
+#
+# Downloads, configures, and compiles the third-party libraries for the process
+# library (located in `3rdparty/`, i.e. not the `mesos-3rdparty` repository).
+###############################################################################
+set(BOOST_URL       ${FETCH_URL}/boost-${BOOST_VERSION}.tar.gz)
+set(ELFIO_URL       ${FETCH_URL}/elfio-${ELFIO_VERSION}.tar.gz)
+set(GLOG_URL        ${FETCH_URL}/glog-${GLOG_VERSION}.tar.gz)
+set(HTTP_PARSER_URL ${FETCH_URL}/http-parser-${HTTP_PARSER_VERSION}.tar.gz)
+set(PICOJSON_URL    ${FETCH_URL}/picojson-${PICOJSON_VERSION}.tar.gz)
+set(NVML_URL        ${FETCH_URL}/nvml-${NVML_VERSION}.tar.gz)
+set(LIBEV_URL       ${FETCH_URL}/libev-${LIBEV_VERSION}.tar.gz)
+
 # NOTE: libevent doesn't come rebundled, so this URL is always the same. But,
 # it's only downloaded if `ENABLE_LIBEVENT` is set.
-set(LIBEVENT_URL ${UPSTREAM_URL}/libevent-release-${LIBEVENT_VERSION}.tar.gz)
+set(LIBEVENT_URL ${3RDPARTY_DEPENDENCIES}/libevent-release-${LIBEVENT_VERSION}.tar.gz)
 
 if (WIN32)
-  # TODO(hausdorff): (MESOS-3394) Upgrade Windows to use glog v0.3.5 when they
-  # release it, as that will contain fixes that will allow us to build glog on
-  # Windows, as well as build using CMake directly. For now, we simply point
-  # Windows builds at a commit hash in the glog history that has all the
-  # functionality we want.
-  #
-  # Finally, for our third-party libraries, MSVC 1800 and 1900 are not
-  # linker-compatible, so it's important for us to be able to build glog
-  # (as well as all the other third-party dependencies) on MSVC 1900.
-  #
-  # [1] https://github.com/google/glog/pull/43
-  set(GLOG_URL   ${UPSTREAM_URL}/glog-da816ea70.tar.gz)
-  set(CURL_URL   ${UPSTREAM_URL}/curl-${CURL_VERSION}.tar.gz)
-  set(LIBAPR_URL ${UPSTREAM_URL}/libapr-${LIBAPR_VERSION}.tar.gz)
-  set(ZLIB_URL   ${UPSTREAM_URL}/zlib-${ZLIB_VERSION}.tar.gz)
+  # NOTE: These dependencies are only rebundled on Windows because they
+  # are available as installable packages on Linux; so they live
+  # exclusively in the 3rdparty repo.
+  set(CURL_URL   ${3RDPARTY_DEPENDENCIES}/curl-${CURL_VERSION}.tar.gz)
+  set(LIBAPR_URL ${3RDPARTY_DEPENDENCIES}/libapr-${LIBAPR_VERSION}.tar.gz)
+  set(ZLIB_URL   ${3RDPARTY_DEPENDENCIES}/zlib-${ZLIB_VERSION}.tar.gz)
+
+  # NOTE: The Windows version of Glog is patched and only available in the
+  # 3rdparty repo, not the local repo.
+  set(GLOG_URL   ${3RDPARTY_DEPENDENCIES}/glog-${GLOG_VERSION}.tar.gz)
 endif (WIN32)
 
+
 # Define build/patch/configure commands for third-party libs.
 #############################################################
 # NOTE: (fix for MESOS-3250) A few third-party libraries (libev, gmock) do not
@@ -94,7 +84,7 @@ if (NOT WIN32)
   set(GLOG_INSTALL_CMD make install)
   # Patch glog to deal with a problem that appears when compiling on clang
   # under the C++11 standard. cf. MESOS-860, MESOS-966.
-  PATCH_CMD(${MESOS_3RDPARTY_SRC}/glog-0.3.3.patch GLOG_PATCH_CMD)
+  PATCH_CMD(${MESOS_3RDPARTY_SRC}/glog-${GLOG_VERSION}.patch GLOG_PATCH_CMD)
 
   # NOTE: `libev` is "installed" into a lib directory, see "NOTE: (fix for
   # MESOS-3250)" comment above for explanation.
@@ -107,7 +97,7 @@ if (NOT WIN32)
   set(LIBEVENT_INSTALL_CMD mkdir -p ${LIBEVENT_LIB_ROOT} && cp -r ${LIBEVENT_ROOT}-build/lib/. ${LIBEVENT_LIB_DIR} && cp -r ${LIBEVENT_ROOT}-build/include/. ${LIBEVENT_INCLUDE_DIR} && cp -r ${LIBEVENT_ROOT}/include/. ${LIBEVENT_INCLUDE_DIR})
 elseif (WIN32)
   set(GLOG_INSTALL_CMD ${CMAKE_NOOP})
-  set(GLOG_PATCH_CMD ${PATCHEXE_LOCATION} -p1 < ${MESOS_3RDPARTY_SRC}/glog-da816ea70.patch)
+  set(GLOG_PATCH_CMD ${PATCHEXE_LOCATION} -p1 < ${MESOS_3RDPARTY_SRC}/glog-${GLOG_VERSION}.patch)
 
   set(LIBEVENT_INSTALL_CMD ${CMAKE_NOOP})
 
@@ -158,6 +148,7 @@ if (NOT WIN32)
     )
 endif (NOT WIN32)
 
+
 # Third-party libraries. Tell the build system how to pull in and build third-
 # party libraries at compile time, using the ExternalProject_Add macro.
 ##############################################################################
@@ -252,6 +243,7 @@ if (WIN32)
     )
 endif (WIN32)
 
+
 # Windows third-party libraries. Windows has no package manager, so we download
 # them here.
 ###############################################################################
@@ -283,7 +275,6 @@ endif (WIN32)
 # Downloads, configures, and compiles the third-party libraries for the process
 # library tests (located in `3rdparty/`).
 ###############################################################################
-
 list(
   APPEND CMAKE_MODULE_PATH
   ${CMAKE_SOURCE_DIR}/3rdparty/stout/cmake
@@ -291,21 +282,14 @@ list(
 include(StoutConfigure)
 include(StoutTestsConfigure)
 
-if (REBUNDLED)
-  set(GMOCK_URL    ${REBUNDLED_DIR}/gmock-${GMOCK_VERSION}.tar.gz)
-  set(PROTOBUF_URL ${REBUNDLED_DIR}/protobuf-${PROTOBUF_VERSION}.tar.gz)
-else (REBUNDLED)
-  set(GMOCK_URL    ${UPSTREAM_URL}/gmock-${GMOCK_VERSION}.tar.gz)
-  set(PROTOBUF_URL ${UPSTREAM_URL}/protobuf-${PROTOBUF_VERSION}.tar.gz)
-endif (REBUNDLED)
-
-if (WIN32)
-  # TODO(hausdorff): (MESOS-3453) this is a patched version of the protobuf
-  # library that compiles on Windows. We need to either send this as a PR back
-  # to the protobuf project, or we need to apply these changes to our existing
-  # protobuf tarball in the patch step.
-  set(PROTOBUF_URL ${UPSTREAM_URL}/protobuf-3.0.0-beta-2.tar.gz)
-endif (WIN32)
+set(GMOCK_URL    ${FETCH_URL}/gmock-${GMOCK_VERSION}.tar.gz)
+# NOTE: The Windows version of protobuf is patched and only available in the
+# 3rdparty repo, not the local repo.
+if (NOT WIN32)
+  set(PROTOBUF_URL ${FETCH_URL}/protobuf-${PROTOBUF_VERSION}.tar.gz)
+elseif (WIN32)
+  set(PROTOBUF_URL ${3RDPARTY_DEPENDENCIES}/protobuf-${PROTOBUF_VERSION}.tar.gz)
+endif (NOT WIN32)
 
 # NOTE: `gmock` is "installed" into a lib directory, see "NOTE: (fix for
 # MESOS-3250)" comment above for explanation.
@@ -316,7 +300,7 @@ elseif (WIN32)
 endif (NOT WIN32)
 
 if (NOT WIN32)
-  PATCH_CMD(${MESOS_3RDPARTY_SRC}/protobuf-2.6.1.patch PROTOBUF_PATCH_CMD)
+  PATCH_CMD(${MESOS_3RDPARTY_SRC}/protobuf-${PROTOBUF_VERSION}.patch PROTOBUF_PATCH_CMD)
   set(PROTOBUF_CONFIG_CMD  ${PROTOBUF_ROOT}/src/../configure --prefix=${PROTOBUF_LIB_ROOT})
   set(PROTOBUF_BUILD_CMD   make)
   set(PROTOBUF_INSTALL_CMD make install)
@@ -365,7 +349,6 @@ add_subdirectory(stout/tests)
 #
 # Builds, configures, and compiles the process library and assorted tests.
 ##########################################################################
-
 add_subdirectory(libprocess)
 
 
@@ -373,28 +356,15 @@ add_subdirectory(libprocess)
 #
 # Downloads, configures, and compiles the third-party libraries for the mesos.
 ###################################################
+set(LEVELDB_URL   ${FETCH_URL}/leveldb-${LEVELDB_VERSION}.tar.gz)
+# NOTE: The Windows version of ZooKeeper is patched and only available in the
+# 3rdparty repo, not the local repo.
+if (NOT WIN32)
+  set(ZOOKEEPER_URL ${FETCH_URL}/zookeeper-${ZOOKEEPER_VERSION}.tar.gz)
+elseif (WIN32)
+  set(ZOOKEEPER_URL ${3RDPARTY_DEPENDENCIES}/zookeeper-${ZOOKEEPER_VERSION}.tar.gz)
+endif (NOT WIN32)
 
-# Define sources of third-party dependencies.
-#############################################
-set(UPSTREAM_URL ${3RDPARTY_DEPENDENCIES})
-
-set(REBUNDLED_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-
-if (REBUNDLED)
-  set(LEVELDB_URL   ${REBUNDLED_DIR}/leveldb-${LEVELDB_VERSION}.tar.gz)
-  set(ZOOKEEPER_URL ${REBUNDLED_DIR}/zookeeper-${ZOOKEEPER_VERSION}.tar.gz)
-else (REBUNDLED)
-  set(LEVELDB_URL   ${UPSTREAM_URL}/leveldb-${LEVELDB_VERSION}.tar.gz)
-  set(ZOOKEEPER_URL ${UPSTREAM_URL}/zookeeper-${ZOOKEEPER_VERSION}.tar.gz)
-endif (REBUNDLED)
-
-if (WIN32)
-  # Similar to glog, on Windows, we use a different version of ZK. We'll
-  # eventually want to upgrade the Mesos project but for now this version of ZK
-  # does not come rebundled in the Mesos repository, so we need to get it from
-  # our canonical package mirror.
-  set(ZOOKEEPER_URL ${UPSTREAM_URL}/zookeeper-${ZOOKEEPER_VERSION}.tar.gz)
-endif (WIN32)
 
 # Define build/patch/configure commands for third-party libs.
 #############################################################
@@ -427,6 +397,7 @@ elseif (WIN32)
   set(ZOOKEEPER_INSTALL_CMD ${CMAKE_NOOP})
 endif (NOT WIN32)
 
+
 # Third-party libraries. Tell the build system how to pull in and build third-
 # party libraries at compile time, using the ExternalProject_Add macro.
 ##############################################################################

http://git-wip-us.apache.org/repos/asf/mesos/blob/4d2fbd78/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Mesos3rdpartyConfigure.cmake b/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
index c606526..4203071 100755
--- a/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
+++ b/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
@@ -20,14 +20,12 @@ set(MESOS_3RDPARTY_SRC ${CMAKE_SOURCE_DIR}/3rdparty)
 set(MESOS_3RDPARTY_BIN ${CMAKE_BINARY_DIR}/3rdparty)
 
 if (NOT WIN32)
-  EXTERNAL("leveldb"   ${LEVELDB_VERSION}   "${MESOS_3RDPARTY_BIN}")
-  EXTERNAL("zookeeper" ${ZOOKEEPER_VERSION} "${MESOS_3RDPARTY_BIN}")
-elseif (WIN32)
-  # The latest release of ZK, 3.4.7, does not compile on Windows. Therefore, we
-  # pick a recent commit that does until the next release stabilizes.
-  EXTERNAL("zookeeper" "06d3f3f" "${MESOS_3RDPARTY_BIN}")
+  # LevelDB does not build on Windows.
+  EXTERNAL("leveldb" ${LEVELDB_VERSION} "${MESOS_3RDPARTY_BIN}")
 endif (NOT WIN32)
 
+EXTERNAL("zookeeper" ${ZOOKEEPER_VERSION} "${MESOS_3RDPARTY_BIN}")
+
 # Intermediate convenience variables for oddly-structured directories.
 set(ZOOKEEPER_C_ROOT ${ZOOKEEPER_ROOT}/src/c)
 set(ZOOKEEPER_LIB    ${ZOOKEEPER_ROOT}/src/c)

http://git-wip-us.apache.org/repos/asf/mesos/blob/4d2fbd78/3rdparty/cmake/Versions.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
index 9127263..2bb9b34 100644
--- a/3rdparty/cmake/Versions.cmake
+++ b/3rdparty/cmake/Versions.cmake
@@ -1,7 +1,6 @@
 set(BOOST_VERSION       "1.53.0")
 set(CURL_VERSION        "7.43.0")
 set(ELFIO_VERSION       "3.2")
-set(GLOG_VERSION        "0.3.3")
 set(GMOCK_VERSION       "1.7.0")
 set(HTTP_PARSER_VERSION "2.6.2")
 set(LEVELDB_VERSION     "1.19")
@@ -11,6 +10,27 @@ set(LIBEV_VERSION       "4.22")
 set(LIBEVENT_VERSION    "2.1.5-beta")
 set(NVML_VERSION        "352.79")
 set(PICOJSON_VERSION    "1.3.0")
-set(PROTOBUF_VERSION    "2.6.1")
-set(ZOOKEEPER_VERSION   "3.4.8")
 set(ZLIB_VERSION        "1.2.8")
+
+# Platform-dependent versions.
+if (NOT WIN32)
+  set(GLOG_VERSION      "0.3.3")
+  set(PROTOBUF_VERSION  "2.6.1")
+  set(ZOOKEEPER_VERSION "3.4.8")
+else (NOT WIN32)
+  # TODO(hausdorff): (MESOS-3394) Upgrade Windows to use glog v0.3.5 when they
+  # release it, as that will contain fixes that will allow us to build glog on
+  # Windows, as well as build using CMake directly. For now, we simply point
+  # Windows builds at a commit hash in the glog history that has all the
+  # functionality we want.
+  set(GLOG_VERSION      "da816ea70")
+
+  # TODO(hausdorff): (MESOS-3453) this is a patched version of the protobuf
+  # library that compiles on Windows. We need to send this as a PR back to the
+  # protobuf project.
+  set(PROTOBUF_VERSION  "3.0.0-beta-2")
+
+  # The latest release of ZK, 3.4.7, does not compile on Windows. Therefore, we
+  # pick a recent commit that does until the next release stabilizes.
+  set(ZOOKEEPER_VERSION "06d3f3f")
+endif (NOT WIN32)

http://git-wip-us.apache.org/repos/asf/mesos/blob/4d2fbd78/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index dfaf6a6..7b2669f 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -112,28 +112,27 @@ if (WIN32 AND HAS_AUTHENTICATION)
     "`-DHAS_AUTHENTICATION=0` as an argument when you run CMake.")
 endif (WIN32 AND HAS_AUTHENTICATION)
 
-# If 'REBUNDLED' is set to FALSE, this will cause Mesos to build against
-# the specified dependency repository.  This is especially useful for
-# Windows builds, because building on MSVC 1900 requires newer versions
-# of ZK, glog, and libevent, than the ones bundled in the Mesos repository.
+# If 'REBUNDLED' is set to FALSE, this will cause Mesos to build against the
+# specified dependency repository. This is especially useful for Windows
+# builds, because building on MSVC 1900 requires newer versions of some
+# dependencies than the ones bundled in the Mesos repository.
 set(
   3RDPARTY_DEPENDENCIES "https://github.com/3rdparty/mesos-3rdparty/raw/master"
   CACHE STRING
     "URL or filesystem path with a fork of the canonical 3rdparty repository")
 
-if (REBUNDLED AND ENABLE_LIBEVENT)
-  message(
-    WARNING
-    "Both `ENABLE_LIBEVENT` and `REBUNDLED` (set to TRUE by default) flags "
-    "have been set.  Libevent does not come rebundled in Mesos, so it will "
-    "be downloaded.")
-endif (REBUNDLED AND ENABLE_LIBEVENT)
-
 if (WIN32 AND REBUNDLED)
   message(
     WARNING
-    "The current supported version of ZK does not compile on Windows, and does "
-    "not come rebundled in the Mesos repository.  It will be downloaded from "
+    "On Windows, the required versions of:\n"
+    "  * ZooKeeper\n"
+    "  * protobuf\n"
+    "  * glog\n"
+    "  * libevent\n"
+    "  * curl\n"
+    "  * libapr\n"
+    "  * zlib\n"
+    "do not come rebundled in the Mesos repository.  They will be downloaded from "
     "the Internet, even though the `REBUNDLED` flag was set.")
 endif (WIN32 AND REBUNDLED)