Repository: mesos Updated Branches: refs/heads/master efb73d343 -> 619f45f0f
Add CMake-based build system for Mesos project. See MESOS-898. This is the first of two commits that will introduce a CMake-based build system for the Mesos project. These commits are split along the libprocess boundary -- this first commit will provide the CMake build logic for the "core Mesos" project, while the second one will introduce the CMake build logic for the process library. They are committed independently to provide a natural history boundary between the two projects. CMake provides a number of advantages over the Make-based build system currently in place. The most obvious of these is much greater platform independence -- CMake supports a wide variety of platforms and environments (even Visual Studio on Windows), which opens Mesos up for contributions from organizations with drastically different toolchains than the current Mesos default. The second is that this gives us an opportunity to audit the existing build system. The plan moving forward is to develop the CMake build system incrementally and in paralllel to the autoconf build system. Review: https://reviews.apache.org/r/36513 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4c1aa47c Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4c1aa47c Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4c1aa47c Branch: refs/heads/master Commit: 4c1aa47c4be57dc6436a5b1b8c7c985c6d625e26 Parents: efb73d3 Author: Alex Clemmer <[email protected]> Authored: Tue Jul 21 17:22:38 2015 -0700 Committer: Benjamin Hindman <[email protected]> Committed: Tue Jul 21 17:49:52 2015 -0700 ---------------------------------------------------------------------- CMakeLists.txt | 51 +++++++++++++++++++++++++ cmake/MesosConfigure.cmake | 83 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/4c1aa47c/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..3b6f4af --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,51 @@ +# 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. + +# THE MESOS PROJECT. +#################### +cmake_minimum_required(VERSION 2.8) + +project(Mesos) +set(MESOS_PACKAGE_VERSION 0.22.1) +set(MESOS_PACKAGE_SOVERSION 0) + +# MESOS BUILD CONFIGURATION OPTIONS. +#################################### +option(_DEBUG "Set default build configuration to debug" ON) +option(VERBOSE "Enable verbose CMake statements and compilation output" TRUE) +option( + REBUNDLED + "Build dependencies from tar.gz files in 3rdparty folder instead of downloading" + TRUE + ) +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/libprocess/cmake) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libprocess/cmake/macros) + +# Macros. +include(PatchCommand) +include(External) + +# Configuration. +include(MesosConfigure) + +# SUBDIRECTORIES. +################# +add_subdirectory(3rdparty/libprocess) http://git-wip-us.apache.org/repos/asf/mesos/blob/4c1aa47c/cmake/MesosConfigure.cmake ---------------------------------------------------------------------- diff --git a/cmake/MesosConfigure.cmake b/cmake/MesosConfigure.cmake new file mode 100755 index 0000000..16b72f1 --- /dev/null +++ b/cmake/MesosConfigure.cmake @@ -0,0 +1,83 @@ +# 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(CheckCXXCompilerFlag) + +# SYSTEM CONFIGURATION INFORMATION. +################################### +string(TOUPPER "${CMAKE_SYSTEM_NAME}" OS_NAME) +string(TOUPPER "${CMAKE_SYSTEM_VERSION}" OS_VER) +string(TOUPPER "${CMAKE_SYSTEM_PROCESSOR}" SYS_ARCH) + +# CMAKE CONFIGURE LOGO. +####################### +message(STATUS "************************************************************") +message(STATUS "********* Beginning Mesos CMake configuration step *********") +message(STATUS "************************************************************") +message(STATUS "INSTALLATION PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS "MACHINE SPECS:") +message(STATUS " Hostname: ${HOSTNAME}") +message(STATUS " OS: ${OS_NAME}(${OS_VER})") +message(STATUS " Arch: ${SYS_ARCH}") +message(STATUS " BitMode: ${BIT_MODE}") +message(STATUS " BuildID: ${BUILDID}") +message(STATUS "************************************************************") + +# SET UP TESTING INFRASTRUCTURE. +################################ +enable_testing() + +# CONFIGURE COMPILATION. +######################## +if (_DEBUG) + set(CMAKE_BUILD_TYPE Debug) +endif (_DEBUG) + +# Set CXX standard. A bit more verbose than it would be in CMake 3. +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +if (COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +else (COMPILER_SUPPORTS_CXX11) + message( + STATUS + The compiler ${CMAKE_CXX_COMPILER} does not support the `-std=c++11` flag. + Please use a different C++ compiler.) +endif (COMPILER_SUPPORTS_CXX11) + +# 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) + +# THIRD-PARTY CONFIGURATION. +############################ +# 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)
