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:23 UTC

[1/5] mesos git commit: Windows: Updated ZooKeeper to use CMake.

Repository: mesos
Updated Branches:
  refs/heads/master 17139c5e5 -> 5ec64bec3


Windows: Updated ZooKeeper to use CMake.

This unblocks us from building exclusively with VS 2017. The previous
patch to ZooKeeper only added VS 2015 support. This patch replaces it
with a CMake build system that will generate whichever solution we need
for Windows (and can replace the Autotools system on Linux).

We're updating to 3.5.2-alpha as the existing 3.5.1 rebundle was a
source tarball, and so missing the necessary generated files. The most
currently used version was based off a random commit. 3.5.2-alpha is the
latest 3.5.x release of ZooKeeper (3.5.x itself is alpha, 3.5.2 is
semi-stable, in comparison to 3.5.3 which is in RC).

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


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

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

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt                     |  64 +-
 3rdparty/cmake/Mesos3rdpartyConfigure.cmake |   4 +-
 3rdparty/cmake/Versions.cmake               |   2 +-
 3rdparty/zookeeper-3.5.2-alpha.patch        | 729 +++++++++++++++++++++++
 4 files changed, 759 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6e64ffac/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index a1f0713..cb118f6 100755
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -366,51 +366,41 @@ elseif (WIN32)
 endif (NOT WIN32)
 
 
-# Define build/patch/configure commands for third-party libs.
-#############################################################
+# Third-party libraries. Tell the build system how to pull in and build third-
+# party libraries at compile time, using the ExternalProject_Add macro.
+##############################################################################
 if (NOT WIN32)
-  set(ZOOKEEPER_CONFIG_CMD  cd ${ZOOKEEPER_C_ROOT} && ./configure --enable-shared=no --with-pic --srcdir=. --prefix=${ZOOKEEPER_LIB})
-  set(ZOOKEEPER_BUILD_CMD   cd ${ZOOKEEPER_C_ROOT} && make)
-  set(ZOOKEEPER_INSTALL_CMD cd ${ZOOKEEPER_C_ROOT} && make install)
-
+  # NOTE: `ExternalProject_Add` is used separately because older versions
+  # of CMake used on Linux do not understand the `SOURCE_SUBDIR` command.
   PATCH_CMD(
     ${MESOS_3RDPARTY_SRC}/zookeeper-${ZOOKEEPER_VERSION}.patch
     ZOOKEEPER_PATCH_CMD)
+
+  ExternalProject_Add(
+    ${ZOOKEEPER_TARGET}
+    PREFIX            ${ZOOKEEPER_CMAKE_ROOT}
+    PATCH_COMMAND     ${ZOOKEEPER_PATCH_CMD}
+    CONFIGURE_COMMAND cd ${ZOOKEEPER_C_ROOT} && ./configure --enable-shared=no --with-pic --srcdir=. --prefix=${ZOOKEEPER_LIB}
+    BUILD_COMMAND     cd ${ZOOKEEPER_C_ROOT} && make
+    INSTALL_COMMAND   cd ${ZOOKEEPER_C_ROOT} && make install
+    URL               ${ZOOKEEPER_URL}
+    )
 elseif (WIN32)
