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 2015/09/28 01:27:40 UTC

[01/20] mesos git commit: CMake: Fixed MESOS-3250, a dynamic load error in Stout tests on OS X.

Repository: mesos
Updated Branches:
  refs/heads/master fbb12a529 -> 1a7ad5e35


CMake: Fixed MESOS-3250, a dynamic load error in Stout tests on OS X.

A few third-party libraries (libev, gmock) do not have `make install`
commands available, so below we have to add our own "install" commands.

The reason is: if we do not, we get runtime library load problems on OS
X. In particular, `dydl` will look for these libraries at the prefix we
passed to `configure` (or in `/usr/local` if we did not pass a prefix
in), but since they don't have a `make install` step, they never get
placed in the prefix folder.

Our solution is to:
  (1) make a lib directory inside the Mesos folder for each of the
      libraries that has no install step, and
  (2) copy all such libraries into their respective directories.

(Note that step (1) is not only convenient, but important: make will add
a `lib` to the end of your prefix path when linking, and since the built
libraries end up in a `.libs` folder, it's not enough to simply pass the
build directory into `configure` as a prefix; so if we're going to move
the libraries, we might as well move them to a library folder.)

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


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

Branch: refs/heads/master
Commit: c98b33e72549eb32576e767d10a34eaf87cefbd3
Parents: fbb12a5
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:13 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:01:05 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/CMakeLists.txt | 43 +++++++++++++++++++-----
 1 file changed, 35 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c98b33e7/3rdparty/libprocess/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/CMakeLists.txt b/3rdparty/libprocess/3rdparty/CMakeLists.txt
index b9c9fae..cb2b55e 100644
--- a/3rdparty/libprocess/3rdparty/CMakeLists.txt
+++ b/3rdparty/libprocess/3rdparty/CMakeLists.txt
@@ -65,6 +65,26 @@ 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
+# have `make install` commands available, so below we have to add our own
+# "install" commands.
+#
+# The reason is: if we do not, we get runtime library load problems on OS X. In
+# particular, `dydl` will look for these libraries at the prefix we passed to
+# `configure` (or in `/usr/local` if we did not pass a prefix in), but since
+# they don't have a `make install` step, they never get placed in the prefix
+# folder.
+#
+# Our solution is to:
+#   (1) make a lib directory inside the Mesos folder for each of the libraries
+#       that has no install step, and
+#   (2) copy all such libraries into their respective directories.
+#
+# (Note that step (1) is not only convenient, but important: make will add a
+# `lib` to the end of your prefix path when linking, and since the built
+# libraries end up in a `.libs` folder, it's not enough to simply pass the
+# build directory into `configure` as a prefix; so if we're going to move the
+# libraries, we might as well move them to a library folder.)
 if (NOT WIN32)
   set(GLOG_CONFIG_CMD  ${GLOG_ROOT}/src/../configure --prefix=${GLOG_LIB})
   set(GLOG_BUILD_CMD   make)
@@ -76,8 +96,11 @@ if (NOT WIN32)
   set(RY_BUILD_CMD   make -C ${HTTP_PARSER_ROOT})
   set(RY_INSTALL_CMD ar -rv libhttp_parser.a ${HTTP_PARSER_ROOT}/http_parser_g.o)
 
-  set(LIBEV_CONFIG_CMD ${LIBEV_ROOT}/configure)
-  set(LIBEV_BUILD_CMD  make)
+  # NOTE: `libev` is "installed" into a lib directory, see "NOTE: (fix for
+  # MESOS-3250)" comment above for explanation.
+  set(LIBEV_CONFIG_CMD  ${LIBEV_ROOT}/configure --prefix=${LIBEV_ROOT}-lib)
+  set(LIBEV_BUILD_CMD   make)
+  set(LIBEV_INSTALL_CMD mkdir -p ${LIBEV_ROOT}-lib/lib && cp -r ${LIBEV_ROOT}-build/.libs/. ${LIBEV_ROOT}-lib/lib)
   # Patch libev to keep it from reaping child processes.
   PATCH_CMD(${PROCESS_3RD_SRC}/libev-4.15.patch LIBEV_PATCH_CMD)
 endif (NOT WIN32)
@@ -164,7 +187,7 @@ ExternalProject_Add(
   PATCH_COMMAND     "${LIBEV_PATCH_CMD}"
   CONFIGURE_COMMAND "${LIBEV_CONFIG_CMD}"
   BUILD_COMMAND     "${LIBEV_BUILD_CMD}"
-  INSTALL_COMMAND   ""
+  INSTALL_COMMAND   "${LIBEV_INSTALL_CMD}"
   URL               ${LIBEV_URL}
   )
 
@@ -194,13 +217,17 @@ else (REBUNDLED)
   set(PROTOBUF_URL ${UPSTREAM_URL}/protobuf-${PROTOBUF_VERSION}.tar.gz)
 endif (REBUNDLED)
 
+# NOTE: `gmock` is "installed" into a lib directory, see "NOTE: (fix for
+# MESOS-3250)" comment above for explanation.
 if (APPLE)
+  set(GMOCK_CONFIG_CMD  ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib)
   # GTEST on OSX needs its own tr1 tuple.
-  set(GMOCK_BUILD_CMD  make CPPFLAGS=-DGTEST_USE_OWN_TR1_TUPLE)
-  set(GMOCK_CONFIG_CMD ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib/lib)
+  set(GMOCK_BUILD_CMD   make CPPFLAGS=-DGTEST_USE_OWN_TR1_TUPLE)
+  set(GMOCK_INSTALL_CMD mkdir -p ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/lib/.libs/. ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/gtest/lib/.libs/. ${GMOCK_ROOT}-lib/lib)
 elseif (NOT WIN32)
-  set(GMOCK_CONFIG_CMD ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib/lib)
-  set(GMOCK_BUILD_CMD  make)
+  set(GMOCK_CONFIG_CMD  ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib)
+  set(GMOCK_BUILD_CMD   make)
+  set(GMOCK_INSTALL_CMD mkdir -p ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/lib/.libs/. ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/gtest/lib/.libs/. ${GMOCK_ROOT}-lib/lib)
 endif (APPLE)
 
 if (NOT WIN32)
@@ -216,7 +243,7 @@ ExternalProject_Add(
   PREFIX            ${GMOCK_CMAKE_ROOT}
   CONFIGURE_COMMAND "${GMOCK_CONFIG_CMD}"
   BUILD_COMMAND     "${GMOCK_BUILD_CMD}"
-  INSTALL_COMMAND   ""
+  INSTALL_COMMAND   "${GMOCK_INSTALL_CMD}"
   URL               ${GMOCK_URL}
   )
 


[07/20] mesos git commit: Generated make batch file to build project in windows.

Posted by jo...@apache.org.
Generated make batch file to build project in windows.

Original review: https://reviews.apache.org/r/37275

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


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

Branch: refs/heads/master
Commit: 8125f40f04907809f1150d27f649eb576da6a006
Parents: 4661200
Author: haosdent huang <ha...@gmail.com>
Authored: Sun Sep 27 15:41:20 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:09:12 2015 -0700

----------------------------------------------------------------------
 CMakeLists.txt             |  1 +
 cmake/MesosConfigure.cmake | 13 +++++++++++++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/8125f40f/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b684f6..8136acb 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake/macr
 include(Common)
 include(External)
 include(PatchCommand)
+include(VsBuildCommand)
 
 # Configuration.
 include(MesosConfigure)

http://git-wip-us.apache.org/repos/asf/mesos/blob/8125f40f/cmake/MesosConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/MesosConfigure.cmake b/cmake/MesosConfigure.cmake
index e1d53a1..be14dc7 100755
--- a/cmake/MesosConfigure.cmake
+++ b/cmake/MesosConfigure.cmake
@@ -116,6 +116,19 @@ endif (WIN32)
 # throughout the project, so it's important that this config script goes here.
 include(ProcessConfigure)
 
+# Generate a batch script that will build Mesos. Any project referencing Mesos
+# can then build it by calling this script.
+if (WIN32)
+  VS_BUILD_CMD(
+      MESOS
+      ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.sln
+      ${CMAKE_BUILD_TYPE}
+      "")
+
+  string(REPLACE ";" " " MESOS_BUILD_CMD "${MESOS_BUILD_CMD}")
+  file(WRITE ${CMAKE_BINARY_DIR}/make.bat ${MESOS_BUILD_CMD})
+endif (WIN32)
+
 # Add preprocessor definitions required to build third-party libraries.
 #######################################################################
 # Enable the INT64 support for PicoJSON.


[06/20] mesos git commit: Added CMake macro VsBuildCommand in libprocess.

Posted by jo...@apache.org.
Added CMake macro VsBuildCommand in libprocess.

Original review: https://reviews.apache.org/r/37273

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


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

Branch: refs/heads/master
Commit: 466120068e029cec97198a9967aa78deef70d2e2
Parents: fa481e4
Author: haosdent huang <ha...@gmail.com>
Authored: Sun Sep 27 15:41:19 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:07:46 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/CMakeLists.txt     | 134 ++++++++++---------
 .../libprocess/cmake/macros/VsBuildCommand.bat  |  67 ++++++++++
 .../cmake/macros/VsBuildCommand.cmake           |  40 ++++++
 3 files changed, 178 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/46612006/3rdparty/libprocess/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/CMakeLists.txt b/3rdparty/libprocess/3rdparty/CMakeLists.txt
index cb2b55e..4f439fa 100644
--- a/3rdparty/libprocess/3rdparty/CMakeLists.txt
+++ b/3rdparty/libprocess/3rdparty/CMakeLists.txt
@@ -103,62 +103,44 @@ if (NOT WIN32)
   set(LIBEV_INSTALL_CMD mkdir -p ${LIBEV_ROOT}-lib/lib && cp -r ${LIBEV_ROOT}-build/.libs/. ${LIBEV_ROOT}-lib/lib)
   # Patch libev to keep it from reaping child processes.
   PATCH_CMD(${PROCESS_3RD_SRC}/libev-4.15.patch LIBEV_PATCH_CMD)
