Add small fixes allowing CMake to build Process tests on OS X 10.10.
There are two things that have to change in the current CMake build
solution in order to work on OS X 10.10:
* librt (which holds the POSIX.1b Realtime Extensions interfaces in
Linux, including things like async I/O and memory-mapped files,
etc.) does not exist on OS X, and does not need to be linked.
* The version of GTest attempts to find std::tr1::tuple, which is
not available on OS X 10.10. Like we have done in autotools
(see[1] and also configure.ac) we simply define
`GTEST_USE_OWN_TR1_TUPLE` when we're compiling on OS X.
[1]
https://mail-archives.apache.org/mod_mbox/mesos-dev/201403.mbox/%[email protected]%3E
Review: https://reviews.apache.org/r/36741
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c0c03da8
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c0c03da8
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c0c03da8
Branch: refs/heads/master
Commit: c0c03da872405ac363f6ff0699fc4e6ab0b5a9e3
Parents: 0765aa6
Author: Alex Clemmer <[email protected]>
Authored: Thu Jul 23 16:40:03 2015 -0700
Committer: Benjamin Hindman <[email protected]>
Committed: Thu Jul 23 16:49:08 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/CMakeLists.txt | 13 ++++++++++---
3rdparty/libprocess/cmake/ProcessConfigure.cmake | 10 ++++++++--
3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake | 10 ++++++++++
3 files changed, 28 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/c0c03da8/3rdparty/libprocess/3rdparty/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/CMakeLists.txt
b/3rdparty/libprocess/3rdparty/CMakeLists.txt
index 851ab94..d7c6dfb 100644
--- a/3rdparty/libprocess/3rdparty/CMakeLists.txt
+++ b/3rdparty/libprocess/3rdparty/CMakeLists.txt
@@ -139,14 +139,21 @@ else (REBUNDLED)
set(PROTOBUF_URL
https://github.com/hausdorff/mesos/raw/test_cmake/3rdparty/libprocess/3rdparty/protobuf-${PROTOBUF_VERSION}.tar.gz)
endif (REBUNDLED)
-if (NOT WIN32)
+if (APPLE)
+ # GTEST on OSX needs its own tr1 tuple.
+ # TODO(dhamon): Update to gmock 1.7 and pass GTEST_LANG_CXX11 when
+ # in C++11 mode.
+ set(GMOCK_BUILD_CMD make CPPFLAGS=-DGTEST_USE_OWN_TR1_TUPLE)
+ set(GMOCK_CONFIG_CMD ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib/lib)
+elseif (NOT WIN32)
set(GMOCK_CONFIG_CMD ${GMOCK_ROOT}/configure --prefix=${GMOCK_ROOT}-lib/lib)
set(GMOCK_BUILD_CMD make)
+endif (APPLE)
+if (NOT WIN32)
set(PROTOBUF_CONFIG_CMD ${PROTOBUF_ROOT}/src/../configure
--prefix=${PROTOBUF_LIB})
set(PROTOBUF_BUILD_CMD make)
set(PROTOBUF_INSTALL_CMD make install)
-
endif (NOT WIN32)
ExternalProject_Add(
@@ -175,4 +182,4 @@ list(
${CMAKE_SOURCE_DIR}/3rdparty/libprocess/3rdparty/stout/cmake
)
include(StoutTestsConfigure)
-add_subdirectory(stout/tests)
\ No newline at end of file
+add_subdirectory(stout/tests)
http://git-wip-us.apache.org/repos/asf/mesos/blob/c0c03da8/3rdparty/libprocess/cmake/ProcessConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessConfigure.cmake
b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
index d6cdd05..4681eef 100755
--- a/3rdparty/libprocess/cmake/ProcessConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessConfigure.cmake
@@ -134,11 +134,17 @@ set(PROCESS_LIBS
if (NOT WIN32)
find_package(ZLIB REQUIRED)
- find_library(LIBRT_LIBRARIES rt REQUIRED)
+
+ # TODO(hausdorff): The `LINUX` flag comes from MesosConfigure; when
+ # we port the bootstrap script to CMake, we should also copy this
+ # logic into .cmake files in the Stout and Process libraries'
+ # folders individually.
+ if (LINUX)
+ set(PROCESS_LIBS ${PROCESS_LIBS} rt)
+ endif (LINUX)
set(PROCESS_LIBS
${PROCESS_LIBS}
${ZLIB_LIBRARIES}
- ${LIBRT_LIBRARIES}
)
endif (NOT WIN32)
http://git-wip-us.apache.org/repos/asf/mesos/blob/c0c03da8/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
index 082489c..3c1bb0b 100644
--- a/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
+++ b/3rdparty/libprocess/cmake/ProcessTestsConfigure.cmake
@@ -39,6 +39,16 @@ EXTERNAL("protobuf" "2.5.0" "${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)
+
+# COMPILER CONFIGURATION.
+#########################
+if (APPLE)
+ # GTEST on OSX needs its own tr1 tuple.
+ # TODO(dhamon): Update to gmock 1.7 and pass GTEST_LANG_CXX11 when
+ # in C++11 mode.
+ add_definitions(-DGTEST_USE_OWN_TR1_TUPLE=1)
+endif (APPLE)
# DEFINE PROCESS TEST LIBRARY DEPENDENCIES. Tells the process library build
# tests target download/configure/build all third-party libraries before