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 <[email protected]> Authored: Sun Sep 27 15:41:34 2015 -0700 Committer: Joris Van Remoortere <[email protected]> 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