+elseif (WIN32)
+  set(GLOG_PATCH_CMD   ${CMAKE_NOOP})
+  set(GLOG_CONFIG_CMD  ${CMAKE_NOOP})
+  set(GLOG_INSTALL_CMD ${CMAKE_NOOP})
+  VS_BUILD_CMD(
+      GLOG
+      ${GLOG_ROOT}/google-glog.sln
+      ${CMAKE_BUILD_TYPE}
+      "libglog")
+
+  set(RY_BUILD_CMD   ${CMAKE_NOOP})
+  set(RY_INSTALL_CMD ${CMAKE_NOOP})
+
+  set(LIBEV_PATCH_CMD    ${CMAKE_NOOP})
+  set(LIBEV_CONFIG_CMD   ${CMAKE_NOOP})
+  set(LIBEV_BUILD_CMD    ${CMAKE_NOOP})
+  set(LIBEV_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.
 ##############################################################################
-# NOTE: On ExternalProject_Add calls in the next section, we pass some
-# quoted values into `ExternalProject_Add`. We do this because some of these
-# projects can't (or shouldn't) be built from the command line (for various
-# reasons), and we need to get creative about what values we pass in to make
-# sure these operations are no-ops.
-#
-# There are two flavors of work-around here. The first we use to avoid building
-# third-party projects (like Boost) that never need to be built for Mesos. This
-# looks like this:
-#
-#     BUILD_COMMAND ""
-#
-# In most of the major releases of CMake, if we don't set parameters like
-# `BUILD_COMMAND`, we will trigger the default behavior of that parameter;
-# usually, CMake attempts to configure/build/install/etc. the third-party
-# project as if it were a CMake (or perhaps make) project. Since these projects
-# are not CMake projects, they will error out. This work-around lets us avoid
-# that fate altogether.
-#
-# The second work-around allows us to build a project except on Windows. It
-# looks like this:
-#
-#     BUILD_COMMAND "${GLOG_BUILD_CMD}"
-#
-# The problem is that there is currently no way to build glog on Windows from
-# the command line. But, if GLOG_BUILD_CMD is not set (or if it's an empty
-# list), then we run into the same problem as last time; CMake sees that
-# `BUILD_COMMAND` is unset, and will default to the "normal" behavior of trying
-# to configure/build/install the project as if it was a CMake project. (Since
-# it is not, it will of course error out on Windows.)
-#
-# The work-around is to add quotes to the outside of the variable. In this case,
-# ${GLOG_BUILD_CMD} will expand to unset, which will cause us to pass the empty
-# string as a parameter to the function. This of course is different from not
-# setting the parameter value at all, and hence the work-around works.
 ExternalProject_Add(
   ${BOOST_TARGET}
   PREFIX            ${BOOST_CMAKE_ROOT}
-  CONFIGURE_COMMAND ""
-  BUILD_COMMAND     ""
-  INSTALL_COMMAND   ""
+  CONFIGURE_COMMAND ${CMAKE_NOOP}
+  BUILD_COMMAND     ${CMAKE_NOOP}
+  INSTALL_COMMAND   ${CMAKE_NOOP}
   URL               ${BOOST_URL}
   )
 
 ExternalProject_Add(
   ${GLOG_TARGET}
   PREFIX            ${GLOG_CMAKE_ROOT}
-  PATCH_COMMAND     "${GLOG_PATCH_CMD}"
-  CONFIGURE_COMMAND "${GLOG_CONFIG_CMD}"
-  BUILD_COMMAND     "${GLOG_BUILD_CMD}"
-  INSTALL_COMMAND   "${GLOG_INSTALL_CMD}"
+  PATCH_COMMAND     ${GLOG_PATCH_CMD}
+  CONFIGURE_COMMAND ${GLOG_CONFIG_CMD}
+  BUILD_COMMAND     ${GLOG_BUILD_CMD}
+  INSTALL_COMMAND   ${GLOG_INSTALL_CMD}
   URL               ${GLOG_URL}
   DOWNLOAD_NAME     glog-${GLOG_VERSION}.tar.gz
   )
@@ -166,28 +148,28 @@ ExternalProject_Add(
 ExternalProject_Add(
   ${PICOJSON_TARGET}
   PREFIX            ${PICOJSON_CMAKE_ROOT}
-  CONFIGURE_COMMAND ""
-  BUILD_COMMAND     ""
-  INSTALL_COMMAND   ""
+  CONFIGURE_COMMAND ${CMAKE_NOOP}
+  BUILD_COMMAND     ${CMAKE_NOOP}
+  INSTALL_COMMAND   ${CMAKE_NOOP}
   URL               ${PICOJSON_URL}
   )
 
 ExternalProject_Add(
   ${HTTP_PARSER_TARGET}
   PREFIX            ${HTTP_PARSER_CMAKE_ROOT}
-  CONFIGURE_COMMAND ""
-  BUILD_COMMAND     "${RY_BUILD_CMD}"
-  INSTALL_COMMAND   "${RY_INSTALL_CMD}"
+  CONFIGURE_COMMAND ${CMAKE_NOOP}
+  BUILD_COMMAND     ${RY_BUILD_CMD}
+  INSTALL_COMMAND   ${RY_INSTALL_CMD}
   URL               ${HTTP_PARSER_URL}
   )
 
 ExternalProject_Add(
   ${LIBEV_TARGET}
   PREFIX            ${LIBEV_CMAKE_ROOT}
-  PATCH_COMMAND     "${LIBEV_PATCH_CMD}"
-  CONFIGURE_COMMAND "${LIBEV_CONFIG_CMD}"
-  BUILD_COMMAND     "${LIBEV_BUILD_CMD}"
-  INSTALL_COMMAND   "${LIBEV_INSTALL_CMD}"
+  PATCH_COMMAND     ${LIBEV_PATCH_CMD}
+  CONFIGURE_COMMAND ${LIBEV_CONFIG_CMD}
+  BUILD_COMMAND     ${LIBEV_BUILD_CMD}
+  INSTALL_COMMAND   ${LIBEV_INSTALL_CMD}
   URL               ${LIBEV_URL}
   )
 
@@ -199,10 +181,10 @@ if (WIN32)
   ExternalProject_Add(
     ${CURL_TARGET}
     PREFIX            ${CURL_CMAKE_ROOT}
-    PATCH_COMMAND     ""
-    CONFIGURE_COMMAND ""
-    BUILD_COMMAND     ""
-    INSTALL_COMMAND   ""
+    PATCH_COMMAND     ${CMAKE_NOOP}
+    CONFIGURE_COMMAND ${CMAKE_NOOP}
+    BUILD_COMMAND     ${CMAKE_NOOP}
+    INSTALL_COMMAND   ${CMAKE_NOOP}
     URL               ${CURL_URL}
   )
 endif (WIN32)
@@ -217,6 +199,14 @@ else (REBUNDLED)
   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 https://github.com/haosdent/3rdparty-packages/raw/master/protobuf-${PROTOBUF_VERSION}.tar.gz)
+endif (WIN32)
+
 # NOTE: `gmock` is "installed" into a lib directory, see "NOTE: (fix for
 # MESOS-3250)" comment above for explanation.
 if (APPLE)
@@ -228,12 +218,30 @@ elseif (NOT WIN32)
   set(GMOCK_CONFIG_CMD  ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib)
   set(GMOCK_BUILD_CMD   make)
   set(GMOCK_INSTALL_CMD mkdir -p ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/lib/.libs/. ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/gtest/lib/.libs/. ${GMOCK_ROOT}-lib/lib)
+elseif (WIN32)
+  set(GMOCK_CONFIG_CMD ${CMAKE_NOOP})
+  VS_BUILD_CMD(
+      GMOCK
+      ${GMOCK_ROOT}/msvc/2010/gmock.sln
+      ${CMAKE_BUILD_TYPE}
+      "gmock gmock_main")
+  set(GMOCK_INSTALL_CMD ${CMAKE_NOOP})
 endif (APPLE)
 
 if (NOT WIN32)
+  set(PROTOBUF_PATCH_CMD   ${CMAKE_NOOP})
   set(PROTOBUF_CONFIG_CMD  ${PROTOBUF_ROOT}/src/../configure --prefix=${PROTOBUF_LIB})
   set(PROTOBUF_BUILD_CMD   make)
   set(PROTOBUF_INSTALL_CMD make install)
+elseif (WIN32)
+  set(PROTOBUF_PATCH_CMD   ${CMAKE_NOOP})
+  set(PROTOBUF_CONFIG_CMD  ${CMAKE_NOOP})
+  set(PROTOBUF_INSTALL_CMD ${CMAKE_NOOP})
+  VS_BUILD_CMD(
+      PROTOBUF
+      ${PROTOBUF_ROOT}/vsprojects/protobuf.sln
+      ${CMAKE_BUILD_TYPE}
+      "libprotobuf libprotoc protoc")
 endif (NOT WIN32)
 
 ExternalProject_Add(
@@ -241,9 +249,9 @@ ExternalProject_Add(
   # parameters passed in here.
   ${GMOCK_TARGET}
   PREFIX            ${GMOCK_CMAKE_ROOT}
-  CONFIGURE_COMMAND "${GMOCK_CONFIG_CMD}"
-  BUILD_COMMAND     "${GMOCK_BUILD_CMD}"
-  INSTALL_COMMAND   "${GMOCK_INSTALL_CMD}"
+  CONFIGURE_COMMAND ${GMOCK_CONFIG_CMD}
+  BUILD_COMMAND     ${GMOCK_BUILD_CMD}
+  INSTALL_COMMAND   ${GMOCK_INSTALL_CMD}
   URL               ${GMOCK_URL}
   )
 
@@ -252,10 +260,10 @@ ExternalProject_Add(
   # parameters passed in here.
   ${PROTOBUF_TARGET}
   PREFIX            ${PROTOBUF_CMAKE_ROOT}
-  PATCH_COMMAND     "${PROTOBUF_PATCH_CMD}"
-  CONFIGURE_COMMAND "${PROTOBUF_CONFIG_CMD}"
-  BUILD_COMMAND     "${PROTOBUF_BUILD_CMD}"
-  INSTALL_COMMAND   "${PROTOBUF_INSTALL_CMD}"
+  PATCH_COMMAND     ${PROTOBUF_PATCH_CMD}
+  CONFIGURE_COMMAND ${PROTOBUF_CONFIG_CMD}
+  BUILD_COMMAND     ${PROTOBUF_BUILD_CMD}
+  INSTALL_COMMAND   ${PROTOBUF_INSTALL_CMD}
   URL               ${PROTOBUF_URL}
   )
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/46612006/3rdparty/libprocess/cmake/macros/VsBuildCommand.bat
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/macros/VsBuildCommand.bat b/3rdparty/libprocess/cmake/macros/VsBuildCommand.bat
new file mode 100644
index 0000000..8da05bc
--- /dev/null
+++ b/3rdparty/libprocess/cmake/macros/VsBuildCommand.bat
@@ -0,0 +1,67 @@
+:: Licensed to the Apache Software Foundation (ASF) under one
+:: or more contributor license agreements.  See the NOTICE file
+:: distributed with this work for additional information
+:: regarding copyright ownership.  The ASF licenses this file
+:: to you under the Apache License, Version 2.0 (the
+:: "License"); you may not use this file except in compliance
+:: with the License.  You may obtain a copy of the License at
+::
+::     http://www.apache.org/licenses/LICENSE-2.0
+::
+:: Unless required by applicable law or agreed to in writing, software
+:: distributed under the License is distributed on an "AS IS" BASIS,
+:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+:: See the License for the specific language governing permissions and
+:: limitations under the License.
+
+@echo off
+
+:: Parse command line params.
+for /f "tokens=1-2*" %%A in ("%*") do (
+  set SOLUTION_FILE=%%A
+  set CONFIGURATION=%%B
+  set PROJECTS=%%C
+)
+
+set PLATFORM=Win32
+setlocal EnableDelayedExpansion
+setlocal EnableExtensions
+
+:: Get Visual Studio 2015 install directory.
+set VS2015_KEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0
+set VS2015_INSTALLDIR_VALUE=InstallDir
+
+for /F "skip=2 tokens=1,2*" %%A ^
+in ('REG QUERY %VS2015_KEY% /v %VS2015_INSTALLDIR_VALUE% 2^>nul') do (
+  set VS2015_DIR=%%C..\..
+)
+
+:: Check if Visual Studio 2015 is installed.
+if defined VS2015_DIR (
+  set SOLUTION_VER=12.00
+  :: Prepare Visual Studio 2015 command line environment.
+  call "%VS2015_DIR%\VC\vcvarsall.bat" x86
+) else (
+  echo "No compiler : Microsoft Visual Studio (2015) is not installed."
+  exit /b 1
+)
+
+FINDSTR ^
+    /C:"Microsoft Visual Studio Solution File, Format Version %SOLUTION_VER%" ^
+    %SOLUTION_FILE:/=\%
+if %errorlevel% neq 0 (
+  :: Upgrade solution file if its version does not match current %SOLUTION_VER%.
+  echo "Upgrading Visual Studio Solution File: %SOLUTION_FILE% ."
+  devenv /upgrade %SOLUTION_FILE%
+)
+
+if not "%PROJECTS%" == "" (
+  set PROJECTS_TARGET=/t:%PROJECTS: =;%
+)
+
+msbuild ^
+    %SOLUTION_FILE% %PROJECTS_TARGET% ^
+    /p:Configuration=%CONFIGURATION%;Platform=%PLATFORM%
+
+:end
+exit /b
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/46612006/3rdparty/libprocess/cmake/macros/VsBuildCommand.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/macros/VsBuildCommand.cmake b/3rdparty/libprocess/cmake/macros/VsBuildCommand.cmake
new file mode 100644
index 0000000..632696e
--- /dev/null
+++ b/3rdparty/libprocess/cmake/macros/VsBuildCommand.cmake
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################################################
+# VS_BUILD_CMD generates a build command for project which have Visual Studio
+# Solution File(.sln). For example, when we want to build GLOG through Visual
+# Studio in command line, we would run this command. It would define
+# ${LIB_NAME_UPPER}_BUILD_CMD with build command finally.
+function(VS_BUILD_CMD LIB_NAME SOLUTION_FILE BUILD_CONFIGURATION PROJECTS)
+
+  string(TOUPPER ${LIB_NAME} LIB_NAME_UPPER)
+
+  set(VS_BUILD_SCRIPT
+    ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake/macros/VsBuildCommand.bat)
+  set(BUILD_CMD_VAR ${LIB_NAME_UPPER}_BUILD_CMD)
+
+  # Generate the build command with ${VS_BUILD_SCRIPT}.
+  ## 1. Convert the path to Windows style.
+  file(
+    TO_NATIVE_PATH
+    "${VS_BUILD_SCRIPT} ${SOLUTION_FILE} ${BUILD_CONFIGURATION} ${PROJECTS}"
+    BUILD_CMD_STRING)
+  ## 2. Convert the command to list so that CMake could handle it correctly.
+  string(REPLACE " " ";" BUILD_CMD ${BUILD_CMD_STRING})
+
+  set(${BUILD_CMD_VAR} ${BUILD_CMD} PARENT_SCOPE)
+endfunction()
\ No newline at end of file


[17/20] mesos git commit: CMake: Added build/configure/install logic for Zookeeper.

Posted by jo...@apache.org.
CMake: Added build/configure/install logic for Zookeeper.

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


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

Branch: refs/heads/master
Commit: a79ace3d7ec069f8812ba71ac319d08dac7a3831
Parents: 09f9b53
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:34 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:22:32 2015 -0700

----------------------------------------------------------------------
 3rdparty/CMakeLists.txt                     | 62 ++++++++++++++++++++++++
 3rdparty/cmake/Mesos3rdpartyConfigure.cmake | 36 ++++++++++++++
 3rdparty/cmake/Versions.cmake               |  1 +
 CMakeLists.txt                              |  2 +-
 cmake/MesosConfigure.cmake                  |  1 +
 5 files changed, 101 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a79ace3d/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
new file mode 100644
index 0000000..ac5c25a
--- /dev/null
+++ b/3rdparty/CMakeLists.txt
@@ -0,0 +1,62 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include(ExternalProject)
+
+add_subdirectory(libprocess)
+
+# Downloads, configures, and compiles the third-party libraries for the mesos.
+
+# Define sources of third-party dependencies.
+#############################################
+set(UPSTREAM_URL https://github.com/3rdparty/mesos-3rdparty/raw/master)
+set(REBUNDLED_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
+if (REBUNDLED)
+  set(ZOOKEEPER_URL ${REBUNDLED_DIR}/zookeeper-${ZOOKEEPER_VERSION}.tar.gz)
+else (REBUNDLED)
+  set(ZOOKEEPER_URL ${UPSTREAM_URL}/zookeeper-${ZOOKEEPER_VERSION}.tar.gz)
+endif (REBUNDLED)
+
+# Define build/patch/configure commands for third-party libs.
+#############################################################
+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)
+
+  PATCH_CMD(
+    ${MESOS_3RDPARTY_SRC}/zookeeper-${ZOOKEEPER_VERSION}.patch
+    ZOOKEEPER_PATCH_CMD)
+elseif (WIN32)
+  set(ZOOKEEPER_PATCH_CMD   ${CMAKE_NOOP})
+  set(ZOOKEEPER_CONFIG_CMD  ${CMAKE_NOOP})
+  set(ZOOKEEPER_BUILD_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}
+  )
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/a79ace3d/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Mesos3rdpartyConfigure.cmake b/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
new file mode 100644
index 0000000..34e61ff
--- /dev/null
+++ b/3rdparty/cmake/Mesos3rdpartyConfigure.cmake
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# DEFINE DIRECTORY STRUCTURE FOR THIRD-PARTY LIBS.
+##################################################
+set(MESOS_3RDPARTY_SRC ${CMAKE_SOURCE_DIR}/3rdparty)
+set(MESOS_3RDPARTY_BIN ${CMAKE_BINARY_DIR}/3rdparty)
+
+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}-lib/lib)
+
+# Convenience variables for include directories of third-party dependencies.
+set(ZOOKEEPER_INCLUDE_DIR ${ZOOKEEPER_LIB}/include/zookeeper)
+
+# Convenience variables for `lib` directories of built third-party dependencies.
+set(ZOOKEEPER_LIB_DIR ${ZOOKEEPER_LIB}/lib)
+
+# Convenience variables for "lflags", the symbols we pass to CMake to generate
+# things like `-L/path/to/glog` or `-lglog`.
+set(ZOOKEEPER_LFLAG  zookeeper_mt)

http://git-wip-us.apache.org/repos/asf/mesos/blob/a79ace3d/3rdparty/cmake/Versions.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
index c41422c..932f2f6 100644
--- a/3rdparty/cmake/Versions.cmake
+++ b/3rdparty/cmake/Versions.cmake
@@ -9,3 +9,4 @@ set(LIBEV_VERSION       "4.15")
 set(LIBEVENT_VERSION    "2.1.5-beta")
 set(PICOJSON_VERSION    "1.3.0")
 set(PROTOBUF_VERSION    "2.5.0")
+set(ZOOKEEPER_VERSION   "3.4.5")

http://git-wip-us.apache.org/repos/asf/mesos/blob/a79ace3d/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a5559b5..ba209c8 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,4 +88,4 @@ include(MesosConfigure)
 
 # SUBDIRECTORIES.
 #################
-add_subdirectory(3rdparty/libprocess)
+add_subdirectory(3rdparty)

http://git-wip-us.apache.org/repos/asf/mesos/blob/a79ace3d/cmake/MesosConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/MesosConfigure.cmake b/cmake/MesosConfigure.cmake
index 73df287..1fff02e 100755
--- a/cmake/MesosConfigure.cmake
+++ b/cmake/MesosConfigure.cmake
@@ -114,6 +114,7 @@ endif (WIN32)
 ############################
 # NOTE: The third-party configuration variables exported here are used
 # throughout the project, so it's important that this config script goes here.
+include(Mesos3rdpartyConfigure)
 include(Process3rdpartyConfigure)
 
 # Generate a batch script that will build Mesos. Any project referencing Mesos


[11/20] mesos git commit: CMake: Integrated libevent into Windows builds.

Posted by jo...@apache.org.
CMake: Integrated libevent into Windows builds.

Since there is no robust standalone libev support on Windows, Mesos will
need to use libevent to support Windows, at least in the short term.

This commit will add logic to configure, build, and install libevent for
all Windows builds.

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


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

Branch: refs/heads/master
Commit: 403d74ade891ce288e3c7927a7c37fabe724f271
Parents: e9c64fb
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:26 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:14:28 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/CMakeLists.txt     | 42 ++++++++++++--------
 .../libprocess/cmake/ProcessConfigure.cmake     |  1 +
 2 files changed, 27 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/403d74ad/3rdparty/libprocess/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/CMakeLists.txt b/3rdparty/libprocess/3rdparty/CMakeLists.txt
index 4f439fa..0963222 100644
--- a/3rdparty/libprocess/3rdparty/CMakeLists.txt
+++ b/3rdparty/libprocess/3rdparty/CMakeLists.txt
@@ -37,6 +37,10 @@ else (REBUNDLED)
   set(LIBEV_URL       ${UPSTREAM_URL}/libev-${LIBEV_VERSION}.tar.gz)
 endif (REBUNDLED)
 
+# 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)
+
 if (WIN32)
   # TODO(hausdorff): (MESOS-3394) Upgrade Windows to use glog v0.3.5, as that
   # release will contain fixes that will allow us to build glog on Windows.
@@ -58,9 +62,8 @@ if (WIN32)
   # (as well as all the other third-party dependencies) on MSVC 1900.
   #
   # [1] https://github.com/google/glog/pull/43
-  set(GLOG_URL https://github.com/hausdorff/glog/tarball/glog-${GLOG_VERSION}-msvc1900)
-
-  set(CURL_URL ${UPSTREAM_URL}/curl-static-${CURL_VERSION}.tar.gz)
+  set(GLOG_URL     https://github.com/hausdorff/glog/tarball/glog-${GLOG_VERSION}-msvc1900)
+  set(CURL_URL     ${UPSTREAM_URL}/curl-static-${CURL_VERSION}.tar.gz)
 endif (WIN32)
 
 # Define build/patch/configure commands for third-party libs.
@@ -116,10 +119,7 @@ elseif (WIN32)
   set(RY_BUILD_CMD   ${CMAKE_NOOP})
   set(RY_INSTALL_CMD ${CMAKE_NOOP})
 
-  set(LIBEV_PATCH_CMD    ${CMAKE_NOOP})
-  set(LIBEV_CONFIG_CMD   ${CMAKE_NOOP})
-  set(LIBEV_BUILD_CMD    ${CMAKE_NOOP})
-  set(LIBEV_INSTALL_CMD  ${CMAKE_NOOP})
+  set(LIBEVENT_INSTALL_CMD ${CMAKE_NOOP})
 endif (NOT WIN32)
 
 # Third-party libraries. Tell the build system how to pull in and build third-
@@ -163,15 +163,25 @@ ExternalProject_Add(
   URL               ${HTTP_PARSER_URL}
   )
 
-ExternalProject_Add(
-  ${LIBEV_TARGET}
-  PREFIX            ${LIBEV_CMAKE_ROOT}
-  PATCH_COMMAND     ${LIBEV_PATCH_CMD}
-  CONFIGURE_COMMAND ${LIBEV_CONFIG_CMD}
-  BUILD_COMMAND     ${LIBEV_BUILD_CMD}
-  INSTALL_COMMAND   ${LIBEV_INSTALL_CMD}
-  URL               ${LIBEV_URL}
-  )
+if (NOT ENABLE_LIBEVENT)
+  ExternalProject_Add(
+    ${LIBEV_TARGET}
+    PREFIX            ${LIBEV_CMAKE_ROOT}
+    PATCH_COMMAND     ${LIBEV_PATCH_CMD}
+    CONFIGURE_COMMAND ${LIBEV_CONFIG_CMD}
+    BUILD_COMMAND     ${LIBEV_BUILD_CMD}
+    INSTALL_COMMAND   ${LIBEV_INSTALL_CMD}
+    URL               ${LIBEV_URL}
+    )
+elseif (ENABLE_LIBEVENT)
+  ExternalProject_Add(
+    ${LIBEVENT_TARGET}
+    PREFIX          ${LIBEVENT_CMAKE_ROOT}
+    CMAKE_ARGS      -LH -DEVENT__DISABLE_OPENSSL=TRUE
+    INSTALL_COMMAND ${LIBEVENT_INSTALL_CMD}
+    URL             ${LIBEVENT_URL}
+    )
+endif (NOT ENABLE_LIBEVENT)
 
 # WINDOWS THIRD-PARTY LIBRARIES. Windows has no package manager, so we download
 # them here.

http://git-wip-us.apache.org/repos/asf/mesos/blob/403d74ad/3rdparty/libprocess/cmake/ProcessConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessConfigure.cmake b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
index 8c89cd7..1467c97 100755
--- a/3rdparty/libprocess/cmake/ProcessConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
@@ -55,6 +55,7 @@ EXTERNAL("boost"       ${BOOST_VERSION}       "${PROCESS_3RD_BIN}")
 EXTERNAL("picojson"    ${PICOJSON_VERSION}    "${PROCESS_3RD_BIN}")
 EXTERNAL("http_parser" ${HTTP_PARSER_VERSION} "${PROCESS_3RD_BIN}")
 EXTERNAL("libev"       ${LIBEV_VERSION}       "${PROCESS_3RD_BIN}")
+EXTERNAL("libevent"    ${LIBEVENT_VERSION}    "${PROCESS_3RD_BIN}")
 
 if (NOT WIN32)
   EXTERNAL("glog" ${GLOG_VERSION} "${PROCESS_3RD_BIN}")


[08/20] mesos git commit: CMake: Added `Versions.cmake` as an analog to `versions.am`.

Posted by jo...@apache.org.
CMake: Added `Versions.cmake` as an analog to `versions.am`.

As we prepare to add more third-party dependencies, it will be helpful
to have all the version information of our third-party dependencies in
one place, rather than scattered everywhere in the project.

This commit will introduce `Versions.cmake`, which will hold all this
information.

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


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

Branch: refs/heads/master
Commit: b610deba0441b81acd77745b72540f257883fb7d
Parents: 8125f40
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:22 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:10:20 2015 -0700

----------------------------------------------------------------------
 3rdparty/cmake/Versions.cmake | 8 ++++++++
 CMakeLists.txt                | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/b610deba/3rdparty/cmake/Versions.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
new file mode 100644
index 0000000..b3b94f2
--- /dev/null
+++ b/3rdparty/cmake/Versions.cmake
@@ -0,0 +1,8 @@
+set(BOOST_VERSION       "1.53.0")
+set(CURL_VERSION        "7.43.0")
+set(GLOG_VERSION        "0.3.3")
+set(GMOCK_VERSION       "1.7.0")
+set(HTTP_PARSER_VERSION "1c3624a")
+set(LIBEV_VERSION       "4.15")
+set(PICOJSON_VERSION    "1.3.0")
+set(PROTOBUF_VERSION    "2.5.0")

http://git-wip-us.apache.org/repos/asf/mesos/blob/b610deba/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8136acb..de02c2c 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,13 +36,17 @@ set(CMAKE_VERBOSE_MAKEFILE ${VERBOSE})
 # CMAKE MODULE SETUP.
 #####################
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/cmake)
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake/macros)
+list(
+  APPEND
+  CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake/macros)
 
 # Macros.
 include(Common)
 include(External)
 include(PatchCommand)
+include(Versions)
 include(VsBuildCommand)
 
 # Configuration.


[05/20] mesos git commit: CMake: Added `CMAKE_NOOP` to common definitions file.

Posted by jo...@apache.org.
CMake: Added `CMAKE_NOOP` to common definitions file.

Original review: https://reviews.apache.org/r/37273

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


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

Branch: refs/heads/master
Commit: fa481e433f8dfdcc991520af7e8d483670790757
Parents: 3396a8e
Author: haosdent huang <ha...@gmail.com>
Authored: Sun Sep 27 15:41:18 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:05:49 2015 -0700

----------------------------------------------------------------------
 CMakeLists.txt     |  3 ++-
 cmake/Common.cmake | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fa481e43/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b6f4af..4b684f6 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,8 +40,9 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake)
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake/macros)
 
 # Macros.