-  # Set the patch command which will utilize patch.exe in temp location for no elevation prompt
-  # NOTE: We do not specify the `--binary` patch option here because the
-  # files being modified are extracted with CRLF (Windows) line endings
-  # already. The `--binary` option will instead fail to apply the patch.
-  set(
-    ZOOKEEPER_PATCH_CMD
-    ${PATCHEXE_LOCATION} -p1 < ${MESOS_3RDPARTY_SRC}/zookeeper-${ZOOKEEPER_VERSION}.patch)
-
-  VS_BUILD_CMD(
-    ZOOKEEPER
-    ${ZOOKEEPER_C_ROOT}/zookeeper-vs2015.sln
-    ${CMAKE_BUILD_TYPE}
-    ${ZOOKEEPER_C_ROOT}
-    "zookeeper"
+  ExternalProject_Add(
+    ${ZOOKEEPER_TARGET}
+    PREFIX            ${ZOOKEEPER_CMAKE_ROOT}
+    # Set the patch command which will utilize patch.exe in temp location for no elevation prompt
+    # NOTE: We do not specify the `--binary` patch option here because the
+    # files being modified are extracted with CRLF (Windows) line endings
+    # already. The `--binary` option will instead fail to apply the patch.
+    PATCH_COMMAND     ${PATCHEXE_LOCATION} -p1 < ${MESOS_3RDPARTY_SRC}/zookeeper-${ZOOKEEPER_VERSION}.patch
+    SOURCE_SUBDIR     src/c
+    CMAKE_ARGS        -DWANT_CPPUNIT=0
+    INSTALL_COMMAND   ${CMAKE_NOOP}
+    URL               ${ZOOKEEPER_URL}
     )
-
-  set(ZOOKEEPER_CONFIG_CMD  ${CMAKE_NOOP})
-  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.
-##############################################################################
-ExternalProject_Add(
-  ${ZOOKEEPER_TARGET}
-  PREFIX            ${ZOOKEEPER_CMAKE_ROOT}
-  PATCH_COMMAND     ${ZOOKEEPER_PATCH_CMD}
-  CONFIGURE_COMMAND ${ZOOKEEPER_CONFIG_CMD}
-  BUILD_COMMAND     ${ZOOKEEPER_BUILD_CMD}
-  INSTALL_COMMAND   ${ZOOKEEPER_INSTALL_CMD}
-  URL               ${ZOOKEEPER_URL}
-  )
-
 if (NOT WIN32)
   set(LEVELDB_CONFIG_CMD  cd ${LEVELDB_ROOT} && ./configure --prefix=${LEVELDB_ROOT}-lib)
   set(LEVELDB_BUILD_CMD   cd ${LEVELDB_ROOT} && make OPT=-O2\ -g\ -fPIC)

http://git-wip-us.apache.org/repos/asf/mesos/blob/6e64ffac/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Mesos3rdpartyConfigure.cmake b/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
index 4203071..61f4794 100755
--- a/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
+++ b/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
@@ -39,7 +39,7 @@ set(ZOOKEEPER_INCLUDE_DIR ${ZOOKEEPER_C_ROOT}/include)
 if (NOT WIN32)
   set(ZOOKEEPER_LIB_DIR ${ZOOKEEPER_LIB})
 else (NOT WIN32)
-  set(ZOOKEEPER_LIB_DIR ${ZOOKEEPER_LIB}/x64/${CMAKE_BUILD_TYPE})
+  set(ZOOKEEPER_LIB_DIR ${ZOOKEEPER_ROOT}-build/${CMAKE_BUILD_TYPE})
 endif (NOT WIN32)
 
 # Convenience variables for "lflags", the symbols we pass to CMake to generate
@@ -48,7 +48,7 @@ if (NOT WIN32)
   set(LEVELDB_LFLAG   ${LEVELDB_ROOT}/out-static/libleveldb.a)
   set(ZOOKEEPER_LFLAG ${ZOOKEEPER_LIB}/lib/libzookeeper_mt.a)
 else (NOT WIN32)
-  set(ZOOKEEPER_LFLAG zookeeper)
+  set(ZOOKEEPER_LFLAG zookeeper hashtable)
 endif (NOT WIN32)
 
 # Configure Windows use of the GNU patch utility;

http://git-wip-us.apache.org/repos/asf/mesos/blob/6e64ffac/3rdparty/cmake/Versions.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
index 2bb9b34..728f88f 100644
--- a/3rdparty/cmake/Versions.cmake
+++ b/3rdparty/cmake/Versions.cmake
@@ -32,5 +32,5 @@ else (NOT 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.
-  set(ZOOKEEPER_VERSION "06d3f3f")
+  set(ZOOKEEPER_VERSION "3.5.2-alpha")
 endif (NOT WIN32)

http://git-wip-us.apache.org/repos/asf/mesos/blob/6e64ffac/3rdparty/zookeeper-3.5.2-alpha.patch
----------------------------------------------------------------------
diff --git a/3rdparty/zookeeper-3.5.2-alpha.patch b/3rdparty/zookeeper-3.5.2-alpha.patch
new file mode 100644
index 0000000..6d5db53
--- /dev/null
+++ b/3rdparty/zookeeper-3.5.2-alpha.patch
@@ -0,0 +1,729 @@
+diff --git c/src/c/CMakeLists.txt w/src/c/CMakeLists.txt
+new file mode 100644
+index 000000000..85e500e05
+--- /dev/null
++++ w/src/c/CMakeLists.txt
+@@ -0,0 +1,204 @@
++cmake_minimum_required(VERSION 3.6)
++
++project(zookeeper VERSION 3.5.2)
++set(email user@zookeeper.apache.org)
++set(description "zookeeper C client")
++
++# general options
++include_directories(include tests generated ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
++if(UNIX)
++  add_compile_options(-Wall -fPIC)
++elseif(WIN32)
++  add_compile_options(/W3)
++endif()
++add_definitions(-DUSE_STATIC_LIB)
++
++# TODO: Enable /WX and /W4 on Windows. Currently there are ~1000 warnings.
++# TODO: Add Solaris support.
++# TODO: Add debug configuration.
++# TODO: Add a shared library option.
++
++# Sync API option
++option(WANT_SYNCAPI "Enables Sync API support" ON)
++if(WANT_SYNCAPI)
++  add_definitions(-DTHREADED)
++  if(WIN32)
++    add_compile_options(/MT)
++  endif()
++endif()
++
++# CppUnit option
++option(WANT_CPPUNIT "Enables CppUnit" ON)
++
++# header checks
++function(to_have in out)
++  string(TOUPPER ${in} str)
++  string(REGEX REPLACE "/|\\." "_" str ${str})
++  set(${out} "HAVE_${str}" PARENT_SCOPE)
++endfunction()
++
++# include file checks
++foreach(f generated/zookeeper.jute.h generated/zookeeper.jute.c)
++  if(EXISTS "${CMAKE_SOURCE_DIR}/${f}")
++    to_have(${f} name)
++    set(${name} 1)
++  else()
++    message(FATAL_ERROR
++      "jute files are missing!\n"
++      "Please run 'ant compile_jute' while in the zookeeper top level directory.")
++  endif()
++endforeach()
++
++include(CheckIncludeFile)
++set(check_headers
++  arpa/inet.h
++  dlfcn.h
++  fcntl.h
++  inttypes.h
++  memory.h
++  netdb.h
++  netinet/in.h
++  stdint.h
++  stdlib.h
++  string.h
++  strings.h
++  sys/socket.h
++  sys/stat.h
++  sys/time.h
++  sys/types.h
++  unistd.h
++  sys/utsname.h)
++
++foreach(f ${check_headers})
++  to_have(${f} name)
++  check_include_file(${f} ${name})
++endforeach()
++
++# function checks
++include(CheckFunctionExists)
++set(check_functions
++  getcwd
++  gethostbyname
++  gethostname
++  getlogin
++  getpwuid_r
++  gettimeofday
++  getuid
++  memmove
++  memset
++  poll
++  socket
++  strchr
++  strdup
++  strerror
++  strtol)
++
++foreach(fn ${check_functions})
++  to_have(${fn} name)
++  check_function_exists(${fn} ${name})
++endforeach()
++
++# library checks
++set(check_libraries rt m pthread)
++foreach(lib ${check_libraries})
++  to_have("lib${lib}" name)
++  find_library(${name} ${lib})
++endforeach()
++
++# IPv6 check
++include(CheckStructHasMember)
++check_struct_has_member("struct sockaddr_in6" sin6_addr "netinet/in.h" ZOO_IPV6_ENABLED)
++
++# configure
++configure_file(cmake_config.h.in config.h)
++
++# hashtable library
++set(hashtable_sources src/hashtable/hashtable_itr.c src/hashtable/hashtable.c)
++add_library(hashtable STATIC ${hashtable_sources})
++
++# zookeeper library
++set(zookeeper_sources
++  src/zookeeper.c
++  src/recordio.c
++  generated/zookeeper.jute.c
++  src/zk_log.c
++  src/zk_hashtable.c
++  src/addrvec.c)
++
++if(WANT_SYNCAPI)
++  list(APPEND zookeeper_sources src/mt_adaptor.c)
++else()
++  list(APPEND zookeeper_sources src/st_adaptor.c)
++endif()
++
++if(WIN32)
++  list(APPEND zookeeper_sources src/winport.c)
++endif()
++
++add_library(zookeeper STATIC ${zookeeper_sources})
++target_link_libraries(zookeeper PUBLIC hashtable)
++if(UNIX)
++  target_link_libraries(zookeeper PUBLIC m rt)
++elseif(WIN32)
++  target_link_libraries(zookeeper PUBLIC wsock32 Ws2_32)
++endif()
++
++if(WANT_SYNCAPI AND NOT WIN32)
++  target_link_libraries(zookeeper PUBLIC pthread)
++endif()
++# TODO: Specify symbols to export.
++
++# cli executable
++add_executable(cli src/cli.c)
++target_link_libraries(cli zookeeper)
++
++# load_gen executable
++if(WANT_SYNCAPI AND NOT WIN32)
++  add_executable(load_gen src/load_gen.c)
++  target_link_libraries(load_gen zookeeper)
++endif()
++
++# tests
++set(test_sources
++  tests/TestDriver.cc
++  tests/LibCMocks.cc
++  tests/LibCSymTable.cc
++  tests/MocksBase.cc
++  tests/ZKMocks.cc
++  tests/Util.cc
++  tests/ThreadingUtil.cc
++  tests/TestZookeeperInit.cc
++  tests/TestZookeeperClose.cc
++  tests/TestReconfig.cc
++  tests/TestReconfigServer.cc
++  tests/TestClientRetry.cc
++  tests/TestOperations.cc
++  tests/TestMulti.cc
++  tests/TestWatchers.cc
++  tests/TestClient.cc
++  tests/ZooKeeperQuorumServer.cc
++  tests/TestReadOnlyClient.cc)
++
++if(WANT_SYNCAPI)
++  list(APPEND test_sources tests/PthreadMocks.cc)
++endif()
++
++if(WANT_CPPUNIT)
++  add_executable(zktest ${test_sources})
++  target_compile_definitions(zktest
++    PRIVATE -DZKSERVER_CMD="${CMAKE_SOURCE_DIR}/tests/zkServer.sh")
++  target_link_libraries(zktest zookeeper cppunit dl)
++
++  file(STRINGS tests/wrappers.opt symbol_wrappers)
++  if(WANT_SYNCAPI)
++    file(STRINGS tests/wrappers-mt.opt symbol_wrappers_mt)
++  endif()
++
++  target_link_libraries(zktest ${symbol_wrappers} ${symbol_wrappers_mt})
++
++  enable_testing()
++  add_test(NAME zktest_runner COMMAND zktest)
++  set_property(TEST zktest_runner PROPERTY ENVIRONMENT
++    "ZKROOT=${CMAKE_SOURCE_DIR}/../.."
++    "CLASSPATH=$CLASSPATH:$CLOVER_HOME/lib/clover.jar")
++endif()
+diff --git c/src/c/cmake_config.h.in w/src/c/cmake_config.h.in
+new file mode 100644
+index 000000000..5f945033e
+--- /dev/null
++++ w/src/c/cmake_config.h.in
+@@ -0,0 +1,136 @@
++#ifndef CONFIG_H_
++#define CONFIG_H_
++
++/* Define to 1 if you have the <arpa/inet.h> header file. */
++#cmakedefine HAVE_ARPA_INET_H 1
++
++/* Define to 1 if you have the <dlfcn.h> header file. */
++#cmakedefine HAVE_DLFCN_H 1
++
++/* Define to 1 if you have the <fcntl.h> header file. */
++#cmakedefine HAVE_FCNTL_H 1
++
++/* Define to 1 if you have the file `generated/zookeeper.jute.c'. */
++#cmakedefine HAVE_GENERATED_ZOOKEEPER_JUTE_C 1
++
++/* Define to 1 if you have the file `generated/zookeeper.jute.h'. */
++#cmakedefine HAVE_GENERATED_ZOOKEEPER_JUTE_H 1
++
++/* Define to 1 if you have the `getcwd' function. */
++#cmakedefine HAVE_GETCWD 1
++
++/* Define to 1 if you have the `gethostbyname' function. */
++#cmakedefine HAVE_GETHOSTBYNAME 1
++
++/* Define to 1 if you have the `gethostname' function. */
++#cmakedefine HAVE_GETHOSTNAME 1
++
++/* Define to 1 if you have the `getlogin' function. */
++#cmakedefine HAVE_GETLOGIN 1
++
++/* Define to 1 if you have the `getpwuid_r' function. */
++#cmakedefine HAVE_GETPWUID_R 1
++
++/* Define to 1 if you have the `gettimeofday' function. */
++#cmakedefine HAVE_GETTIMEOFDAY 1
++
++/* Define to 1 if you have the `getuid' function. */
++#cmakedefine HAVE_GETUID 1
++
++/* Define to 1 if you have the <inttypes.h> header file. */
++#cmakedefine HAVE_INTTYPES_H 1
++
++/* Define to 1 if you have the `rt' library (-lrt). */
++#cmakedefine HAVE_LIBRT 1
++
++/* Define to 1 if you have the `memmove' function. */
++#cmakedefine HAVE_MEMMOVE 1
++
++/* Define to 1 if you have the <memory.h> header file. */
++#cmakedefine HAVE_MEMORY_H 1
++
++/* Define to 1 if you have the `memset' function. */
++#cmakedefine HAVE_MEMSET 1
++
++/* Define to 1 if you have the <netdb.h> header file. */
++#cmakedefine HAVE_NETDB_H 1
++
++/* Define to 1 if you have the <netinet/in.h> header file. */
++#cmakedefine HAVE_NETINET_IN_H 1
++
++/* Define to 1 if you have the `poll' function. */
++#cmakedefine HAVE_POLL 1
++
++/* Define to 1 if you have the `socket' function. */
++#cmakedefine HAVE_SOCKET 1
++
++/* Define to 1 if you have the <stdint.h> header file. */
++#cmakedefine HAVE_STDINT_H 1
++
++/* Define to 1 if you have the <stdlib.h> header file. */
++#cmakedefine HAVE_STDLIB_H 1
++
++/* Define to 1 if you have the `strchr' function. */
++#cmakedefine HAVE_STRCHR 1
++
++/* Define to 1 if you have the `strdup' function. */
++#cmakedefine HAVE_STRDUP 1
++
++/* Define to 1 if you have the `strerror' function. */
++#cmakedefine HAVE_STRERROR 1
++
++/* Define to 1 if you have the <strings.h> header file. */
++#cmakedefine HAVE_STRINGS_H 1
++
++/* Define to 1 if you have the <string.h> header file. */
++#cmakedefine HAVE_STRING_H 1
++
++/* Define to 1 if you have the `strtol' function. */
++#cmakedefine HAVE_STRTOL 1
++
++/* Define to 1 if you have the <sys/socket.h> header file. */
++#cmakedefine HAVE_SYS_SOCKET_H 1
++
++/* Define to 1 if you have the <sys/stat.h> header file. */
++#cmakedefine HAVE_SYS_STAT_H 1
++
++/* Define to 1 if you have the <sys/time.h> header file. */
++#cmakedefine HAVE_SYS_TIME_H 1
++
++/* Define to 1 if you have the <sys/types.h> header file. */
++#cmakedefine HAVE_SYS_TYPES_H 1
++
++/* Define to 1 if you have the <sys/utsname.h> header file. */
++#cmakedefine HAVE_SYS_UTSNAME_H 1
++
++/* Define to 1 if you have the <unistd.h> header file. */
++#cmakedefine HAVE_UNISTD_H 1
++
++/* Define to 1 if IPv6 support is available. */
++#cmakedefine ZOO_IPV6_ENABLED 1
++
++/* poll() second argument type */
++#define POLL_NFDS_TYPE nfds_t
++
++/* Name of package */
++#define PACKAGE "${PROJECT_NAME}"
++
++/* Define to the address where bug reports for this package should be sent. */
++#define PACKAGE_BUGREPORT "${email}"
++
++/* Define to the full name of this package. */
++#define PACKAGE_NAME "${description}"
++
++/* Define to the full name and version of this package. */
++#define PACKAGE_STRING "${description} ${PROJECT_VERSION}"
++
++/* Define to the one symbol short name of this package. */
++#define PACKAGE_TARNAME "${PROJECT_NAME}"
++
++/* Define to the version of this package. */
++#define PACKAGE_VERSION "${PROJECT_VERSION}"
++
++/* Version number of package */
++#define VERSION "${PROJECT_VERSION}"
++
++#endif
+diff --git c/src/c/include/winconfig.h w/src/c/include/winconfig.h
+index ed33aa6e5..725d1624b 100644
+--- c/src/c/include/winconfig.h
++++ w/src/c/include/winconfig.h
+@@ -1,164 +1,15 @@
+-/* Define to 1 if you have the <arpa/inet.h> header file. */
+-#undef HAVE_ARPA_INET_H
+-
+-/* Define to 1 if you have the <dlfcn.h> header file. */
+-#undef HAVE_DLFCN_H
+-
+-/* Define to 1 if you have the <fcntl.h> header file. */
+-#undef HAVE_FCNTL_H
+-
+-/* Define to 1 if you have the file `generated/zookeeper.jute.c'. */
+-#define HAVE_GENERATED_ZOOKEEPER_JUTE_C 1
+-
+-/* Define to 1 if you have the file `generated/zookeeper.jute.h'. */
+-#define HAVE_GENERATED_ZOOKEEPER_JUTE_H 1
+-
+-/* Define to 1 if you have the `getcwd' function. */
+-#undef HAVE_GETCWD
+-
+-/* Define to 1 if you have the `gethostbyname' function. */
+-#undef HAVE_GETHOSTBYNAME
+-
+-/* Define to 1 if you have the `gethostname' function. */
+-#define HAVE_GETHOSTNAME 1
+-
+-/* Define to 1 if you have the `getlogin' function. */
+-#undef HAVE_GETLOGIN
+-
+-/* Define to 1 if you have the `getpwuid_r' function. */
+-#undef HAVE_GETPWUID_R
+-
+-/* Define to 1 if you have the `gettimeofday' function. */
+-#undef HAVE_GETTIMEOFDAY
+-
+-/* Define to 1 if you have the `getuid' function. */
+-#undef HAVE_GETUID
+-
+-/* Define to 1 if you have the <inttypes.h> header file. */
+-#undef HAVE_INTTYPES_H
+-
+-/* Define to 1 if you have the `memmove' function. */
+-#undef HAVE_MEMMOVE
+-
+-/* Define to 1 if you have the <memory.h> header file. */
+-#undef HAVE_MEMORY_H
+-
+-/* Define to 1 if you have the `memset' function. */
+-#undef HAVE_MEMSET
+-
+-/* Define to 1 if you have the <netdb.h> header file. */
+-#undef HAVE_NETDB_H
+-
+-/* Define to 1 if you have the <netinet/in.h> header file. */
+-#undef HAVE_NETINET_IN_H
+-
+-/* Define to 1 if you have the `poll' function. */
+-#undef HAVE_POLL
+-
+-/* Define to 1 if you have the `socket' function. */
+-#undef HAVE_SOCKET
+-
+-/* Define to 1 if you have the <stdint.h> header file. */
+-#undef HAVE_STDINT_H
+-
+-/* Define to 1 if you have the <stdlib.h> header file. */
+-#define HAVE_STDLIB_H 1
+-
+-/* Define to 1 if you have the `strchr' function. */
+-#define HAVE_STRCHR 1
+-
+-/* Define to 1 if you have the `strdup' function. */
+-#define HAVE_STRDUP 1
+-
+-/* Define to 1 if you have the `strerror' function. */
+-#define HAVE_STRERROR 1
+-
+-/* Define to 1 if you have the <strings.h> header file. */
+-#undef HAVE_STRINGS_H
+-
+-/* Define to 1 if you have the <string.h> header file. */
+-#undef HAVE_STRING_H
+-
+-/* Define to 1 if you have the `strtol' function. */
+-#undef HAVE_STRTOL
+-
+-/* Define to 1 if you have the <sys/socket.h> header file. */
+-#undef HAVE_SYS_SOCKET_H
+-
+-/* Define to 1 if you have the <sys/stat.h> header file. */
+-#undef HAVE_SYS_STAT_H
+-
+-/* Define to 1 if you have the <sys/time.h> header file. */
+-#undef HAVE_SYS_TIME_H
+-
+-/* Define to 1 if you have the <sys/types.h> header file. */
+-#undef HAVE_SYS_TYPES_H
+-
+-/* Define to 1 if you have the <sys/utsname.h> header file. */
+-#undef HAVE_SYS_UTSNAME_H
+-
+-/* Define to 1 if you have the <unistd.h> header file. */
+-#undef HAVE_UNISTD_H
+-
+-/* Define to the sub-directory in which libtool stores uninstalled libraries.
+-   */
+-#define LT_OBJDIR
+-
+-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+-/* #undef NO_MINUS_C_MINUS_O */
+-
+-/* Name of package */
+-#define PACKAGE "c-client-src"
+-
+-/* Define to the address where bug reports for this package should be sent. */
+-#define PACKAGE_BUGREPORT "user@zookeeper.apache.org"
+-
+-/* Define to the full name of this package. */
+-#define PACKAGE_NAME "zookeeper C client"
+-
+-/* Define to the full name and version of this package. */
+-#define PACKAGE_STRING "zookeeper C client 3.5.2 win32"
+-
+-/* Define to the one symbol short name of this package. */
+-#define PACKAGE_TARNAME "c-client-src"
+-
+-/* Define to the home page for this package. */
+-#define PACKAGE_URL ""
+-
+-/* Define to the version of this package. */
+-#define PACKAGE_VERSION "3.5.2"
+-
+-/* poll() second argument type */
+-#define POLL_NFDS_TYPE
+-
+-/* Define to 1 if you have the ANSI C header files. */
+-#define STDC_HEADERS
+-
+-/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+-#define TIME_WITH_SYS_TIME
+-
+-/* Version number of package */
+-#define VERSION "3.5.2"
+-
+-/* Define to empty if `const' does not conform to ANSI C. */
+-/* #undef const */
++#ifndef WINCONFIG_H_
++#define WINCONFIG_H_
+ 
+ /* Define to `__inline__' or `__inline' if that's what the C compiler
+    calls it, or to nothing if 'inline' is not supported under any name.  */
+ #ifndef __cplusplus
+ #define inline __inline
+ #endif
+-#ifdef WIN32
++
+ #define __attribute__(x)
+ #define __func__ __FUNCTION__
+ 
+-#ifndef _WIN32_WINNT_NT4
+-#define _WIN32_WINNT_NT4 0x0400
+-#endif
+-
+-#define NTDDI_VERSION _WIN32_WINNT_NT4
+-#define _WIN32_WINNT _WIN32_WINNT_NT4
+-
+ #define _CRT_SECURE_NO_WARNINGS
+ #define WIN32_LEAN_AND_MEAN
+ #include <Windows.h>
+@@ -171,12 +22,17 @@
+ #undef max
+ 
+ #include <errno.h>
++#include <stdlib.h>
+ 
+ #define strtok_r strtok_s
+ #define localtime_r(a,b) localtime_s(b,a)
+ #define get_errno() errno=GetLastError()
+-#define random rand
++
++inline int __cdecl random() { return rand(); }
++
++#if ((defined(_MSC_VER) && _MSC_VER < 1900) || !defined(_MSC_VER))
+ #define snprintf _snprintf
++#endif
+ 
+ #define ACL ZKACL  // Conflict with windows API
+ 
+@@ -192,5 +48,6 @@
+ #define EINPROGRESS WSAEINPROGRESS
+ #endif
+ 
+-typedef int pid_t;
++typedef DWORD pid_t;
++
+ #endif
+diff --git c/src/c/include/winstdint.h w/src/c/include/winstdint.h
+index d02608a59..2470199e5 100644
+--- c/src/c/include/winstdint.h
++++ w/src/c/include/winstdint.h
+@@ -100,16 +100,6 @@ typedef uint16_t  uint_least16_t;
+ typedef uint32_t  uint_least32_t;
+ typedef uint64_t  uint_least64_t;
+ 
+-// 7.18.1.3 Fastest minimum-width integer types
+-typedef int8_t    int_fast8_t;
+-typedef int16_t   int_fast16_t;
+-typedef int32_t   int_fast32_t;
+-typedef int64_t   int_fast64_t;
+-typedef uint8_t   uint_fast8_t;
+-typedef uint16_t  uint_fast16_t;
+-typedef uint32_t  uint_fast32_t;
+-typedef uint64_t  uint_fast64_t;
+-
+ // 7.18.1.4 Integer types capable of holding object pointers
+ #ifdef _WIN64 // [
+    typedef signed __int64    intptr_t;
+@@ -126,7 +116,7 @@ typedef uint64_t  uintmax_t;
+ 
+ // 7.18.2 Limits of specified-width integer types
+ 
+-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259
++#if (_MSC_VER < 1900) && (!defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)) // [   See footnote 220 at page 257 and footnote 221 at page 259
+ 
+ // 7.18.2.1 Limits of exact-width integer types
+ #define INT8_MIN     ((int8_t)_I8_MIN)
+@@ -223,7 +213,7 @@ typedef uint64_t  uintmax_t;
+ 
+ // 7.18.4 Limits of other integer types
+ 
+-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260
++#if (_MSC_VER < 1900) && (!defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)) // [   See footnote 224 at page 260
+ 
+ // 7.18.4.1 Macros for minimum-width integer constants
+ 
+diff --git c/src/c/include/zookeeper.h w/src/c/include/zookeeper.h
+index 18a203d75..f51ab7512 100644
+--- c/src/c/include/zookeeper.h
++++ w/src/c/include/zookeeper.h
+@@ -20,12 +20,17 @@
+ #define ZOOKEEPER_H_
+ 
+ #include <stdlib.h>
+-#ifndef WIN32
++
++#include "config.h"
++
++#ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
++#endif
++
++#ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
+-#else
+-#include "winconfig.h"
+ #endif
++
+ #include <stdio.h>
+ #include <ctype.h>
+ 
+diff --git c/src/c/src/load_gen.c w/src/c/src/load_gen.c
+index b062af6dd..886fe1b3e 100644
+--- c/src/c/src/load_gen.c
++++ w/src/c/src/load_gen.c
+@@ -19,13 +19,9 @@
+ #include <zookeeper.h>
+ #include "zookeeper_log.h"
+ #include <errno.h>
+-#ifndef WIN32
+ #ifdef THREADED 
+ #include <pthread.h>
+ #endif
+-#else
+-#include "win32port.h"
+-#endif
+ #include <string.h>
+ #include <stdlib.h>
+ 
+diff --git c/src/c/src/mt_adaptor.c w/src/c/src/mt_adaptor.c
+index fe4792a17..38cced425 100644
+--- c/src/c/src/mt_adaptor.c
++++ w/src/c/src/mt_adaptor.c
+@@ -19,7 +19,7 @@
+ #define THREADED
+ #endif
+ 
+-#ifndef DLL_EXPORT
++#if !defined(DLL_EXPORT) && !defined(USE_STATIC_LIB)
+ #  define USE_STATIC_LIB
+ #endif
+ 
+@@ -375,8 +375,7 @@ void *do_io(void *v)
+         int interest;
+         int timeout;
+         int maxfd=1;
+-        int rc;
+-        
++
+         zookeeper_interest(zh, &fd, &interest, &tv);
+         if (fd != -1) {
+             fds[1].fd=fd;
+@@ -449,7 +448,7 @@ void *do_io(void *v)
+ 
+ #endif
+         // dispatch zookeeper events
+-        rc = zookeeper_process(zh, interest);
++        zookeeper_process(zh, interest);
+         // check the current state of the zhandle and terminate 
+         // if it is_unrecoverable()
+         if(is_unrecoverable(zh))
+diff --git c/src/c/src/zk_log.c w/src/c/src/zk_log.c
+index afe030097..009234a2a 100644
+--- c/src/c/src/zk_log.c
++++ w/src/c/src/zk_log.c
+@@ -16,7 +16,7 @@
+  * limitations under the License.
+  */
+ 
+-#ifndef DLL_EXPORT
++#if !defined(DLL_EXPORT) && !defined(USE_STATIC_LIB)
+ #  define USE_STATIC_LIB
+ #endif
+ 
+diff --git c/src/c/src/zookeeper.c w/src/c/src/zookeeper.c
+index 7549d4897..b4079861f 100644
+--- c/src/c/src/zookeeper.c
++++ w/src/c/src/zookeeper.c
+@@ -16,7 +16,7 @@
+  * limitations under the License.
+  */
+ 
+-#ifndef DLL_EXPORT
++#if !defined(DLL_EXPORT) && !defined(USE_STATIC_LIB)
+ #  define USE_STATIC_LIB
+ #endif
+ 
+@@ -41,18 +41,33 @@
+ #include <stdarg.h>
+ #include <limits.h>
+ 
+-#ifndef _WIN32
++#ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
++#endif
++
++#ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
++#endif
++
++#ifdef HAVE_POLL
+ #include <poll.h>
++#endif
++
++#ifdef HAVE_NETINET_IN_H
+ #include <netinet/in.h>
+ #include <netinet/tcp.h>
++#endif
++
++#ifdef HAVE_ARPA_INET_H
+ #include <arpa/inet.h>
++#endif
++
++#ifdef HAVE_NETDB_H
+ #include <netdb.h>
++#endif
++
++#ifdef HAVE_UNISTD_H
+ #include <unistd.h> // needed for _POSIX_MONOTONIC_CLOCK
+-#include "config.h"
+-#else
+-#include "winstdint.h"
+ #endif
+ 
+ #ifdef HAVE_SYS_UTSNAME_H


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

Posted by jo...@apache.org.
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)
 


[3/5] mesos git commit: Windows: Added deprecation warning for VS 2015.

Posted by jo...@apache.org.
Windows: Added deprecation warning for VS 2015.

Specifically this checks if the generator used did not match "Visual
Studio 15 2017", which Mesos now prefers. Note that the
`CMAKE_GENERATOR` variable is expanded fully even when shorthand
is used, e.g. `-G "Visual Studio 15"` will correctly match.

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


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

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

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c89884a5/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 1c54669..dfaf6a6 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -163,7 +163,7 @@ if (NOT (CMAKE_SIZEOF_VOID_P EQUAL 8))
     "  * Linux: (on gcc) set `CMAKE_CXX_FLAGS` to include `-m64`:\n"
     "    `cmake -DCMAKE_CXX_FLAGS=-m64 `.\n"
     "  * Windows: use the VS win64 CMake generator:\n"
-    "    `cmake -G \"Visual Studio 10 Win64\"`.\n"
+    "    `cmake -G \"Visual Studio 15 2017 Win64\"`.\n"
     "  * OS X: add `x86_64` to the `CMAKE_OSX_ARCHITECTURES`:\n"
     "    `cmake -DCMAKE_OSX_ARCHITECTURES=x86_64`.\n")
 endif (NOT (CMAKE_SIZEOF_VOID_P EQUAL 8))
@@ -175,6 +175,18 @@ endif (NOT (CMAKE_SIZEOF_VOID_P EQUAL 8))
 #     We just check the MSVC version.
 CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
 if (WIN32)
+  # Versions of Visual Studio older than 2017 do not support all core features
+  # of C++14, which prevents Mesos from moving past C++11. This adds a
+  # non-fatal deprecation warning.
+  set(PREFERRED_GENERATOR "Visual Studio 15 2017")
+  if (NOT CMAKE_GENERATOR MATCHES ${PREFERRED_GENERATOR})
+    message(
+      WARNING
+      "Mesos is deprecating support for ${CMAKE_GENERATOR}. "
+      "Please use ${PREFERRED_GENERATOR}."
+  )
+  endif (NOT CMAKE_GENERATOR MATCHES ${PREFERRED_GENERATOR})
+
   # We don't support compilation against mingw headers (which, e.g., Clang on
   # Windows does at this point), because this is likely to cost us more effort
   # to support than it will be worth at least in the short term.


[4/5] mesos git commit: Windows: Fixed CMake generator for Protobuf target.

Posted by jo...@apache.org.
Windows: Fixed CMake generator for Protobuf target.

This fixes the build when using MSVC 2017 instead of MSVC 2015.
The Protobuf target now uses the same CMake generator as the
project, instead of hardcoding MSVC 2015.

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


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

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

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/f5cec0d9/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index bb61ef0..c6bcbcb 100755
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -321,7 +321,7 @@ if (NOT WIN32)
   set(PROTOBUF_BUILD_CMD   make)
   set(PROTOBUF_INSTALL_CMD make install)
 elseif (WIN32)
-  set(PROTOBUF_CONFIG_CMD  cmake -G "Visual Studio 14 2015 Win64" ../protobuf-${PROTOBUF_VERSION}/cmake -DBUILD_SHARED_LIBS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=ON -Dprotobuf_BUILD_TESTS=OFF)
+  set(PROTOBUF_CONFIG_CMD  cmake -G ${CMAKE_GENERATOR} ../protobuf-${PROTOBUF_VERSION}/cmake -DBUILD_SHARED_LIBS=OFF -Dprotobuf_MSVC_STATIC_RUNTIME=ON -Dprotobuf_BUILD_TESTS=OFF)
   set(PROTOBUF_BUILD_CMD   msbuild protobuf.sln)
   set(PROTOBUF_INSTALL_CMD ${CMAKE_NOOP})
 endif (NOT WIN32)


[5/5] mesos git commit: CMake: Bump minimum version to 3.7.0 on Windows.

Posted by jo...@apache.org.
CMake: Bump minimum version to 3.7.0 on Windows.

The `SOURCE_SUBDIR` command to `ExternalProject_Add` was added in CMake
3.7.0, and is necessary to most cleanly build an external CMake built
project where the `CMakeLists.txt` is in a subfolder of the project.

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


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

Branch: refs/heads/master
Commit: 5ec64bec33e3a4e95a96a20cf8622641b3205fb9
Parents: 6e64ffa
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Authored: Tue Apr 25 18:29:02 2017 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Wed Apr 26 14:04:09 2017 -0700

----------------------------------------------------------------------
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/5ec64bec/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea529ec..425d55e 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,7 @@
 if (NOT WIN32)
   cmake_minimum_required(VERSION 2.8.10)
 else (NOT WIN32)
-  cmake_minimum_required(VERSION 3.6.0)
+  cmake_minimum_required(VERSION 3.7.0)
 endif (NOT WIN32)
 
 project(Mesos)