-include(PatchCommand)
+include(Common)
 include(External)
+include(PatchCommand)
 
 # Configuration.
 include(MesosConfigure)

http://git-wip-us.apache.org/repos/asf/mesos/blob/fa481e43/cmake/Common.cmake
----------------------------------------------------------------------
diff --git a/cmake/Common.cmake b/cmake/Common.cmake
new file mode 100644
index 0000000..76b2a67
--- /dev/null
+++ b/cmake/Common.cmake
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+###############################################################
+# Exports a variable CMAKE_NOOP as noop operation.
+#
+# NOTE: This is especially important when building third-party libraries on
+# Windows; the default behavior of `ExternalProject` is to try to assume that
+# third-party libraries can be configured/built/installed with CMake, so in
+# cases where this isn't true, we have to "trick" CMake into skipping those
+# steps by giving it a noop command to run instead.
+set(CMAKE_NOOP ${CMAKE_COMMAND} -E echo)


[03/20] mesos git commit: CMake: Added preprocessor definitions required to build picojson 1.3.0.

Posted by jo...@apache.org.
CMake: Added preprocessor definitions required to build picojson 1.3.0.

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


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

Branch: refs/heads/master
Commit: a051fde5413f660aa6c32fd33a6c3687bb905687
Parents: 1eb0519
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:15 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:03:32 2015 -0700

----------------------------------------------------------------------
 cmake/MesosConfigure.cmake | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a051fde5/cmake/MesosConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/MesosConfigure.cmake b/cmake/MesosConfigure.cmake
index b530da4..e1d53a1 100755
--- a/cmake/MesosConfigure.cmake
+++ b/cmake/MesosConfigure.cmake
@@ -115,3 +115,13 @@ endif (WIN32)
 # NOTE: The third-party configuration variables exported here are used
 # throughout the project, so it's important that this config script goes here.
 include(ProcessConfigure)
+
+# Add preprocessor definitions required to build third-party libraries.
+#######################################################################
+# Enable the INT64 support for PicoJSON.
+add_definitions(-DPICOJSON_USE_INT64)
+# NOTE: PicoJson requires __STDC_FORMAT_MACROS to be defined before importing
+# 'inttypes.h'.  Since other libraries may also import this header, it must
+# be globally defined so that PicoJson has access to the macros, regardless
+# of the order of inclusion.
+add_definitions(-D__STDC_FORMAT_MACROS)


[20/20] mesos git commit: CMake: Transitioned to CMake-based build system for GMock/GTest.

Posted by jo...@apache.org.
CMake: Transitioned to CMake-based build system for GMock/GTest.

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


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

Branch: refs/heads/master
Commit: 1a7ad5e35b727187c25ace7f822858985ae8439c
Parents: d4a970e
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:38 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:25:18 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/CMakeLists.txt     | 23 ++++++++------------
 .../cmake/ProcessTestsConfigure.cmake           |  2 +-
 2 files changed, 10 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1a7ad5e3/3rdparty/libprocess/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/CMakeLists.txt b/3rdparty/libprocess/3rdparty/CMakeLists.txt
index c85586b..31d77d5 100644
--- a/3rdparty/libprocess/3rdparty/CMakeLists.txt
+++ b/3rdparty/libprocess/3rdparty/CMakeLists.txt
@@ -231,15 +231,8 @@ endif (WIN32)
 
 # NOTE: `gmock` is "installed" into a lib directory, see "NOTE: (fix for
 # MESOS-3250)" comment above for explanation.
-if (APPLE)
-  set(GMOCK_CONFIG_CMD  ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib)
-  # GTEST on OSX needs its own tr1 tuple.
-  set(GMOCK_BUILD_CMD   make CPPFLAGS=-DGTEST_USE_OWN_TR1_TUPLE)
-  set(GMOCK_INSTALL_CMD mkdir -p ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/lib/.libs/. ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/gtest/lib/.libs/. ${GMOCK_ROOT}-lib/lib)
-elseif (NOT WIN32)
-  set(GMOCK_CONFIG_CMD  ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib)
-  set(GMOCK_BUILD_CMD   make)
-  set(GMOCK_INSTALL_CMD mkdir -p ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/lib/.libs/. ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/gtest/lib/.libs/. ${GMOCK_ROOT}-lib/lib)
+if (NOT WIN32)
+  set(GMOCK_INSTALL_CMD mkdir -p ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/. ${GMOCK_ROOT}-lib/lib && cp -r ${GMOCK_ROOT}-build/gtest/. ${GMOCK_ROOT}-lib/lib)
 elseif (WIN32)
   set(GMOCK_CONFIG_CMD ${CMAKE_NOOP})
   VS_BUILD_CMD(
@@ -248,7 +241,7 @@ elseif (WIN32)
       ${CMAKE_BUILD_TYPE}
       "gmock gmock_main")
   set(GMOCK_INSTALL_CMD ${CMAKE_NOOP})
-endif (APPLE)
+endif (NOT WIN32)
 
 if (NOT WIN32)
   set(PROTOBUF_PATCH_CMD   ${CMAKE_NOOP})
@@ -266,9 +259,13 @@ elseif (WIN32)
       "libprotobuf libprotoc protoc")
 endif (NOT WIN32)
 
+# NOTE: An implicit consequence of the following code is that on non-Windows
+# platforms, gmock and gtest are assumed to be CMake projects, and are thus
+# configured and built using default CMake commands. The reason is that on
+# non-Windows platforms, we choose to set `GMOCK_CONFIG_CMD` and
+# `GMOCK_BUILD_CMD` with stub commands, which cause CMake to "fall back" to
+# trying to build them with CMake.
 ExternalProject_Add(
-  # See note about third-party libraries above to understand quirky actual
-  # parameters passed in here.
   ${GMOCK_TARGET}
   PREFIX            ${GMOCK_CMAKE_ROOT}
   CONFIGURE_COMMAND ${GMOCK_CONFIG_CMD}
@@ -278,8 +275,6 @@ ExternalProject_Add(
   )
 
 ExternalProject_Add(
-  # See note about third-party libraries above to understand quirky actual
-  # parameters passed in here.
   ${PROTOBUF_TARGET}
   PREFIX            ${PROTOBUF_CMAKE_ROOT}
   PATCH_COMMAND     ${PROTOBUF_PATCH_CMD}

http://git-wip-us.apache.org/repos/asf/mesos/blob/1a7ad5e3/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
index 99496f2..ea6db09 100644
--- a/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
@@ -49,7 +49,7 @@ set(GTEST_LIB_DIR ${GMOCK_ROOT}-build/gtest/lib/.libs)
 if (WIN32)
   set(GMOCK_LIB_DIR    ${GMOCK_ROOT}/msvc/2010/Debug)
 else (WIN32)
-  set(GMOCK_LIB_DIR    ${GMOCK_ROOT}-build/lib/.libs)
+  set(GMOCK_LIB_DIR    ${GMOCK_ROOT}-lib/lib/)
 endif (WIN32)
 
 # Convenience variables for "lflags", the symbols we pass to CMake to generate


[12/20] mesos git commit: CMake: Added version info for APR needed to build Windows.

Posted by jo...@apache.org.
CMake: Added version info for APR needed to build Windows.

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


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

Branch: refs/heads/master
Commit: 9f4d76c0ac367cde07c5a329730aaff37da12379
Parents: 403d74a
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:27 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:15:53 2015 -0700

----------------------------------------------------------------------
 3rdparty/cmake/Versions.cmake | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9f4d76c0/3rdparty/cmake/Versions.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/cmake/Versions.cmake b/3rdparty/cmake/Versions.cmake
index 18f1168..c41422c 100644
--- a/3rdparty/cmake/Versions.cmake
+++ b/3rdparty/cmake/Versions.cmake
@@ -3,6 +3,7 @@ set(CURL_VERSION        "7.43.0")
 set(GLOG_VERSION        "0.3.3")
 set(GMOCK_VERSION       "1.7.0")
 set(HTTP_PARSER_VERSION "1c3624a")
+set(LIBAPR_VERSION      "1.5.2")
 set(LIBEV_VERSION       "4.15")
 # TODO(hausdorff): (MESOS-3529) transition this back to a non-beta version.
 set(LIBEVENT_VERSION    "2.1.5-beta")


[09/20] mesos git commit: CMake: Used version info from `Versions.cmake` instead of magic strings.

Posted by jo...@apache.org.
CMake: Used version info from `Versions.cmake` instead of magic strings.

Currently we configure the version information of third-party
dependencies in the CMake build system from magic strings.

This commit will transition away from the magic string solution and
towards the variables we define in `Versions.cmake`.

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


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

Branch: refs/heads/master
Commit: a2af52a6b7c01161f45d9ba6cabda733ecd9d62f
Parents: b610deb
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:23 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:11:29 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/cmake/ProcessConfigure.cmake      | 12 ++++++------
 3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/a2af52a6/3rdparty/libprocess/cmake/ProcessConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessConfigure.cmake b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
index a956054..8c89cd7 100755
--- a/3rdparty/libprocess/cmake/ProcessConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
@@ -51,13 +51,13 @@ set(PROCESS_3RD_BIN ${CMAKE_BINARY_DIR}/3rdparty/libprocess/3rdparty)
 
 set(STOUT ${PROCESS_3RD_SRC}/stout)
 
-EXTERNAL("boost"       "1.53.0"  "${PROCESS_3RD_BIN}")
-EXTERNAL("picojson"    "1.3.0"   "${PROCESS_3RD_BIN}")
-EXTERNAL("http_parser" "1c3624a" "${PROCESS_3RD_BIN}")
-EXTERNAL("libev"       "4.15"    "${PROCESS_3RD_BIN}")
+EXTERNAL("boost"       ${BOOST_VERSION}       "${PROCESS_3RD_BIN}")
+EXTERNAL("picojson"    ${PICOJSON_VERSION}    "${PROCESS_3RD_BIN}")
+EXTERNAL("http_parser" ${HTTP_PARSER_VERSION} "${PROCESS_3RD_BIN}")
+EXTERNAL("libev"       ${LIBEV_VERSION}       "${PROCESS_3RD_BIN}")
 
 if (NOT WIN32)
-  EXTERNAL("glog" "0.3.3" "${PROCESS_3RD_BIN}")
+  EXTERNAL("glog" ${GLOG_VERSION} "${PROCESS_3RD_BIN}")
 elseif (WIN32)
   # Glog 0.3.3 does not compile out of the box on Windows. Therefore, we
   # require 0.3.4.
@@ -69,7 +69,7 @@ set(GLOG_LIB ${GLOG_ROOT}-lib/lib)
 # Directory structure for windows-only third-party libs.
 ########################################################
 if (WIN32)
-  EXTERNAL("curl" "7.43.0" "${PROCESS_3RD_BIN}")
+  EXTERNAL("curl" ${CURL_VERSION} "${PROCESS_3RD_BIN}")
 endif (WIN32)
 
 # Define process library dependencies. Tells the process library build targets

http://git-wip-us.apache.org/repos/asf/mesos/blob/a2af52a6/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
index 9e4dcb8..e105bd8 100644
--- a/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
@@ -33,8 +33,8 @@
 
 # DIRECTORY STRUCTURE FOR THIRD-PARTY LIBS REQUIRED FOR TEST INFRASTRUCTURE.
 ############################################################################
-EXTERNAL("gmock"    "1.7.0" "${PROCESS_3RD_BIN}")
-EXTERNAL("protobuf" "2.5.0" "${PROCESS_3RD_BIN}")
+EXTERNAL("gmock"    ${GMOCK_VERSION}    "${PROCESS_3RD_BIN}")
+EXTERNAL("protobuf" ${PROTOBUF_VERSION} "${PROCESS_3RD_BIN}")
 
 set(GTEST_SRC          ${GMOCK_ROOT}/gtest)
 set(GPERFTOOLS_VERSION 2.0)


[19/20] mesos git commit: CMake: Added support for compiling the agent with CMake.

Posted by jo...@apache.org.
CMake: Added support for compiling the agent with CMake.

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


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

Branch: refs/heads/master
Commit: d4a970e64376a2df523f2d820f29f8a79d67dcc2
Parents: 96b25d8
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:36 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:24:26 2015 -0700

----------------------------------------------------------------------
 CMakeLists.txt                       |  11 ++-
 cmake/MesosConfigure.cmake           |  27 +++++++
 src/CMakeLists.txt                   | 129 ++++++++++++++++++++++++++++++
 src/cmake/MesosProtobuf.cmake        | 102 +++++++++++++++++++++++
 src/slave/cmake/SlaveConfigure.cmake |  71 ++++++++++++++++
 5 files changed, 339 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/d4a970e6/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba209c8..c866f6d 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,7 +19,13 @@
 cmake_minimum_required(VERSION 2.8)
 
 project(Mesos)
-set(MESOS_PACKAGE_VERSION 0.22.1)
+set(MESOS_MAJOR_VERSION 0)
+set(MESOS_MINOR_VERSION 26)
+set(MESOS_PATCH_VERSION 0)
+set(PACKAGE_VERSION
+  ${MESOS_MAJOR_VERSION}.${MESOS_MINOR_VERSION}.${MESOS_PATCH_VERSION})
+
+set(MESOS_PACKAGE_VERSION ${PACKAGE_VERSION})
 set(MESOS_PACKAGE_SOVERSION 0)
 
 # MESOS BUILD CONFIGURATION OPTIONS.
@@ -75,6 +81,8 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake)
 list(
   APPEND
   CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake/macros)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/cmake)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/slave/cmake)
 
 # Macros.
 include(Common)
@@ -89,3 +97,4 @@ include(MesosConfigure)
 # SUBDIRECTORIES.
 #################
 add_subdirectory(3rdparty)
+add_subdirectory(src)

http://git-wip-us.apache.org/repos/asf/mesos/blob/d4a970e6/cmake/MesosConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/MesosConfigure.cmake b/cmake/MesosConfigure.cmake
index 2f4c412..9a4fdb5 100755
--- a/cmake/MesosConfigure.cmake
+++ b/cmake/MesosConfigure.cmake
@@ -62,3 +62,30 @@ if (WIN32)
   string(REPLACE ";" " " MESOS_BUILD_CMD "${MESOS_BUILD_CMD}")
   file(WRITE ${CMAKE_BINARY_DIR}/make.bat ${MESOS_BUILD_CMD})
 endif (WIN32)
+
+# DEFINE DIRECTORY STRUCTURE MESOS PROJECT.
+###########################################
+set(MESOS_SRC_DIR     ${CMAKE_SOURCE_DIR}/src)
+set(MESOS_BIN         ${CMAKE_BINARY_DIR})
+set(MESOS_BIN_SRC_DIR ${MESOS_BIN}/src)
+
+# Convenience variables for include directories of third-party dependencies.
+set(MESOS_PUBLIC_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include)
+set(MESOS_BIN_INCLUDE_DIR    ${CMAKE_BINARY_DIR}/include)
+
+# Make directories that generated Mesos code goes into.
+add_custom_target(
+  make_bin_include_dir ALL
+  COMMAND ${CMAKE_COMMAND} -E make_directory ${MESOS_BIN_INCLUDE_DIR})
+
+add_custom_target(
+  make_bin_src_dir ALL
+  COMMAND ${CMAKE_COMMAND} -E make_directory ${MESOS_BIN_SRC_DIR})
+
+# CONFIGURE AGENT.
+##################
+include(SlaveConfigure)
+
+# MESOS LIBRARY CONFIGURATION.
+##############################
+set(MESOS_TARGET mesos-${MESOS_PACKAGE_VERSION})
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/d4a970e6/src/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..891f951
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,129 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# COMPILE PROTOBUF STRUCTS REQUIRED TO BUILD MESOS.
+###################################################
+include(MesosProtobuf)
+
+# Build the protobuf structs.
+PROTOC_TO_INCLUDE_DIR(MESOS            mesos/mesos)
+PROTOC_TO_INCLUDE_DIR(V1_MESOS         mesos/v1/mesos)
+PROTOC_TO_INCLUDE_DIR(AUTHENTICATION   mesos/authentication/authentication)
+PROTOC_TO_INCLUDE_DIR(AUTHORIZATION    mesos/authorizer/authorizer)
+PROTOC_TO_INCLUDE_DIR(CONTAINERIZER    mesos/containerizer/containerizer)
+PROTOC_TO_INCLUDE_DIR(EXECUTOR         mesos/executor/executor)
+PROTOC_TO_INCLUDE_DIR(V1_EXECUTOR      mesos/v1/executor/executor)
+PROTOC_TO_INCLUDE_DIR(FETCHER          mesos/fetcher/fetcher)
+PROTOC_TO_INCLUDE_DIR(MAINTENANCE      mesos/maintenance/maintenance)
+PROTOC_TO_INCLUDE_DIR(ALLOCATOR        mesos/master/allocator)
+PROTOC_TO_INCLUDE_DIR(MODULE           mesos/module/module)
+PROTOC_TO_INCLUDE_DIR(SCHEDULER        mesos/scheduler/scheduler)
+PROTOC_TO_INCLUDE_DIR(V1_SCHEDULER     mesos/v1/scheduler/scheduler)
+PROTOC_TO_INCLUDE_DIR(ISOLATOR         mesos/slave/isolator)
+PROTOC_TO_INCLUDE_DIR(OVERSUBSCRIPTION mesos/slave/oversubscription)
+
+PROTOC_TO_SRC_DIR(MESSAGES messages/messages)
+PROTOC_TO_SRC_DIR(FLAGS    messages/flags)
+
+set(MESOS_PROTOBUF_SRC
+  ${MESOS_PROTO_CC}
+  ${V1_MESOS_PROTO_CC}
+  ${AUTHENTICATION_PROTO_CC}
+  ${AUTHORIZATION_PROTO_CC}
+  ${CONTAINERIZER_PROTO_CC}
+  ${EXECUTOR_PROTO_CC}
+  ${V1_EXECUTOR_PROTO_CC}
+  ${FETCHER_PROTO_CC}
+  ${MAINTENANCE_PROTO_CC}
+  ${ALLOCATOR_PROTO_CC}
+  ${MODULE_PROTO_CC}
+  ${SCHEDULER_PROTO_CC}
+  ${V1_SCHEDULER_PROTO_CC}
+  ${MESSAGES_PROTO_CC}
+  ${FLAGS_PROTO_CC}
+  ${ISOLATOR_PROTO_CC}
+  ${OVERSUBSCRIPTION_PROTO_CC}
+  )
+
+# Configure Mesos files.
+########################
+configure_file(
+  ${MESOS_PUBLIC_INCLUDE_DIR}/mesos/version.hpp.in
+  ${MESOS_BIN_INCLUDE_DIR}/mesos/version.hpp
+  )
+
+# SOURCE FILES FOR THE MESOS LIBRARY.
+#####################################
+set(AGENT_SRC
+  slave/constants.cpp
+  slave/gc.cpp
+  slave/flags.cpp
+  slave/http.cpp
+  slave/metrics.cpp
+  slave/monitor.cpp
+  slave/paths.cpp
+  slave/qos_controller.cpp
+  slave/qos_controllers/noop.cpp
+  slave/resource_estimator.cpp
+  slave/slave.cpp
+  slave/state.cpp
+  slave/status_update_manager.cpp
+  slave/containerizer/containerizer.cpp
+  slave/containerizer/composing.cpp
+  slave/containerizer/composing.hpp
+  slave/containerizer/docker.cpp
+  slave/containerizer/docker.hpp
+  slave/containerizer/external_containerizer.cpp
+  slave/containerizer/fetcher.cpp
+  slave/containerizer/isolator.cpp
+  slave/containerizer/isolators/filesystem/posix.cpp
+  slave/containerizer/isolators/posix/disk.cpp
+  slave/containerizer/launcher.cpp
+  slave/containerizer/mesos/containerizer.cpp
+  slave/containerizer/mesos/launch.cpp
+  slave/containerizer/provisioner/paths.cpp
+  slave/containerizer/provisioner/provisioner.cpp
+  slave/containerizer/provisioner/store.cpp
+  slave/containerizer/provisioner/appc/paths.cpp
+  slave/containerizer/provisioner/appc/spec.cpp
+  slave/containerizer/provisioner/appc/store.cpp
+  slave/containerizer/provisioner/backend.cpp
+  slave/containerizer/provisioner/backends/copy.cpp
+  slave/containerizer/provisioner/docker/registry_client.cpp
+  slave/containerizer/provisioner/docker/token_manager.cpp
+  slave/resource_estimators/noop.cpp
+  )
+
+set(MESOS_SRC
+  ${MESOS_SRC}
+  ${AGENT_SRC}
+  ${MESOS_PROTOBUF_SRC}
+  )
+
+# INCLUDE DIRECTIVES FOR MESOS LIBRARY (generates, e.g., -I/path/to/thing
+# on Linux).
+#########################################################################
+include_directories(${AGENT_INCLUDE_DIRS})
+
+# THE MESOS LIBRARY (generates, e.g., libmesos.so, etc., on Linux).
+###################################################################
+add_library(${MESOS_TARGET} ${MESOS_SRC})
+set_target_properties(
+  ${MESOS_TARGET} PROPERTIES
+  VERSION ${MESOS_PACKAGE_VERSION}
+  SOVERSION ${MESOS_PACKAGE_SOVERSION}
+  )
+add_dependencies(${MESOS_TARGET} ${AGENT_DEPENDENCIES})

http://git-wip-us.apache.org/repos/asf/mesos/blob/d4a970e6/src/cmake/MesosProtobuf.cmake
----------------------------------------------------------------------
diff --git a/src/cmake/MesosProtobuf.cmake b/src/cmake/MesosProtobuf.cmake
new file mode 100644
index 0000000..d5e1e13
--- /dev/null
+++ b/src/cmake/MesosProtobuf.cmake
@@ -0,0 +1,102 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# PROTO_TO_INCLUDE_DIR is a convenience function that will: (1) compile .proto
+# files found in the Mesos public-facing `include/` directory, (2) place the
+# generated files in the build folder, but with an identical directory
+# structure, and (3) export variables holding the fully-qualified path to the
+# generated files, based on a name structure the user specifies with the
+# `BASE_NAME` and `BASE_DIR_STRUCTURE` parameters.
+#
+# For example, if suppose wish to compile `include/mesos/mesos.proto`. We might
+# pass in the following values for the parameters:
+#
+#   BASE_NAME:          MESOS       (i.e., basis for the exported var names)
+#   BASE_DIR_STRUCTURE: mesos/mesos (i.e., where `mesos/mesos.proto` would be
+#                                    the relative path to the .proto file, we'd
+#                                    use this "root name" to generate files
+#                                    like `mesos/mesos.pb.cc`
+#
+# In this case, this function would:
+#
+#   (1) compile the `include/mesos/mesos.proto`, which would generate the files
+#       `build/include/mesos/mesos.pb.h` and `build/include/mesos/mesos.pb.cc`
+#   (2) export the following variables, based on the `BASE_NAME` parameter
+#       (a) MESOS_PROTO:    ${MESOS_ROOT}/include/mesos/mesos.proto
+#       (b) MESOS_PROTO_CC: ${MESOS_ROOT}/build/include/mesos/mesos.pb.cc
+#       (a) MESOS_PROTO_H:   ${MESOS_ROOT}/build/include/mesos/mesos.pb.h
+function(PROTOC_TO_INCLUDE_DIR BASE_NAME BASE_DIR_STRUCTURE)
+
+  set(TO_INCLUDE_DIR
+    -I${MESOS_PUBLIC_INCLUDE_DIR}
+    -I${MESOS_SRC_DIR}
+    --cpp_out=${MESOS_BIN_INCLUDE_DIR})
+
+  # Names of variables we will be publicly exporting.
+  set(PROTO_VAR ${BASE_NAME}_PROTO)    # e.g., MESOS_PROTO
+  set(CC_VAR    ${BASE_NAME}_PROTO_CC) # e.g., MESOS_PROTO_CC
+  set(H_VAR     ${BASE_NAME}_PROTO_H)  # e.g., MESOS_PROTO_H
+
+  # Fully qualified paths for the input .proto files and the output C files.
+  set(PROTO ${MESOS_PUBLIC_INCLUDE_DIR}/${BASE_DIR_STRUCTURE}.proto)
+  set(CC    ${MESOS_BIN_INCLUDE_DIR}/${BASE_DIR_STRUCTURE}.pb.cc)
+  set(H     ${MESOS_BIN_INCLUDE_DIR}/${BASE_DIR_STRUCTURE}.pb.h)
+
+  # Export variables holding the target filenames.
+  set(${PROTO_VAR} ${PROTO} PARENT_SCOPE) # e.g., mesos/mesos.proto
+  set(${CC_VAR}    ${CC}    PARENT_SCOPE) # e.g., mesos/mesos.pb.cc
+  set(${H_VAR}     ${H}     PARENT_SCOPE) # e.g., mesos/mesos.pb.h
+
+  # Compile the .proto file.
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${CC} ${H}
+    COMMAND ${PROTOC} ${TO_INCLUDE_DIR} ${PROTO}
+    DEPENDS make_bin_include_dir
+    WORKING_DIRECTORY ${MESOS_BIN})
+endfunction()
+
+# PROTO_TO_SRC_DIR is similar to `PROTO_TO_INCLUDE_DIR`, except it acts on the
+# Mesos `src/` directory instead of the public-facing `include/` directory (see
+# documentation for `PROTO_TO_INCLUDE_DIR` for details).
+function(PROTOC_TO_SRC_DIR BASE_NAME BASE_DIR_STRUCTURE)
+
+  set(TO_SRC_DIR
+    -I${MESOS_PUBLIC_INCLUDE_DIR}
+    -I${MESOS_SRC_DIR}
+    --cpp_out=${MESOS_BIN_SRC_DIR})
+
+  # Names of variables we will be publicly exporting.
+  set(PROTO_VAR ${BASE_NAME}_PROTO)    # e.g., MESOS_PROTO
+  set(CC_VAR    ${BASE_NAME}_PROTO_CC) # e.g., MESOS_PROTO_CC
+  set(H_VAR     ${BASE_NAME}_PROTO_H)  # e.g., MESOS_PROTO_H
+
+  # Fully qualified paths for the input .proto files and the output C files.
+  set(PROTO ${MESOS_SRC_DIR}/${BASE_DIR_STRUCTURE}.proto)
+  set(CC    ${MESOS_BIN_SRC_DIR}/${BASE_DIR_STRUCTURE}.pb.cc)
+  set(H     ${MESOS_BIN_SRC_DIR}/${BASE_DIR_STRUCTURE}.pb.h)
+
+  # Export variables holding the target filenames.
+  set(${PROTO_VAR} ${PROTO} PARENT_SCOPE) # e.g., mesos/mesos.proto
+  set(${CC_VAR}    ${CC}    PARENT_SCOPE) # e.g., mesos/mesos.pb.cc
+  set(${H_VAR}     ${H}     PARENT_SCOPE) # e.g., mesos/mesos.pb.h
+
+  # Compile the .proto file.
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${CC} ${H}
+    COMMAND ${PROTOC} ${TO_SRC_DIR} ${PROTO}
+    DEPENDS make_bin_src_dir
+    WORKING_DIRECTORY ${MESOS_BIN})
+endfunction()

http://git-wip-us.apache.org/repos/asf/mesos/blob/d4a970e6/src/slave/cmake/SlaveConfigure.cmake
----------------------------------------------------------------------
diff --git a/src/slave/cmake/SlaveConfigure.cmake b/src/slave/cmake/SlaveConfigure.cmake
new file mode 100644
index 0000000..230e574
--- /dev/null
+++ b/src/slave/cmake/SlaveConfigure.cmake
@@ -0,0 +1,71 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Define process library dependencies. Tells the process library build targets
+# download/configure/build all third-party libraries before attempting to build.
+################################################################################
+set(AGENT_DEPENDENCIES
+  ${AGENT_DEPENDENCIES}
+  ${PROCESS_TARGET}
+  ${BOOST_TARGET}
+  ${GLOG_TARGET}
+  ${PICOJSON_TARGET}
+  ${ZOOKEEPER_TARGET}
+  make_bin_include_dir
+  make_bin_src_dir
+  )
+
+# Define third-party include directories. Tells compiler toolchain where to get
+# headers for our third party libs (e.g., -I/path/to/glog on Linux).
+###############################################################################
+set(AGENT_INCLUDE_DIRS
+  ${AGENT_INCLUDE_DIRS}
+  ${MESOS_PUBLIC_INCLUDE_DIR}
+  # Protobuf headers that depend on mesos.pb.h need this.
+  ${MESOS_PUBLIC_INCLUDE_DIR}/mesos
+  # Contains (e.g.) compiled *.pb.h files.
+  ${MESOS_BIN_INCLUDE_DIR}
+  ${MESOS_BIN_INCLUDE_DIR}/mesos
+  ${MESOS_BIN_SRC_DIR}
+  ${MESOS_SRC_DIR}
+
+  ${PROCESS_INCLUDE_DIR}
+  ${STOUT_INCLUDE_DIR}
+  ${BOOST_INCLUDE_DIR}
+  ${GLOG_INCLUDE_DIR}
+  ${PICOJSON_INCLUDE_DIR}
+  ${PROTOBUF_INCLUDE_DIR}
+  ${ZOOKEEPER_INCLUDE_DIR}
+  )
+
+# Define third-party lib install directories. Used to tell the compiler
+# toolchain where to find our third party libs (e.g., -L/path/to/glog on
+# Linux).
+########################################################################
+set(AGENT_LIB_DIRS
+  ${AGENT_LIB_DIRS}
+  ${PROCESS_LIB_DIRS}
+  ${GLOG_LIB_DIR}
+  ${ZOOKEEPER_LIB_DIR}
+  )
+
+# Define third-party libs. Used to generate flags that the linker uses to
+# include our third-party libs (e.g., -lglog on Linux).
+#########################################################################
+set(AGENT_LIBS
+  ${PROCESS_LIBS}
+  ${GLOG_LFLAG}
+  )


[15/20] mesos git commit: CMake: Updated MesosConfigure to use new process configure scripts.

Posted by jo...@apache.org.
CMake: Updated MesosConfigure to use new process configure scripts.

CMake: Transitioned Mesos to use new third-party build scripts.

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


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

Branch: refs/heads/master
Commit: 81f86c59c839988ea606bb6f0d1dfa22b45fbdf3
Parents: 685df82
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:31 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:20:13 2015 -0700

----------------------------------------------------------------------
 cmake/MesosConfigure.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/81f86c59/cmake/MesosConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/MesosConfigure.cmake b/cmake/MesosConfigure.cmake
index be14dc7..73df287 100755
--- a/cmake/MesosConfigure.cmake
+++ b/cmake/MesosConfigure.cmake
@@ -114,7 +114,7 @@ endif (WIN32)
 ############################
 # NOTE: The third-party configuration variables exported here are used
 # throughout the project, so it's important that this config script goes here.
-include(ProcessConfigure)
+include(Process3rdpartyConfigure)
 
 # Generate a batch script that will build Mesos. Any project referencing Mesos
 # can then build it by calling this script.


[18/20] mesos git commit: CMake: Moved compiler configuration logic to its own file.

Posted by jo...@apache.org.
CMake: Moved compiler configuration logic to its own file.

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


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

Branch: refs/heads/master
Commit: 96b25d8dc143b0a2f8d0ea0cb21dda8996493b66
Parents: a79ace3
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:35 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:23:32 2015 -0700

----------------------------------------------------------------------
 cmake/CompilationConfigure.cmake | 116 ++++++++++++++++++++++++++++++++++
 cmake/MesosConfigure.cmake       |  83 +-----------------------
 2 files changed, 119 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/96b25d8d/cmake/CompilationConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
new file mode 100644
index 0000000..98a08ee
--- /dev/null
+++ b/cmake/CompilationConfigure.cmake
@@ -0,0 +1,116 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# CONFIGURE COMPILATION.
+########################
+string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} "Linux" LINUX)
+
+if (_DEBUG)
+  set(CMAKE_BUILD_TYPE Debug)
+endif (_DEBUG)
+
+# Make sure C++ 11 features we need are supported. This is split into two
+# cases: Windows and "other platforms".
+#   * For "other platforms", we simply check if the C++11 flags work
+#   * For Windows, it looks like (1) C++11 is enabled by default on MSVC 1900 or
+#     later, and (2) C++11 is totally broken for 1800 or earlier (i.e., Mesos
+#     will not compile on MSVC pre-1900). So, when in Windows, we just check the
+#     MSVC version, and don't try to check or pass in C++11 flags at all.
+CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
+if (WIN32)
+  # Windows case first.
+
+  # 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.
+  if (NOT CMAKE_CXX_COMPILER_ID MATCHES MSVC)
+    message(
+      WARNING
+      "Mesos does not support compiling on Windows with "
+      "${CMAKE_CXX_COMPILER_ID}. Please use MSVC.")
+  endif (NOT CMAKE_CXX_COMPILER_ID MATCHES MSVC)
+
+  # MSVC 1900 supports C++11; earlier versions don't. So, warn if you try to
+  # use anything else.
+  if (${MSVC_VERSION} LESS 1900)
+    message(
+      WARNING
+      "Mesos does not support compiling on MSVC versions earlier than 1900. "
+      "Please use MSVC 1900 (included with Visual Studio 2015 or later).")
+  endif (${MSVC_VERSION} LESS 1900)
+
+  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
+  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
+elseif (COMPILER_SUPPORTS_CXX11)
+  # Finally, on non-Windows platforms, we must check that the current compiler
+  # supports C++11.
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+else (WIN32)
+  message(
+    FATAL_ERROR
+    "The compiler ${CMAKE_CXX_COMPILER} does not support the `-std=c++11` "
+    "flag. Please use a different C++ compiler.")
+endif (WIN32)
+
+# Convenience flags to simplify Windows support in C++ source.
+if (MSVC)
+  add_definitions(-DMESOS_MSVC)
+endif (MSVC)
+
+# Configure directory structure for different platforms.
+########################################################
+if (NOT WIN32)
+  set(EXEC_INSTALL_PREFIX  ${CMAKE_INSTALL_PREFIX})
+  set(SHARE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/share)
+  set(DATA_INSTALL_PREFIX  ${SHARE_INSTALL_PREFIX}/mesos)
+
+  set(LIBEXEC_INSTALL_DIR     ${EXEC_INSTALL_PREFIX}/libexec)
+  set(PKG_LIBEXEC_INSTALL_DIR ${LIBEXEC_INSTALL_DIR}/mesos)
+  set(LIB_INSTALL_DIR         ${EXEC_INSTALL_PREFIX}/libmesos)
+else (NOT WIN32)
+  set(EXEC_INSTALL_PREFIX     "WARNINGDONOTUSEME")
+  set(LIBEXEC_INSTALL_DIR     "WARNINGDONOTUSEME")
+  set(PKG_LIBEXEC_INSTALL_DIR "WARNINGDONOTUSEME")
+  set(LIB_INSTALL_DIR         "WARNINGDONOTUSEME")
+endif (NOT WIN32)
+
+# Add preprocessor definitions required to build third-party libraries.
+#######################################################################
+if (WIN32)
+  # Windows-specific workaround for a glog issue documented here[1].
+  # Basically, Windows.h and glog/logging.h both define ERROR. Since we don't
+  # need the Windows ERROR, we can use this flag to avoid defining it at all.
+  # Unlike the other fix (defining GLOG_NO_ABBREVIATED_SEVERITIES), this fix
+  # is guaranteed to require no changes to the original Mesos code. See also
+  # the note in the code itself[2].
+  #
+  # [1] https://google-glog.googlecode.com/svn/trunk/doc/glog.html#windows
+  # [2] https://code.google.com/p/google-glog/source/browse/trunk/src/windows/glog/logging.h?r=113
+  add_definitions(-DNOGDI)
+  add_definitions(-DNOMINMAX)
+endif (WIN32)
+
+# Enable the INT64 support for PicoJSON.
+add_definitions(-DPICOJSON_USE_INT64)
+# NOTE: PicoJson requires __STDC_FORMAT_MACROS to be defined before importing
+# 'inttypes.h'.  Since other libraries may also import this header, it must
+# be globally defined so that PicoJson has access to the macros, regardless
+# of the order of inclusion.
+add_definitions(-D__STDC_FORMAT_MACROS)
+
+add_definitions(-DPKGLIBEXECDIR="${PKG_LIBEXEC_INSTALL_DIR}")
+add_definitions(-DLIBDIR="${LIB_INSTALL_DIR}")
+add_definitions(-DVERSION="${PACKAGE_VERSION}")

http://git-wip-us.apache.org/repos/asf/mesos/blob/96b25d8d/cmake/MesosConfigure.cmake
----------------------------------------------------------------------
diff --git a/cmake/MesosConfigure.cmake b/cmake/MesosConfigure.cmake
index 1fff02e..2f4c412 100755
--- a/cmake/MesosConfigure.cmake
+++ b/cmake/MesosConfigure.cmake
@@ -39,76 +39,9 @@ message(STATUS "************************************************************")
 ################################
 enable_testing()
 
-# CONFIGURE COMPILATION.
-########################
-string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} "Linux" LINUX)
-
-if (_DEBUG)
-  set(CMAKE_BUILD_TYPE Debug)
-endif (_DEBUG)
-
-# Make sure C++ 11 features we need are supported. This is split into two
-# cases: Windows and "other platforms".
-#   * For "other platforms", we simply check if the C++11 flags work
-#   * For Windows, it looks like (1) C++11 is enabled by default on MSVC 1900 or
-#     later, and (2) C++11 is totally broken for 1800 or earlier (i.e., Mesos
-#     will not compile on MSVC pre-1900). So, when in Windows, we just check the
-#     MSVC version, and don't try to check or pass in C++11 flags at all.
-CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
-if (WIN32)
-  # Windows case first.
-
-  # 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.
-  if (NOT CMAKE_CXX_COMPILER_ID MATCHES MSVC)
-    message(
-      WARNING
-      "Mesos does not support compiling on Windows with "
-      "${CMAKE_CXX_COMPILER_ID}. Please use MSVC.")
-  endif (NOT CMAKE_CXX_COMPILER_ID MATCHES MSVC)
-
-  # MSVC 1900 supports C++11; earliser versions don't. So, warn if you try to
-  # use anything else.
-  if (${MSVC_VERSION} LESS 1900)
-    message(
-      WARNING
-      "Mesos does not support compiling on MSVC versions earlier than 1900. "
-      "Please use MSVC 1900 (included with Visual Studio 2015 or later).")
-  endif (${MSVC_VERSION} LESS 1900)
-
-  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
-  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
-elseif (COMPILER_SUPPORTS_CXX11)
-  # Finally, on non-Windows platforms, we must check that the current compiler
-  # supports C++11.
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-else (WIN32)
-  message(
-    FATAL_ERROR
-    "The compiler ${CMAKE_CXX_COMPILER} does not support the `-std=c++11` "
-    "flag. Please use a different C++ compiler.")
-endif (WIN32)
-
-# Convenience flags to simplify Windows support in C++ source.
-if (MSVC)
-  add_definitions(-DMESOS_MSVC)
-endif (MSVC)
-
-# Compiler constants required for third-party libs.
-if (WIN32)
-  # Windows-specific workaround for a glog issue documented here[1].
-  # Basically, Windows.h and glog/logging.h both define ERROR. Since we don't
-  # need the Windows ERROR, we can use this flag to avoid defining it at all.
-  # Unlike the other fix (defining GLOG_NO_ABBREVIATED_SEVERITIES), this fix
-  # is guaranteed to require no changes to the original Mesos code. See also
-  # the note in the code itself[2].
-  #
-  # [1] https://google-glog.googlecode.com/svn/trunk/doc/glog.html#windows
-  # [2] https://code.google.com/p/google-glog/source/browse/trunk/src/windows/glog/logging.h?r=113
-  add_definitions(-DNOGDI)
-  add_definitions(-DNOMINMAX)
-endif (WIN32)
+# CONFIGURE COMPILER.
+#####################
+include(CompilationConfigure)
 
 # THIRD-PARTY CONFIGURATION.
 ############################
@@ -129,13 +62,3 @@ if (WIN32)
   string(REPLACE ";" " " MESOS_BUILD_CMD "${MESOS_BUILD_CMD}")
   file(WRITE ${CMAKE_BINARY_DIR}/make.bat ${MESOS_BUILD_CMD})
 endif (WIN32)
-
-# Add preprocessor definitions required to build third-party libraries.
-#######################################################################
-# Enable the INT64 support for PicoJSON.
-add_definitions(-DPICOJSON_USE_INT64)
-# NOTE: PicoJson requires __STDC_FORMAT_MACROS to be defined before importing
-# 'inttypes.h'.  Since other libraries may also import this header, it must
-# be globally defined so that PicoJson has access to the macros, regardless
-# of the order of inclusion.
-add_definitions(-D__STDC_FORMAT_MACROS)


[04/20] mesos git commit: CMake: Updated CMake config to build Mesos against picojson v1.3.0.

Posted by jo...@apache.org.
CMake: Updated CMake config to build Mesos against picojson v1.3.0.

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


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

Branch: refs/heads/master
Commit: 3396a8e7919f4d2f44e3bef30e9838cc30ff9b4f
Parents: a051fde
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:17 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:04:14 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/cmake/ProcessConfigure.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/3396a8e7/3rdparty/libprocess/cmake/ProcessConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessConfigure.cmake b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
index a5f8d39..a956054 100755
--- a/3rdparty/libprocess/cmake/ProcessConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
@@ -52,7 +52,7 @@ set(PROCESS_3RD_BIN ${CMAKE_BINARY_DIR}/3rdparty/libprocess/3rdparty)
 set(STOUT ${PROCESS_3RD_SRC}/stout)
 
 EXTERNAL("boost"       "1.53.0"  "${PROCESS_3RD_BIN}")
-EXTERNAL("picojson"    "4f93734" "${PROCESS_3RD_BIN}")
+EXTERNAL("picojson"    "1.3.0"   "${PROCESS_3RD_BIN}")
 EXTERNAL("http_parser" "1c3624a" "${PROCESS_3RD_BIN}")
 EXTERNAL("libev"       "4.15"    "${PROCESS_3RD_BIN}")
 


[02/20] mesos git commit: CMake: Only compile proc_tests.cpp for Linux platforms.

Posted by jo...@apache.org.
CMake: Only compile proc_tests.cpp for Linux platforms.

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


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

Branch: refs/heads/master
Commit: 1eb0519eb1ffefb388e9ecad36e4b24413febcb8
Parents: c98b33e
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:14 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:02:43 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/1eb0519e/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt b/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt
index baa648a..94292f8 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt
+++ b/3rdparty/libprocess/3rdparty/stout/tests/CMakeLists.txt
@@ -55,7 +55,6 @@ if (NOT WIN32)
     mac_tests.cpp
     os_tests.cpp
     path_tests.cpp
-    proc_tests.cpp
     protobuf_tests.cpp
     protobuf_tests.pb.cc
     recordio_tests.cpp
@@ -67,6 +66,10 @@ if (NOT WIN32)
     )
 endif (NOT WIN32)
 
+if (LINUX)
+  set(STOUT_TESTS_SRC ${STOUT_TESTS_SRC} proc_tests.cpp)
+endif (LINUX)
+
 # INCLUDE DIRECTIVES FOR STOUT TEST BINARY (generates, e.g., -I/path/to/thing
 # on Linux).
 #############################################################################


[16/20] mesos git commit: CMake: Transitioned Stout tests to use new third-party build scripts.

Posted by jo...@apache.org.
CMake: Transitioned Stout tests to use new third-party build scripts.

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


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

Branch: refs/heads/master
Commit: 09f9b5379022fccd5db50ba5ade1ec96882a1fc0
Parents: 81f86c5
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:32 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:21:19 2015 -0700

----------------------------------------------------------------------
 .../stout/cmake/StoutTestsConfigure.cmake       | 74 +++++---------------
 1 file changed, 19 insertions(+), 55 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/09f9b537/3rdparty/libprocess/3rdparty/stout/cmake/StoutTestsConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/cmake/StoutTestsConfigure.cmake b/3rdparty/libprocess/3rdparty/stout/cmake/StoutTestsConfigure.cmake
index 0832529..c4d1b7b 100644
--- a/3rdparty/libprocess/3rdparty/stout/cmake/StoutTestsConfigure.cmake
+++ b/3rdparty/libprocess/3rdparty/stout/cmake/StoutTestsConfigure.cmake
@@ -55,39 +55,28 @@ set(STOUT_TEST_DEPENDENCIES
   )
 
 if (WIN32)
-  set(STOUT_TEST_DEPENDENCIES
-    ${STOUT_TEST_DEPENDENCIES}
-    ${CURL_TARGET}
-  )
-endif(WIN32)
+  set(STOUT_TEST_DEPENDENCIES ${STOUT_TEST_DEPENDENCIES} ${CURL_TARGET})
+endif (WIN32)
 
 # DEFINE THIRD-PARTY INCLUDE DIRECTORIES. Tells compiler toolchain where to get
 # headers for our third party libs (e.g., -I/path/to/glog on Linux)..
 ###############################################################################
 set(STOUT_TEST_INCLUDE_DIRS
   ${STOUT_TEST_INCLUDE_DIRS}
-  ${STOUT}/include
-  ${BOOST_ROOT}
-  ${PICOJSON_ROOT}
+  ${STOUT_INCLUDE_DIR}
+  ${BOOST_INCLUDE_DIR}
+  ${PICOJSON_INCLUDE_DIR}
   ${APR_INCLUDE_DIR}
   ${SVN_INCLUDE_DIR}
-  ${GMOCK_ROOT}/include
-  ${GTEST_SRC}/include
-  ${PROTOBUF_LIB}/include
+  ${GMOCK_INCLUDE_DIR}
+  ${GTEST_INCLUDE_DIR}
+  ${PROTOBUF_INCLUDE_DIR}
   src
+  ${GLOG_INCLUDE_DIR}
   )
 
 if (WIN32)
-  set(STOUT_TEST_INCLUDE_DIRS
-    ${STOUT_TEST_INCLUDE_DIRS}
-    ${GLOG_ROOT}/src/windows
-    ${CURL_ROOT}/include
-    )
-else (WIN32)
-  set(STOUT_TEST_INCLUDE_DIRS
-    ${STOUT_TEST_INCLUDE_DIRS}
-    ${GLOG_LIB}/include
-    )
+  set(STOUT_TEST_INCLUDE_DIRS ${STOUT_TEST_INCLUDE_DIRS} ${CURL_INCLUDE_DIR})
 endif (WIN32)
 
 # DEFINE THIRD-PARTY LIB INSTALL DIRECTORIES. Used to tell the compiler
@@ -98,29 +87,14 @@ set(STOUT_TEST_LIB_DIRS
   ${STOUT_TEST_LIB_DIRS}
   ${APR_LIBS}
   ${SVN_LIBS}
-  ${GMOCK_ROOT}-build/lib/.libs
+  ${GMOCK_LIB_DIR}
   ${GMOCK_ROOT}-build/gtest/lib/.libs
+  ${GLOG_LIB_DIR}
+  ${PROTOBUF_LIB_DIR}
   )
 
 if (WIN32)
-  # TODO(hausdorff): currently these dependencies have to be built out-of-band
-  # by opening Visual Studio, building the project, and then building Mesos. We
-  # should write batch scripts that will build these dependencies from the
-  # command line. (This is one reason why we're linking to the Debug/ folders,
-  # which is not a good idea for release builds anyway.)
-  set(STOUT_TEST_LIB_DIRS
-    ${STOUT_TEST_LIB_DIRS}
-    ${GLOG_ROOT}/Debug
-    ${GMOCK_ROOT}/msvc/2010/Debug
-    ${PROTOBUF_ROOT}/vsprojects/Debug
-    ${CURL_ROOT}/lib
-    )
-else (WIN32)
-  set(STOUT_TEST_LIB_DIRS
-    ${STOUT_TEST_LIB_DIRS}
-    ${GLOG_LIB}/lib
-    ${PROTOBUF_LIB}/lib
-    )
+  set(STOUT_TEST_LIB_DIRS ${STOUT_TEST_LIB_DIRS} ${CURL_LIB_DIR})
 endif (WIN32)
 
 # DEFINE THIRD-PARTY LIBS. Used to generate flags that the linker uses to
@@ -129,28 +103,18 @@ endif (WIN32)
 set(STOUT_TEST_LIBS
   ${STOUT_TEST_LIBS}
   ${CMAKE_THREAD_LIBS_INIT}
-  gmock
+  ${GMOCK_LFLAG}
   ${SVN_LIBS}
+  ${GLOG_LFLAG}
+  ${PROTOBUF_LFLAG}
   )
 
 if (WIN32)
-  # Necessary because the lib names for glog and protobuf are generated
-  # incorrectly on Windows. That is, on *nix, the glog binary should be (e.g.)
-  # libglog.so, and on Windows it should be glog.lib. But on Windows, it's
-  # actually libglog.lib. Hence, we have to special case it here because CMake
-  # assumes the library names are generated correctly.
-  set(STOUT_TEST_LIBS
-    ${STOUT_TEST_LIBS}
-    libglog
-    libprotobuf
-    libcurl_a
-    )
+  set(STOUT_TEST_LIBS ${STOUT_TEST_LIBS} ${CURL_LFLAG})
 else (WIN32)
   set(STOUT_TEST_LIBS
     ${STOUT_TEST_LIBS}
-    glog
-    gtest
-    protobuf
+    ${GTEST_LFLAG}
     dl
     apr-1
     )


[10/20] mesos git commit: CMake: Added libevent version, configured Windows to use as default.

Posted by jo...@apache.org.
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 <cl...@gmail.com>
Authored: Sun Sep 27 15:41:24 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
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)


[14/20] mesos git commit: CMake: Pulled third-party configuration logic into its own .cmake file.

Posted by jo...@apache.org.
CMake: Pulled third-party configuration logic into its own .cmake file.

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


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

Branch: refs/heads/master
Commit: 685df82d54814a1a004e695802d0c3d6fefbdd77
Parents: 868e787
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:30 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:17:39 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/CMakeLists.txt     |   2 +-
 .../cmake/Process3rdpartyConfigure.cmake        | 103 +++++++++++++++++++
 .../libprocess/cmake/ProcessConfigure.cmake     |  77 +++-----------
 .../cmake/ProcessTestsConfigure.cmake           |  35 +++++--
 4 files changed, 144 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/685df82d/3rdparty/libprocess/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/CMakeLists.txt b/3rdparty/libprocess/3rdparty/CMakeLists.txt
index d77f357..c85586b 100644
--- a/3rdparty/libprocess/3rdparty/CMakeLists.txt
+++ b/3rdparty/libprocess/3rdparty/CMakeLists.txt
@@ -90,7 +90,7 @@ endif (WIN32)
 # build directory into `configure` as a prefix; so if we're going to move the
 # libraries, we might as well move them to a library folder.)
 if (NOT WIN32)
-  set(GLOG_CONFIG_CMD  ${GLOG_ROOT}/src/../configure --prefix=${GLOG_LIB})
+  set(GLOG_CONFIG_CMD  ${GLOG_ROOT}/src/../configure --prefix=${GLOG_LIB_ROOT})
   set(GLOG_BUILD_CMD   make)
   set(GLOG_INSTALL_CMD make install)
   # Patch glog to deal with a problem that appears when compiling on clang

http://git-wip-us.apache.org/repos/asf/mesos/blob/685df82d/3rdparty/libprocess/cmake/Process3rdpartyConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/Process3rdpartyConfigure.cmake b/3rdparty/libprocess/cmake/Process3rdpartyConfigure.cmake
new file mode 100644
index 0000000..9c369e2
--- /dev/null
+++ b/3rdparty/libprocess/cmake/Process3rdpartyConfigure.cmake
@@ -0,0 +1,103 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# DEFINE DIRECTORY STRUCTURE FOR THIRD-PARTY LIBS.
+##################################################
+set(PROCESS_3RD_SRC ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/3rdparty)
+set(PROCESS_3RD_BIN ${CMAKE_BINARY_DIR}/3rdparty/libprocess/3rdparty)
+
+set(STOUT ${PROCESS_3RD_SRC}/stout)
+
+EXTERNAL("boost"       ${BOOST_VERSION}       "${PROCESS_3RD_BIN}")
+EXTERNAL("picojson"    ${PICOJSON_VERSION}    "${PROCESS_3RD_BIN}")
+EXTERNAL("http_parser" ${HTTP_PARSER_VERSION} "${PROCESS_3RD_BIN}")
+EXTERNAL("libev"       ${LIBEV_VERSION}       "${PROCESS_3RD_BIN}")
+EXTERNAL("libevent"    ${LIBEVENT_VERSION}    "${PROCESS_3RD_BIN}")
+EXTERNAL("libapr"      ${LIBAPR_VERSION}      "${PROCESS_3RD_BIN}")
+EXTERNAL("protobuf"    ${PROTOBUF_VERSION}    "${PROCESS_3RD_BIN}")
+
+if (NOT WIN32)
+  EXTERNAL("glog" ${GLOG_VERSION} "${PROCESS_3RD_BIN}")
+elseif (WIN32)
+  # Glog 0.3.3 does not compile out of the box on Windows. Therefore, we
+  # require 0.3.4.
+  EXTERNAL("glog" "0.3.4" "${PROCESS_3RD_BIN}")
+
+  # NOTE: We expect cURL exists on Unix (usually pulled in with a package
+  # manager), but Windows has no package manager, so we have to go get it.
+  EXTERNAL("curl" ${CURL_VERSION} "${PROCESS_3RD_BIN}")
+endif (NOT WIN32)
+
+# Intermediate convenience variables for oddly-structured directories.
+set(GLOG_LIB_ROOT ${GLOG_ROOT}-lib/lib)
+set(PROTOBUF_LIB  ${PROTOBUF_ROOT}-lib/lib)
+
+# Convenience variables for include directories of third-party dependencies.
+set(PROCESS_INCLUDE_DIR     ${PROCESS_3RD_SRC}/../include)
+set(STOUT_INCLUDE_DIR       ${STOUT}/include)
+
+set(BOOST_INCLUDE_DIR       ${BOOST_ROOT})
+set(GPERFTOOLS_INCLUDE_DIR  ${GPERFTOOLS}/src)
+set(HTTP_PARSER_INCLUDE_DIR ${HTTP_PARSER_ROOT})
+set(LIBEV_INCLUDE_DIR       ${LIBEV_ROOT})
+set(PICOJSON_INCLUDE_DIR    ${PICOJSON_ROOT})
+set(PROTOBUF_INCLUDE_DIR    ${PROTOBUF_LIB}/include)
+
+if (WIN32)
+  set(CURL_INCLUDE_DIR ${CURL_ROOT}/include)
+  set(GLOG_INCLUDE_DIR ${GLOG_ROOT}/src/windows)
+else (WIN32)
+  set(GLOG_INCLUDE_DIR ${GLOG_LIB_ROOT}/include)
+endif (WIN32)
+
+# Convenience variables for `lib` directories of built third-party dependencies.
+set(HTTP_PARSER_LIB_DIR ${HTTP_PARSER_ROOT}-build)
+set(LIBEV_LIB_DIR       ${LIBEV_ROOT}-build/.libs)
+
+if (WIN32)
+  set(CURL_LIB_DIR     ${CURL_ROOT}/lib)
+  set(GLOG_LIB_DIR     ${GLOG_ROOT}/Debug)
+  set(PROTOBUF_LIB_DIR ${PROTOBUF_ROOT}/vsprojects/Debug)
+else (WIN32)
+  set(GLOG_LIB_DIR     ${GLOG_LIB_ROOT}/lib)
+  set(PROTOBUF_LIB_DIR ${PROTOBUF_LIB}/lib)
+endif (WIN32)
+
+# Convenience variables for "lflags", the symbols we pass to CMake to generate
+# things like `-L/path/to/glog` or `-lglog`.
+set(HTTP_PARSER_LFLAG http_parser)
+set(LIBEV_LFLAG       ev)
+
+if (WIN32)
+  # Necessary because the lib names for (e.g.) glog are generated incorrectly
+  # on Windows. That is, on *nix, the glog binary should be (e.g.) libglog.so,
+  # and on Windows it should be glog.lib. But on Windows, it's actually
+  # libglog.lib. Hence, we have to special case it here because CMake assumes
+  # the library names are generated correctly.
+  set(CURL_LFLAG     libcurl_a)
+  set(GLOG_LFLAG     libglog)
+  set(PROTOBUF_LFLAG libprotobuf)
+else (WIN32)
+  set(GLOG_LFLAG     glog)
+  set(PROTOBUF_LFLAG protobuf)
+endif (WIN32)
+
+# Convenience variable for `protoc`, the Protobuf compiler.
+set(PROTOC ${PROTOBUF_LIB}/bin/protoc)
+
+# Configure the process library, the last of our third-party libraries.
+#######################################################################
+include(ProcessConfigure)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/mesos/blob/685df82d/3rdparty/libprocess/cmake/ProcessConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessConfigure.cmake b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
index a5dea3a..076c883 100755
--- a/3rdparty/libprocess/cmake/ProcessConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
@@ -44,36 +44,6 @@ set(PROCESS_PACKAGE_VERSION 0.0.1)
 set(PROCESS_PACKAGE_SOVERSION 0)
 set(PROCESS_TARGET process-${PROCESS_PACKAGE_VERSION})
 
-# DEFINE DIRECTORY STRUCTURE FOR THIRD-PARTY LIBS.
-##################################################
-set(PROCESS_3RD_SRC ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/3rdparty)
-set(PROCESS_3RD_BIN ${CMAKE_BINARY_DIR}/3rdparty/libprocess/3rdparty)
-
-set(STOUT ${PROCESS_3RD_SRC}/stout)
-
-EXTERNAL("boost"       ${BOOST_VERSION}       "${PROCESS_3RD_BIN}")
-EXTERNAL("picojson"    ${PICOJSON_VERSION}    "${PROCESS_3RD_BIN}")
-EXTERNAL("http_parser" ${HTTP_PARSER_VERSION} "${PROCESS_3RD_BIN}")
-EXTERNAL("libev"       ${LIBEV_VERSION}       "${PROCESS_3RD_BIN}")
-EXTERNAL("libevent"    ${LIBEVENT_VERSION}    "${PROCESS_3RD_BIN}")
-EXTERNAL("libapr"      ${LIBAPR_VERSION}      "${PROCESS_3RD_BIN}")
-
-if (NOT WIN32)
-  EXTERNAL("glog" ${GLOG_VERSION} "${PROCESS_3RD_BIN}")
-elseif (WIN32)
-  # Glog 0.3.3 does not compile out of the box on Windows. Therefore, we
-  # require 0.3.4.
-  EXTERNAL("glog" "0.3.4" "${PROCESS_3RD_BIN}")
-endif (NOT WIN32)
-
-set(GLOG_LIB ${GLOG_ROOT}-lib/lib)
-
-# Directory structure for windows-only third-party libs.
-########################################################
-if (WIN32)
-  EXTERNAL("curl" ${CURL_VERSION} "${PROCESS_3RD_BIN}")
-endif (WIN32)
-
 # Define process library dependencies. Tells the process library build targets
 # download/configure/build all third-party libraries before attempting to build.
 ################################################################################
@@ -84,6 +54,7 @@ set(PROCESS_DEPENDENCIES
   ${PICOJSON_TARGET}
   ${HTTP_PARSER_TARGET}
   ${LIBEV_TARGET}
+  ${PROTOBUF_TARGET}
   )
 
 # Define third-party include directories. Tells compiler toolchain where to get
@@ -91,35 +62,17 @@ set(PROCESS_DEPENDENCIES
 ###############################################################################
 set(PROCESS_INCLUDE_DIRS
   ${PROCESS_INCLUDE_DIRS}
-  ${PROCESS_3RD_SRC}/../include
-  ${STOUT}/include
-  ${BOOST_ROOT}
-  ${LIBEV_ROOT}
-  ${PICOJSON_ROOT}
-  )
-
-if (WIN32)
-  set(PROCESS_INCLUDE_DIRS
-    ${PROCESS_INCLUDE_DIRS}
-    ${GLOG_ROOT}/src/windows
-    )
-else (WIN32)
-  set(PROCESS_INCLUDE_DIRS
-    ${PROCESS_INCLUDE_DIRS}
-    ${GLOG_LIB}/include
-    )
-endif (WIN32)
-
-set(PROCESS_INCLUDE_DIRS
-  ${PROCESS_INCLUDE_DIRS}
-  ${HTTP_PARSER_ROOT}
+  ${PROCESS_INCLUDE_DIR}
+  ${STOUT_INCLUDE_DIR}
+  ${BOOST_INCLUDE_DIR}
+  ${LIBEV_INCLUDE_DIR}
+  ${PICOJSON_INCLUDE_DIR}
+  ${GLOG_INCLUDE_DIR}
+  ${HTTP_PARSER_INCLUDE_DIR}
   )
 
 if (HAS_GPERFTOOLS)
-  set(PROCESS_INCLUDE_DIRS
-    ${PROCESS_INCLUDE_DIRS}
-    ${GPERFTOOLS}/src
-    )
+  set(PROCESS_INCLUDE_DIRS ${PROCESS_INCLUDE_DIRS} ${GPERFTOOLS_INCLUDE_DIR})
 endif (HAS_GPERFTOOLS)
 
 # Define third-party lib install directories. Used to tell the compiler
@@ -128,9 +81,9 @@ endif (HAS_GPERFTOOLS)
 ########################################################################
 set(PROCESS_LIB_DIRS
   ${PROCESS_LIB_DIRS}
-  ${GLOG_LIB}/lib
-  ${LIBEV_ROOT}-build/.libs
-  ${HTTP_PARSER_ROOT}-build
+  ${GLOG_LIB_DIR}
+  ${LIBEV_LIB_DIR}
+  ${HTTP_PARSER_LIB_DIR}
   )
 
 # Define third-party libs. Used to generate flags that the linker uses to
@@ -141,9 +94,9 @@ find_package(Threads REQUIRED)
 set(PROCESS_LIBS
   ${PROCESS_LIBS}
   ${PROCESS_TARGET}
-  glog
-  ev
-  http_parser
+  ${GLOG_LFLAG}
+  ${LIBEV_LFLAG}
+  ${HTTP_PARSER_LFLAG}
   ${CMAKE_THREAD_LIBS_INIT}
   )
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/685df82d/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
index e105bd8..99496f2 100644
--- a/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
@@ -33,13 +33,29 @@
 
 # DIRECTORY STRUCTURE FOR THIRD-PARTY LIBS REQUIRED FOR TEST INFRASTRUCTURE.
 ############################################################################
-EXTERNAL("gmock"    ${GMOCK_VERSION}    "${PROCESS_3RD_BIN}")
-EXTERNAL("protobuf" ${PROTOBUF_VERSION} "${PROCESS_3RD_BIN}")
+EXTERNAL("gmock" ${GMOCK_VERSION} "${PROCESS_3RD_BIN}")
 
 set(GTEST_SRC          ${GMOCK_ROOT}/gtest)
 set(GPERFTOOLS_VERSION 2.0)
 set(GPERFTOOLS         ${PROCESS_3RD_BIN}/gperftools-${GPERFTOOLS_VERSION})
-set(PROTOBUF_LIB       ${PROTOBUF_ROOT}-lib/lib)
+
+# Convenience variables for include directories of third-party dependencies.
+set(GMOCK_INCLUDE_DIR ${GMOCK_ROOT}/include)
+set(GTEST_INCLUDE_DIR ${GTEST_SRC}/include)
+
+# Convenience variables for `lib` directories of built third-party dependencies.
+set(GTEST_LIB_DIR ${GMOCK_ROOT}-build/gtest/lib/.libs)
+
+if (WIN32)
+  set(GMOCK_LIB_DIR    ${GMOCK_ROOT}/msvc/2010/Debug)
+else (WIN32)
+  set(GMOCK_LIB_DIR    ${GMOCK_ROOT}-build/lib/.libs)
+endif (WIN32)
+
+# Convenience variables for "lflags", the symbols we pass to CMake to generate
+# things like `-L/path/to/glog` or `-lglog`.
+set(GMOCK_LFLAG gmock)
+set(GTEST_LFLAG gtest)
 
 # COMPILER CONFIGURATION.
 #########################
@@ -55,7 +71,6 @@ endif (APPLE)
 set(PROCESS_TEST_DEPENDENCIES
   ${PROCESS_TEST_DEPENDENCIES}
   ${PROCESS_DEPENDENCIES}
-  ${PROTOBUF_TARGET}
   ${GMOCK_TARGET}
   )
 
@@ -66,8 +81,8 @@ set(PROCESS_TEST_INCLUDE_DIRS
   ${PROCESS_TEST_INCLUDE_DIRS}
   ../   # includes, e.g., decoder.hpp
   ${PROCESS_INCLUDE_DIRS}
-  ${GMOCK_ROOT}/include
-  ${GTEST_SRC}/include
+  ${GMOCK_INCLUDE_DIR}
+  ${GTEST_INCLUDE_DIR}
   src
   )
 
@@ -78,8 +93,8 @@ set(PROCESS_TEST_INCLUDE_DIRS
 set(PROCESS_TEST_LIB_DIRS
   ${PROCESS_TEST_LIB_DIRS}
   ${PROCESS_LIB_DIRS}
-  ${GMOCK_ROOT}-build/lib/.libs
-  ${GMOCK_ROOT}-build/gtest/lib/.libs
+  ${GMOCK_LIB_DIR}
+  ${GTEST_LIB_DIR}
   )
 
 # DEFINE THIRD-PARTY LIBS. Used to generate flags that the linker uses to
@@ -88,6 +103,6 @@ set(PROCESS_TEST_LIB_DIRS
 set(PROCESS_TEST_LIBS
   ${PROCESS_TEST_LIBS}
   ${PROCESS_LIBS}
-  gmock
-  gtest
+  ${GMOCK_LFLAG}
+  ${GTEST_LFLAG}
   )


[13/20] mesos git commit: CMake: Added Windows-specific build targets for APR.

Posted by jo...@apache.org.
CMake: Added Windows-specific build targets for APR.

APR is required for Mesos to run. Normally we expect that a user has
obtained APR with their favorite package manager, but on Windows, we
cannot really expect that this is the case. So, we have to rope in the
dependency manually in the CMake build system.

This commit will introduce the necessary build targets to obtain,
configure, build, and install APR for Windows builds. It will ignore APR
and assume it's there for Linux builds.

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


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

Branch: refs/heads/master
Commit: 868e7878741a1063ee068bf7d7b6a0d668508c32
Parents: 9f4d76c
Author: Alex Clemmer <cl...@gmail.com>
Authored: Sun Sep 27 15:41:28 2015 -0700
Committer: Joris Van Remoortere <jo...@gmail.com>
Committed: Sun Sep 27 16:16:49 2015 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/CMakeLists.txt      | 12 ++++++++++++
 3rdparty/libprocess/cmake/ProcessConfigure.cmake |  1 +
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/868e7878/3rdparty/libprocess/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/CMakeLists.txt b/3rdparty/libprocess/3rdparty/CMakeLists.txt
index 0963222..d77f357 100644
--- a/3rdparty/libprocess/3rdparty/CMakeLists.txt
+++ b/3rdparty/libprocess/3rdparty/CMakeLists.txt
@@ -64,6 +64,7 @@ if (WIN32)
   # [1] https://github.com/google/glog/pull/43
   set(GLOG_URL     https://github.com/hausdorff/glog/tarball/glog-${GLOG_VERSION}-msvc1900)
   set(CURL_URL     ${UPSTREAM_URL}/curl-static-${CURL_VERSION}.tar.gz)
+  set(LIBAPR_URL   ${UPSTREAM_URL}/libapr-${LIBAPR_VERSION}.tar.gz)
 endif (WIN32)
 
 # Define build/patch/configure commands for third-party libs.
@@ -120,6 +121,8 @@ elseif (WIN32)
   set(RY_INSTALL_CMD ${CMAKE_NOOP})
 
   set(LIBEVENT_INSTALL_CMD ${CMAKE_NOOP})
+
+  set(LIBAPR_INSTALL_CMD ${CMAKE_NOOP})
 endif (NOT WIN32)
 
 # Third-party libraries. Tell the build system how to pull in and build third-
@@ -183,6 +186,15 @@ elseif (ENABLE_LIBEVENT)
     )
 endif (NOT ENABLE_LIBEVENT)
 
+if (WIN32)
+  ExternalProject_Add(
+    ${LIBAPR_TARGET}
+    PREFIX          ${LIBAPR_CMAKE_ROOT}
+    INSTALL_COMMAND ${LIBAPR_INSTALL_CMD}
+    URL             ${LIBAPR_URL}
+    )
+endif (WIN32)
+
 # WINDOWS THIRD-PARTY LIBRARIES. Windows has no package manager, so we download
 # them here.
 ###############################################################################

http://git-wip-us.apache.org/repos/asf/mesos/blob/868e7878/3rdparty/libprocess/cmake/ProcessConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessConfigure.cmake b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
index 1467c97..a5dea3a 100755
--- a/3rdparty/libprocess/cmake/ProcessConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
@@ -56,6 +56,7 @@ EXTERNAL("picojson"    ${PICOJSON_VERSION}    "${PROCESS_3RD_BIN}")
 EXTERNAL("http_parser" ${HTTP_PARSER_VERSION} "${PROCESS_3RD_BIN}")
 EXTERNAL("libev"       ${LIBEV_VERSION}       "${PROCESS_3RD_BIN}")
 EXTERNAL("libevent"    ${LIBEVENT_VERSION}    "${PROCESS_3RD_BIN}")
+EXTERNAL("libapr"      ${LIBAPR_VERSION}      "${PROCESS_3RD_BIN}")
 
 if (NOT WIN32)
   EXTERNAL("glog" ${GLOG_VERSION} "${PROCESS_3RD_BIN}")